We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Legend Entries Issue When Converting Excel to PDF & PPTX

Hi Team,

I have an excel in which I can see 1 column of legends - (ref. to Image-1).

But when I try to convert to PDF(ref. to Image-2) and PPT(ref. to Image-3) I can see 2 columns of legends.

When I check (File --> Print ) print preview there also I can see 2 columns of legends but in the actual excel we can see only 1 column of legends. If you expand the legend then you will be able to see 2 columns of legends.

Could you please look into this and let us know the difference in the legend display from excel to pdf/pptx conversion.

Please find the attached excel sample report, pdf & ppt generated from the excel, code for excel to pdf and excel to pptx conversion.

Kindly let me know if any further info. if required.

Regards,
Sanjeev

Hi,


Thanks for providing us template files and screenshots.

I have evaluated your scenario/case a bit. Well, it is not an issue with the product by any means. For your information, Aspose.Cells does render images or PDF files for Excel spreadsheets based on what is shown in Print Preview of the sheets/charts in MS Excel. So, you may open your spreadsheet in Ms Excel manually, select the Chart and then take the Print Preview, you will see two columns for legend. Aspose.Cells does follow MS Excel specifications and standards when rendering sheet/chart to PDF/image file formats, so when you render to PDF file using MS Excel built-in renderer, the resultant PDF is same as per the output image/PDF file generated by Aspose.Cells. I have attached the output PDF file by MS Excel for the chart/sheet for your reference, you will see it also renders two columns for the legend.

Thank you.

Hi Sanjeev,


Please use the Chart.toImage and Chart.toPdf methods if you wish to render the chart as it is being displayed in Excel interface. Please try the following piece of code and see if it suits your requirements.

Java

Workbook workbook = new Workbook(dir + “LegendIssue.xlsx”);
Worksheet worksheet = workbook.getWorksheets().get(0);
Chart chart = worksheet.getCharts().get(“Chart 2”);
chart.toImage(dir + “output.png”);
chart.toPdf(dir + "output.pdf");

Dear Babar Raza / Amzad Sahi,

Since we are converting the entire excel print area into a .png / .emf
image we cannot convert individual components of our report.

Could you please suggest us whether there is any workaround for this issue.

Regards,
Sanjeev

Hi,


Please try the workaround (with latest version/fix) as we have already asked you in our previous reply in the thread:
https://forum.aspose.com/t/34762

I am afraid, there might not be any better way to cope with it. Also, as we already told you that when you do render to PDF manually in MS Excel, the PDF looks very similar to what Aspose.Cells’ generated PDF file.

Thank you.