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

Free Support Forum - aspose.com

How to rendering a blank sheet or empty sheet in java cells

Hi,

If we want to rendering the blank sheet or empty sheet on excel cell for java is it possible?

If there is a blank sheet in a rendering loop , it will give out error message .

Thanks,

@yhBlue

Thanks for using Aspose APIs.

Please use the following property and set it true and it should fulfill your needs.

ImageOrPrintOptions.OutputBlankPageWhenNothingToPrint

This property is introduced recently, so you must use the most recent version.

Here is the sample code and its output png image for your reference.

Java

Workbook wb = new Workbook();

Worksheet ws = wb.getWorksheets().get(0);

ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.setOutputBlankPageWhenNothingToPrint(true);//<<<<<<<<<<<<<<<<<<<Use this property
opts.setImageFormat(ImageFormat.getPng());

SheetRender sr = new SheetRender(ws, opts);
sr.toImage(0, dirPath + "out.png");

Download Links:
Aspose.Cells for Java v17.7.7
out.jpg (3.4 KB)