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

Free Support Forum - aspose.com

Crash when using the 18.8 version

Hello,

Please reply to _visualization@oodrive.com

I have a crash when converting an Excel file to PDF with the following stacktrace:
com.aspose.cells.CellsException
at com.aspose.cells.zcau.a(Unknown Source)
at com.aspose.cells.zcau.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)

The same code works fine with the 18.7 version.

The code is basically like that:

Workbook workbook = new Workbook(inputStream, LoadOptions(0));

int sheetCount = workbook.getWorksheets().getCount();
for (int s = 0; s < sheetCount; s++) {
Worksheet sheet = workbook.getWorksheets().get(s);
PageSetup pageSetup = sheet.getPageSetup();
pageSetup.setLeftMargin(MARGIN_CM);
pageSetup.setRightMargin(MARGIN_CM);
pageSetup.setTopMargin(MARGIN_CM);
pageSetup.setBottomMargin(MARGIN_CM);
pageSetup.clearHeaderFooter();
}

PdfSaveOptions options = new PdfSaveOptions();
options.setOnePagePerSheet(true);
workbook.save(outputStream, options); // <- here’s the crash

Do you have an idea of what should be done?

Regards,

M. Ion
_visualization@oodrive.com

@elouarghani,

Thanks for the sample code segment and stack trace.

Please provide us your template Excel file (you may zip the file and attach it here). Also, provide the variable/object value to specify the margins. This will help us really to evaluate your issue precisely to consequently figure it out soon.

Excel.zip (1015.8 KB)

MARGIN_CM is 0.4

Sorry for the delayed reply, but I was on holiday!

@john57,

Thank you for providing the sample file. I have tried following code using Aspose.Cells for Java 18.9.x but could not observe any issue. You may please give it a try using latest version and share the feedback.

Workbook workbook = new Workbook(path + "Tests_Transfo_Tableurs.xlsx");

int sheetCount = workbook.getWorksheets().getCount();
for (int s = 0; s < sheetCount; s++) {
    Worksheet sheet = workbook.getWorksheets().get(s);
    PageSetup pageSetup = sheet.getPageSetup();
    pageSetup.setLeftMargin(0.4);
    pageSetup.setRightMargin(0.4);
    pageSetup.setTopMargin(0.4);
    pageSetup.setBottomMargin(0.4);
    pageSetup.clearHeaderFooter();
}

PdfSaveOptions options = new PdfSaveOptions();
options.setOnePagePerSheet(true);
workbook.save(path + "output.pdf", options); // <- here’s the crash

You may try the latest version given below:
Aspose.Cells for Java 18.9.3.zip
output.zip (3.3 MB)

Yes, I confirm - with 18.9 version there’s no more crash.

@elouarghani,

Good to know that your issue is sorted out by the new version/fix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.