Production Stopping Issue - Pie chart to image yields blank output

Hi,


I am using aspose-cells-8.3.2.jar.
On converting a pie chart to image or pdf, I get a blank output.

Kindly treat this issue on urgent basis as this has come from the customer’s production environment.

Code snippet for image:
chart.toImage(outputFile.getAbsolutePath(),getImageOrPrintOptions(ExcelDataObjectTypes.CHART, outputFormatProperties, true, false));

Code snippet for PDF
private File chartToPdf(Workbook workbook, com.aspose.cells.Chart chart, NameValue[] outputFormatProperties) throws IOException,Exception {
WorksheetCollection ws = workbook.getWorksheets();
ChartShape cshape = chart.getChartObject();
int sheetIndex = ws.add();
com.aspose.cells.Worksheet worksheet = ws.get(sheetIndex);
worksheet.getCells().setStandardWidth(1);
//Setting the name of the newly added worksheet
String transientSheetName = “TransientWorksheet”;
worksheet.setName(transientSheetName);
//Copy the Chart to Second Worksheet
worksheet.getShapes().addCopy(cshape, 0, 0, 0, 0);
//Get the new chart and set its height and width accordingly
com.aspose.cells.Chart chart1 = worksheet.getCharts().get(0);
chart1.getChartArea().setHeight(cshape.getHeight());
chart1.getChartObject().setWidth(cshape.getWidth());
//Make remaining worksheets invisible so that they are not part of the output pdf
for (int i = 0; i < ws.getCount(); i++) {
String sheetName = ws.get(i).getName();
if(!transientSheetName.equalsIgnoreCase(sheetName)){
ws.get(i).setVisible(false);
}
}
PdfSaveOptions pdfSaveOptions = getPdfSaveOptions();
worksheet.getPageSetup().setTopMargin(pdfOutputTopMargin);
worksheet.getPageSetup().setBottomMargin(pdfOutputBottomMargin);
worksheet.getPageSetup().setRightMargin(pdfOutputRightMargin);
worksheet.getPageSetup().setLeftMargin(pdfOutputLeftMargin);
// Save the workbook
File outputPdfFile = OfficeResourceUtility.createTemporaryFile(".pdf");
workbook.save(outputPdfFile.getAbsolutePath(), pdfSaveOptions);
workbook.save(“c:\temp\test.xlsx”, SaveFormat.XLSX);
return outputPdfFile;
}

I tried with the attached excel file.
Sheetname : charts & tables
Problematic Charts : Chart 1, Chart 2

Same behavior works fine when done from within the MS Excel.

Can you please help me with this issue.

Thanks,
Jaspreet

Hi Jaspreet,


Thank you for contacting Aspose support.

We have evaluated both of your presented scenarios while using the latest version of Aspose.Cells for Java 8.4.0.8, and we are able to replicate both mentioned issue. In order to investigate the matter further, and to pin point the problem cause, we have logged the following tickets in our database.

  1. CELLSJAVA-41276: Chart.toImage generates a blank image for Pie Chart
  2. CELLSJAVA-41277: Rendering only Pie Chart results in a blank PDF

Please allow us some time to properly analyze the scenarios. In the meanwhile, we will keep you posted with updates in this regard.

Hi,

Thanks for using Aspose.Cells for Java.

We have fixed the issues CELLSJAVA-41276 and CELLSJAVA-41277 relating to Pie Chart blank problem.

Please download and try this fix: Aspose.Cells for Java v8.4.1.1 and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-41277;CELLSJAVA-41276) have been fixed in this update.


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