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);
//Saving the Excel to the MemoryStream
MemoryStream streamPDF = new MemoryStream();
//Close the document
streamPDF.Position = 0;
fileStreamResult = new FileStreamResult(streamPDF, "application/pdf");
fileStreamResult.FileDownloadName = fileNamePDF;
with return type FileStreamResult
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@example.com, mentioning this forum ID.
Also, please confirm the Syncfusion XlsIO version you are using at your end.
Iam using 188.8.131.52 version
here the excel
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.
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.
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.
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.
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.
Muhammed, on validating, we found that the issue in alignment is due to default system
Please go through the below article, where different ways to avoid suchchanges are documented.
Kindly try these to overcome theissue.