Exporting charts to pdf is cluttered and incompatible

Chartberantakan.jpgChartExcel-min.jpg


Hello, I made an excel from Predefined Excel Template and it contains a chart, I used " application.ChartToImageConverter = new Syncfusion.ExcelChartToImageConverter.ChartToImageConverter();" to accommodate export excel to pdf with existing charts. But when I export it to PDF, the chart is messy and looks truncated (the labels that are displayed are lacking) and the text has shifted from the specified table. even though in Excel there is no weirdness like in the picture on the right above.


iam using this code to export chart to pdf :

//Instantiating the ChartToImageConverter and assigning the ChartToImageConverter instance of XlsIO application

application.ChartToImageConverter = new Syncfusion.ExcelChartToImageConverter.ChartToImageConverter();

//Tuning chart image quality

application.ChartToImageConverter.ScalingMode = ScalingMode.Best;

ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);

                        //Initialize PDF document

                        Syncfusion.Pdf.PdfDocument pdfDocument = new Syncfusion.Pdf.PdfDocument();


                        ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings();

                        //settings.LayoutOptions = LayoutOptions.FitAllColumnsOnOnePage;


                        //Convert Excel document into PDF document

                        pdfDocument = converter.Convert(settings);

//Save the PDF file

                        string fileNamePDF = resultHeader.Name + "-" + resultHeader.Submitter + "-" + resultHeader.Process + "-" + resultHeader.MachineNo + "-" + resultHeader.Equipment + "-" + resultHeader.Classification + "-" + resultHeader.PlanDate + "-" + ".pdf";

                        //pdfDocument.Save(fileNamePDF, HttpContext.ApplicationInstance.Response, HttpReadType.Save);

                        //pdfDocument.Save(fileNamePDF);

                        //Saving the Excel to the MemoryStream

                        MemoryStream streamPDF = new MemoryStream();

                        pdfDocument.Save(streamPDF);

                        //Close the document

                        pdfDocument.Close(true);

                        if (streamPDF.CanSeek)

                            streamPDF.Position = 0;

                        fileStreamResult = new FileStreamResult(streamPDF, "application/pdf");

                        fileStreamResult.FileDownloadName = fileNamePDF;



with return type FileStreamResult




8 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team March 3, 2023 11:15 AM UTC

Hi Muhammed,


We request you to share the Excel document you are using at your end, to investigate the query. If you are not comfortable sharing the file here in public, please email it to [email protected], mentioning this forum ID.


Also, please confirm the Syncfusion XlsIO version you are using at your end.


Regards,

Keerthi.



MA muhammad amin A March 6, 2023 02:35 AM UTC

Iam using 19.4.0.38 version



MA muhammad amin A March 6, 2023 02:36 AM UTC

here the excel


Attachment: excelToruble_9295e606.zip


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team March 6, 2023 01:20 PM UTC

Muhammad, Thanks for sharing the requested details.


As of now, Syncfusion XlsIO do not have support for multi-level category axis in Excel to PDF conversion. We have logged a feature report for this but do not have any immediate plans to implement this. You can track the status of this feature report through below feedback link.

https://www.syncfusion.com/feedback/26279/support-multi-level-category-axis-in-chart-to-image-conversion


Regarding the issue in table, we are able to reproduce it and validating it currently. We will share the validation details on March 8th, 2023.



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team March 10, 2023 10:53 AM UTC

Muhammed, we have confirmed the issue as Category labels are incorrect when multi level labels are applied in the chart and logged a defect report. We will include the fix for this issue in our weekly NuGet release scheduled for March 21st, 2023.


You can track the status of this defect report through below feedback link.

https://www.syncfusion.com/feedback/41956/category-labels-are-incorrect-when-multi-level-labels-are-applied-in-chart


Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.



RS Ramya Sivakumar Syncfusion Team March 22, 2023 10:32 AM UTC

We are unable to move the fix in this Weekly NuGet due to complexity. We will include this fix in our next weekly NuGet release scheduled for April first week, and let you know once the package is available to download from nuget.org.



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team April 4, 2023 02:24 PM UTC

Muhammed, we have included the fix for the issue Category labels are incorrect when multi level labels are applied in the chart in our weekly NuGet release version 21.1.38. Kindly upgrade your packages to this new version and let us know if the reported issue is resolved.


Latest NuGet Package: https://www.nuget.org/packages/Syncfusion.ExcelChartToImageConverter.AspNet.Mvc5/21.1.38 


But, we have an issue in alignment and validating this. We will share the details for this on March 6th, 2023.



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team April 6, 2023 01:32 PM UTC

Muhammed, on validating, we found that the issue in alignment is due to default system DPI-aware of WPF application. 

 

Please go through the below article, where different ways to avoid such DPI changes are documented.

https://www.syncfusion.com/kb/10795/how-to-avoid-dpi-changes-while-converting-the-excel-presentation-word-documents-with-chart

 

Kindly try these to overcome the DPI issue.


Loader.
Up arrow icon