We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

PDF Export

Thread ID:

Created:

Updated:

Platform:

Replies:

131789 Jul 27,2017 05:48 AM Aug 8,2017 12:32 PM ASP.NET Web Forms 6
loading
Tags: Gantt
Martin Sickel
Asked On July 27, 2017 05:48 AM

Hi

I tryed to export the GANTT Control using the codesample you provided.

             var exp = new PdfExport();
            var settings = new GanttPdfExportSettings();
            settings.EnableFooter = true;
            settings.ProjectName = "Project Tracker";
            settings.Locale = e.Arguments["locale"].ToString();
            settings.Theme = GanttExportTheme.FlatLime;
            settings.IsFitToWidth = true;
            exp.Export(GanttControlDefault.Model, (IEnumerable) GanttControlDefault.DataSource, settings, fileName: "ResourcePlanner");

But I will get an error which tells me that DateTime will have an issue, how can I avoid this?

I have added a screenshot with the error message

Martin

Attachment: PDF_Export_Issue_2184eac.zip

Jayakumar Duraisamy [Syncfusion]
Replied On July 28, 2017 12:49 PM

Hi Martin, 
We have analyzed your given screenshot and the error says that date format used in your datasource is not valid. Can you please ensure that date format used in your data source as similar with value of Gantt dateFormat?  
Suppose, if you want to change the Gantt default date format. It can be change by using DateFormat API. 
For example: DateFormat is MM/dd/yyyy and your data source value is 7/5/2017 or 07-05-2017 then it will get an exception.  
Please find the following code snippet, 
<ej:Gantt ID="Gantt"  
//… 
DateFormat="MM/dd/yyyy" 
> 
We have also prepared a sample for your reference. Please find the sample location as below, 
If you are facing this issue again, please share a demo sample which we can able to reproduce the reported issue. It will help us to serve you better. 
Regards, 
Jayakumar D 


Martin Sickel
Replied On August 6, 2017 07:34 AM

Hi,

I have tryed the example you have prepared, but still get an error.

Picture of the error is attached.


Cheers

Martin


Attachment: 862017_13053_PM_76e912ca.zip

Jayakumar Duraisamy [Syncfusion]
Replied On August 7, 2017 06:47 AM

Hi Martin, 
As explained in the earlier update, the error message say that data source date value or format is invalid date Format. 
Hence, we have analyzed the possibilities to get this error as mentioned below, 
  • Ensure that anyone of the date value have invalid format in your data source. It date value should be MM/dd/yyyy or any valid format
  • Ensure that date format API format and date values in the data source are different. It should be same format as MM.dd.yyyy -> 08.07.2017.
  • If you are referred any localization then localization format should be same as date value.
If you get this error, after ensured with above given steps. Please share your sample, it will helpful for us to provide exact solution for this issue. 
Regards, 
Jayakumar D 


Martin Sickel
Replied On August 7, 2017 12:28 PM

Hi,

Thanks for the answer, I did some research and I am able to break it down to the following lines.

This is my config for the Gantt Control what is facing the error.

            <ej:Gantt ID="GanttControlDefault" runat="server" Enabled="true" AllowDragAndDrop="true" AllowColumnResize="true" ShowColumnChooser="true"                AllowMultiSorting="true"

                Locale="de-DE"

                DateFormat="dd.MM.yyyy"

                ToolbarClick="toolbarClick" 

                ContextMenuOpen="contextMenuOpen"

                AllowKeyboardNavigation="true"

                ShowResourceNames="true"

                AllowSorting="true"

                EnablePredecessorValidation="true"

                SplitterPosition="40%"

                RenderBaseline="true"

                IsResponsive="true"

                AllowGanttChartEditing="true"

                EnableContextMenu="true"

                ChildMapping="Children"

                BaselineStartDateMapping="BaselineStart"

                BaselineEndDateMapping="BaselineEnd"

                PredecessorMapping="Predecessors"  

                RowDragStop="rowDragStop"

                TaskIdMapping="TaskId"

                TaskNameMapping="TaskName"

                ParentTaskIdMapping="ParentId"

                ResourceInfoMapping="Resources"

                ResourceNameMapping="ResourceName"

                ResourceIdMapping="ResourceId"

                StartDateMapping="StartDate"

                EndDateMapping="EndDate"

                DurationUnit="Day"

                DurationMapping="Duration"

                ProgressMapping="Progress"


                NotesMapping="Note"

                TreeColumnIndex="1"

                OnServerPdfExporting="GanttControlDefault_ServerPdfExporting"

                OnServerExcelExporting="GanttControlDefault_ServerExcelExporting"

                ActionComplete="ActionComplete">

                <EditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" AllowIndent="true" EditMode="normal" />

                <ScheduleHeaderSettings ScheduleHeaderType="Week" />



                <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,delete,update,cancel,indent,outdent,pdfExport,excelExport,expandAll,collapseAll,prevTimeSpan,nextTimeSpan,criticalPath,search">

                    <CustomToolbarItems>

                        <ej:GanttCustomToolbarItem Text="Save" TooltipText="Save" />

                    </CustomToolbarItems>

                </ToolbarSettings>

                <DragTooltip ShowTooltip="true" />

                <SizeSettings Height="100%" Width="100%" />

            </ej:Gantt>


If I remove the following lines

                    <CustomToolbarItems>

                        <ej:GanttCustomToolbarItem Text="Save" TooltipText="Save" />

                    </CustomToolbarItems>

then the PDF export is working as expected.

Any ideas?

Martin




Martin Sickel
Replied On August 8, 2017 02:43 AM

Good Morning

I did some additional tests for PDF Export

Here my findings:

I setup the GanttControl like this to match my location:

<ej:Gantt ID="Gantt"  
//… 
Locale="de-DE" 
DateFormat="dd.MM.yyyy" 
> 

After using the standard Fields and removing the CustomToolbarItem, Export is working as expected.
Then I started adding  Holidays and StripLines
See code snippet, 
List<Holiday> lstHoliday = Db.GetHolidayData();
foreach (var item in lstHoliday)
{
  GanttControlDefault.Holidays.Add(new Syncfusion.JavaScript.Models.Holiday() { Day = item.DateToString("dd.MM.yyyy"), Label = item.HolidayName, Background = item.Color });
}

List<StripeLine> lstStripeLine = Db.GetStripeLineData();
foreach (var item in lstStripeLine)
{
  GanttControlDefault.StripLines.Add(new Syncfusion.JavaScript.Models.GanttStripLine() { Day = item.StripDateToString("dd.MM.yyyy"), Label = item.StripName, LineColor = item.Color, LineStyle = item.LineStyle, LineWidth = item.LineWidth });
}
GanttControlDefault.StripLines.Add(new Syncfusion.JavaScript.Models.GanttStripLine() { Day = DateTime.Now.ToString("dd.MM.yyyy"), Label = "Today", LineColor = "ForestGreen", LineStyle = "dotted", LineWidth = 2 });

The DateFormat here is as well dd.MM.yyyy, PDF Export is not working anymore, it will shout out a DateTime error message.

So it looks like the DateTime API is not taking care of those additional Data.
any suggestion?

Cheers, many thanks for the great support
Martin


Jayakumar Duraisamy [Syncfusion]
Replied On August 8, 2017 12:32 PM

Hi Martin, 
 
 
Query 1: If I remove the following lines <CustomToolbarItems>  then the PDF export is working as expected.  
Answer: We regret for the inconvenience caused. 
We can able to replicate the reported issue in our sample. Hence, we have a logged bug report as “Unable to export Pdf when use custom toolbar item in Gantt”. Also, we have created a support incident under your account to track the status of this issue. 
Please log on to our support website to check for further updates. 
Query 2: After using the standard Fields and removing the CustomToolbarItem, Export is working as expected. Then I started adding Holidays and StripLines. The DateFormat here is as well dd.MM.yyyy, PDF Export is not working anymore, it will shout out a DateTime error message. 
 
Answer: We have analyzed the reported issue but unable to replicate in our sample. 
Please ensure that GetHolidayData and GetStripLineData tables, whether the date values are in the “dd.MM.yyyy” format. When export, Gantt date value should be match with “dateFormat”. 
 
Please let us know if you require further assistance on this. 
Regards, 
Jayakumar D 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;