Free Support Forum - aspose.com

Save as PDF repeats Freeze Pane cells on multiple pages, but getPrintingPageBreaks does not report this

On a workbook where a printing area was defined, and also has a couple columns marked as Freeze Pane, the cells on this frozen region are repeated on each page when saving as PDF.

That is consisting with behavior on MS Excel.

But worksheet.getPrintingPageBreaks() does not include the frozen cells as part of each page to be printed.
Is there an alternative to retrieve the effective ranges of cells to be printed on each page, when saving as PDF?

@malbanesiascii,

See the sample code for your reference and write your own code accordingly. You also need to add/include those frozen cells when evaluating your cells range/area for each page, there is no other way around.
e.g
Sample code:

Workbook workbook = new Workbook("f:\\files\\book1.xlsx");
		Worksheet worksheet = workbook.getWorksheets().get(0);
		ImageOrPrintOptions printoption = new ImageOrPrintOptions();
		printoption.setPrintingPage(PrintingPageType.DEFAULT);
		SheetRender sr = new SheetRender(worksheet, printoption);
		int pageCount = sr.getPageCount();
		System.out.println(pageCount);
		CellArea [] area = worksheet.getPrintingPageBreaks(printoption);
		System.out.println(area.length);
		for(int i =0 ;i<area.length;i++)
		{
		      //Get each page range/area.
		      int strow = area[i].StartRow;
		      int stcol = area[i].StartColumn;

		      int erow = area[i].EndRow;
		      int ecols = area[i].EndColumn;
 System.out.println("Page " + (i + 1).toString() + " starts at: " + CellsHelper.cellIndexToName(strow, stcol));
                  //Your code goes here.
                  //..........

		} 
............

Hope, this helps a bit.