The exported chart has x-axis labels different from the one in the Excel

Hi,

I tried to export a chart from Excel to a PNG. Noticed that the PNG has x-axis labels different from the chart in the Excel.

Cannot fix it. I attached the Excel and PNG for your reference.

Please advise how to fix it, thanks.

final String dataDir = “C:\development\;
final Workbook workbook = new Workbook(dataDir + “sample.xlsx”);
final Worksheet sourceSheet = workbook.getWorksheets().get(“EmailChart1”);

if (sourceSheet != null) {
final Chart chart = sourceSheet.getCharts().get(“EmailChart1”);
if (chart != null) {
final ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();
imageOptions.setImageFormat(ImageFormat.getPng());
chart.toImage(“C:\development\chart.png”, imageOptions);
}
}

Hi,


Thanks for providing us template file, screenshot and sample code.

After an initial, I observed the issue as you mentioned (via screenshot) by using your sample code with your template file. I found that the exported chart image has x-axis labels different than the original chart. I have logged a ticket with an id “CELLSJAVA-42155” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

Thanks a lot.


I also noticed that if the Chart in Excel has legend defined (Please see the attached ChartInExcel.png), I exported the chart using the same code, the exported one won’t show the second level labels (Please see the attached ChartExport.png).

Take a look please. Thanks,

Hi,


Thanks for the screenshot.

I have evaluated/ tested using the attached file with v17.1.1, it works fine regarding second level labels. I simply opened your previous file “sample.xlsx” into MS Excel manually and then set Show Legend at bottom and resaved the file. Now I used your code with v17.1.1, it works fine, see the image attached for your reference.

Thank you.

Yes, you are right. The second level labels were showing on chart after followed your steps.


However, I tried resize the chart in the Excel a bit smaller, then the second level labels disappeared on chart.

I tested it with v17.1.0, since I cannot get the v17.1.1 through Gradle.

Thanks,

Hi,


Could you share your template Excel file containing the chart, we will test the conversion on our end.

Thank you.

Attached it. Nothing special, just resized the chart smaller.

Hi,


Thanks for the new sample file.

You are right as I tested. When we make the Legend shown and also minimize the size of the chart in the worksheet, the second level labels are not shown anymore in the output image. I have also logged the case/findings with comments to your existing ticket “CELLSJAVA-42155”. We will also consider it while fixing your issue.

Thank you.

Any updates on this fix?

Hi,


I am afraid, your issue (logged as “CELLSJAVA-42155”) is not resolved yet. However, I have asked the concerned developer from product team to update on it or provide an ETA (if possible).

Once we have an update on it, we will let you know here immediately.

We are sorry for any inconvenience caused!

Hi,


Thanks for using Aspose.Cells.

For your issue logged as

  • CELLSJAVA-42155 - The exported chart has x-axis labels different from the one in the Excel

We are working over issue and we are hopeful, it will be fixed before 1st March, 2017.
Hi,

Thanks for using Aspose.Cells.

Please download and try the following latest fix: Aspose.Cells for Java v17.02.1 and let us know your feedback.

It works now. Thank you

Hi again,


Thank you for the confirmation. It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.

The issues you have found earlier (filed as CELLSJAVA-42155) have been fixed in Aspose.Cells for Java 17.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.