Export PDF

I'm able to view gantt chart with null StartDate & EndDate values in our frontend code (in Angular). But not able to export it from server (in ASP .NET).
When all StartDate & EndDate have not null value it is working fine.

PDF export

1 ) Working
    {
        TaskID: 1,
        TaskName: 'Product concept',
        StartDate: new Date('04/02/2019'),
        EndDate: new Date('04/21/2019'),
    },

2) Not Working
    {
        TaskID: 1,
        TaskName: 'Product concept',
        StartDate: null,
        EndDate: null,
    },

6 Replies 1 reply marked as answer

GM Gopinath Muniraj Syncfusion Team December 15, 2020 01:30 PM UTC

Hi Jignesh, 
Thanks for contacting Syncfusion support. 
Please confirm that are you using EJ1 or EJ2 Gantt. Are you exporting the Gantt in front end as angular? Actually, server-side exporting is not possible in EJ2.  
In local data binding and client-side exporting, with the start date and end date as null, the exporting is working fine. We have prepared a sample. Please get the sample from below link. 
Please let us know your use case and how do your exporting the Gantt in server-side. Please share us your code snippet. 
It will be helpful for us to investigate further and resolve the issue as soon as possible. 
Thanks, 
Gopinath M 



JI Jignesh December 16, 2020 05:07 AM UTC

Hi,
  1. I'm using EJ1 Gantt.
  2. Our frontend is in angular. But we are exporting PDF from server side in C# .NET
  3. I'm referring below code from syncfusion documentation (link: https://help.syncfusion.com/aspnet/gantt/exporting?cs-save-lang=1&cs-lang=csharp)
     4. I'm able to export pdf using above code when all data is filled, but it throws null exception error when StartDate and EndDate value is null.
     
PFA exported pdf sample

Attachment: Exported_PDF_sample_2905b131.zip


GM Gopinath Muniraj Syncfusion Team December 18, 2020 02:21 AM UTC

Hi Jignesh, 
Thanks for the information. As we have checked from our side, we are not able to reproduce the issue that you have reported. Even we pass the start date and end date as null, the Gantt is exporting fine in the PDF. We have prepared a sample for your reference. Please get the sample from below link. 
Please share us the code snippet or an issue reproducible sample. It will be helpful for us to reproduce the issue and resolve it ASAP. 
Regards, 
Gopinath M 



JI Jignesh December 21, 2020 12:45 PM UTC

Hi,

     1) I checked sample code. It is not working properly.  It throws null exception error.
          PFA video recording of sample provided by you. 

     2) I made some changes in backend function GetEditingDataSource data according to my actual query of null dates. 
          Can you please verify export PDF for that particular data. 
          I have attached text file for function GetEditingDataSource.


Attachment: GetEditingDataSource_476d7935.zip


JI Jignesh December 21, 2020 12:47 PM UTC

Hi,

     1) I checked sample code. It is not working properly.  It throws null exception error.
          PFA video recording of sample provided by you. 

     2) I made some changes in backend function GetEditingDataSource data according to my actual query of null dates. 
          Can you please verify export PDF for that particular data. 
          I have attached text file for function GetEditingDataSource.



Attachment: Video_recording__Function_text_file_b87c4e7a.zip


GM Gopinath Muniraj Syncfusion Team December 22, 2020 01:17 PM UTC

Hi Jignesh, 
We have analyzed your query.  
Please confirm that are you exporting the back-end data or front-end data. In the sample we have shared, we are passing the client-side data to the server-side PdfExport method and exporting the Gantt. 
And we have exported the server-side as well with start date and end date as null. Please refer the below code snippet, 
public void PdfExport(string GanttModel) 
{ 
            var DataSource = GetData(); 
            PdfExport exp = new PdfExport(); 
            GanttProperties obj = ConvertGanttObject(GanttModel); 
            GanttPdfExportSettings settings = new GanttPdfExportSettings(); 
            settings.Theme = GanttExportTheme.FlatSaffron; 
            settings.Locale = Request.Form["locale"]; 
            //exp.Export(obj, (IEnumerable)exportData, settings, "Gantt"); // Exporting client-side data 
            exp.Export(obj, (IEnumerable)DataSource, settings, "Gantt"); // Exporting server-side data 
} 
 
We are suspecting that the mapping name should be different between the dataSource and the ganttObject. This the reason for the exception. 
The taskNameMapping property in the GanttObject is “taskID”, but in the datasource this is “TaskID”, due to this kind of mismatching exception may arise. To overcome this, please change the field name in the datasource. Please refer the below images. 
[datasource] 
 
 
[ganttObject] 
 
 
 
Please contact us if you need any further details on this. 
Thanks, 
Gopinath M 


Marked as answer
Loader.
Up arrow icon