SheetRendrer doesn't honor pageIndex when rendering ODS to PNG


#1

I use java lib aspose-cells v 18.10 . The task is to create png image for the first page of the first worksheet. I use the code provided in aspose docs https://docs.aspose.com/display/cellsjava/Converting+Worksheet+to+Different+Image+Formats
It works for all table formats (xls, xlsx, etc) but for ODS the resulting image conatins whole worksheet.


#2

@OlgaK,
You may please give a try to the following sample code and provide your feedback. If issue is still there, please share your sample code and template ODS file for our testing.

Workbook book = new Workbook("Sample.ods");
Worksheet sheet = book.getWorksheets().get(0);
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setHorizontalResolution(200);
options.setVerticalResolution(200);
options.setImageType(ImageType.PNG);
SheetRender sr = new SheetRender(sheet, options);
sr.toImage(0, "outputJava.png");

outputJava.png (54.7 KB)
Sample.zip (12.1 KB)


#3

@ahsaniqbalsidiqui
Your code works fine with your data. But it doesn’t on mine. See ods and png in attachment.
I think the difference is the intentional page break in my ods file. While yours just has many rows.

2PagesTest.zip (3.2 KB)
transformed_ods.png (1.8 KB)


#4

@OlgaK,

Thanks for the sample ODS file and image file.

It might be an issue with your version (older). Please try using our latest version/fix: Aspose.Cells for Java v19.6.3:
aspose-cells-19.6.3.zip (6.5 MB)

I have tested using your sample ODS file and it works fine…

Let us know your feedback.


#5

@Amjad_Sahi Yes, you’re right. v19.6.3 works correctly


#6

@OlgaK,

Good to know that the latest version/fix fixes your issue now. 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.