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

Free Support Forum - aspose.com

chart.toImage() ignores line breaks in category cells

I am unable to get line breaks into the x-(category)labels of an exported chart image. I do get the line break into the original cell, the resulting chart’s category-labels within the workbook contain the line breaks, too, so that looks fine. But when saving the chart to an image, the line breaks somehow disappear.

cell = cells.getCell(“A2”);
cell.setValue("some cell with \n line break ");
style = cell.getStyle();
style.setTextWrapped(true);
cell.setStyle(style);
// …more cells

nSeries.setCategoryData(“Daten!A2:A4”);

chart.toImage(chartOut, this.chartImageOptions);

Is there anything I can do to make the exported chart image look just like the chart within the excel workbook (line-break-wise)?

Thanks a lot in advance!
Lennart

Hi Lennart,

Please try the attached latest version/fix, I have tested your case, it works fine with wrapped text in category labels.

If you still find the issue, kindly post your generated excel file or sample code to create the excel file and the output image here, we will check your issue soon.

Thank you.

The new version dit it - I am happy :-).

Thank you very much for your fast response!
Lennart