I’m trying to render the test file using Aspose cells v19.8 for Java.
I’m using worksheet.getPageSetup().setPrintArea() to define the cell range.
In the exported image, please observe the last page (page #43), there seems be an image on top which there is a small text which got rendered. However, this text belongs to the page number 33. So it looks like this piece of text have been duplicated in page #33 and page #43.
This issue doesn’t exist in MS-Excel’s print preview.
FYI: I don’t want to use onepagepersheet.
Can you please try recreating the issue and provide a probable solution?
Below is the sample code I’m using
Workbook wb = new Workbook("C:/Ash/test.xlsx");
Worksheet ws = wb.getWorksheets().get(0);
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setImageType(ImageType.PNG);
ws.getPageSetup().setPaperSize(PaperSizeType.PAPER_A_4);
ws.getPageSetup().setPrintGridlines(true);
CellArea[] pageBreaks = ws.getPrintingPageBreaks(options);
for (int p=0; p<pageBreaks.length; p++)
{
CellArea pageArea = pageBreaks[p];
ws.getPageSetup().setPrintArea(CellsHelper.cellIndexToName(pageArea.StartRow, pageArea.StartColumn)+":"+CellsHelper.cellIndexToName(pageArea.EndRow, pageArea.EndColumn));
SheetRender sr = new SheetRender(ws, options);
sr.toImage(0, "C:/Ash/"+p+".png");
}
AsposeCellsIssue.zip (174.8 KB)