Aspose Cells Render sheet to image/svg bug

Creating an image/svg from an empty workbook results in no output.

Expected result: Empty (white) image / svg.

Steps to reproduce:

  1. Create a new file

Workbook workbook = new Workbook();
workbook.save(outputStream, com.aspose.cells.SaveFormat.XLSX);
workbook.dispose();

  1. Try to generate an image

Workbook workbook = new Workbook(inputStream);

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.setSaveFormat(SaveFormat.SVG);
imgOptions.setOnePagePerSheet(true);

Worksheet sheet = workbook.getWorksheets().get(0);
SheetRender sheetRender = new SheetRender(sheet, imgOptions);
sheetRender.getPageCount() is 0

  1. How to pass around bug by creating file differently

Workbook workbook = new Workbook();

workbook.getWorksheets().get(0).getCells().get(0,0).setValue(""); // <- prevents bug

workbook.save(outputStream, com.aspose.cells.SaveFormat.XLSX);
workbook.dispose();

Cheers,

Thomas

@thomas.winklehner,

Thanks for the sample code.

I think Aspose.Cells correctly gives total number of pages as “0” as there is nothing to render or print on the sheet.

To confirm Aspose.Cells works the same way as MS Excel does. Please open the empty workbook into MS Excel manually and display the first worksheet. Now open the Page Setup dialog box, click on “Print Preview”, you will see MS Excel gives message that it did not find anything to print. Also there is no number of pages to be printed. So, Aspose.Cells correctly gives 0 as number of pages to be rendered. Zero refers to an empty worksheet.

Thank you.

I tested this behaviour on Mac OSX, Excel V15.36. As I expected Excel prints a white page and does’t show an error message.
Word and Powerpoint behave the same and work correctly in Aspose (Words, Slides), meaning giving back a blank page and not null. I still believe this is a bug.

@thomas.winklehner,

Thanks for providing us further details.

Well, this is not a bug rather you want enhancements for your requirements to cope with it on MS Excel (Mac). We confirmed for MS Excel (Mac), it outputs an empty page when there is nothing to print. This is different with MS Excel (Windows). Anyways, as you want to output an empty page even if there is nothing to be printed, we can add a property to indicate whether to output an empty page or not when there is nothing to print. I have logged a ticket with an id “CELLSJAVA-42356” for your issue/requirements. We will look into it soon.

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

Thank you.

@thomas.winklehner

Thanks for using Aspose APIs.

This is to inform you that we have fixed your issue CELLSJAVA-42356 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

@thomas.winklehner,

Please try the latest version/fix: Aspose.Cells for Java v17.7.7:

We have added OutputBlankPageWhenNothingToPrint property in ImageOrPrintOptions in v 17.7.7. So, using ImageOrPrintOptions.setOutputBlankPageWhenNothingToPrint(true) is to output a blank page when there is nothing to print.

Let us know your feedback.

Thank you.

Your issues (logged earlier as CELLSJAVA-42356) have been fixed in Aspose.Cells for Java 17.8.

1 Like

Thanks a lot.