Different Number of Print Pages returned by SheetRender and worksheet.GetPrintingPageBreaks

I am using next procedure to get page References:


foreach (Worksheet worksheet in mWorkbook.Worksheets)
{
SheetRender sheetRender = new SheetRender(worksheet, mDefaultImageOptions);
for (int pageIndex = 0; pageIndex < sheetRender.PageCount; pageIndex++)
{
PageReference reference = new PageReference { sheetRender = sheetRender, worksheetPageIndex = pageIndex };
mPageIndex.Add(reference);
}
}

and next one to map cell areas to the appropriate page

int page = 0;
foreach(Worksheet worksheet in mWorkbook.Worksheets)
{
CellArea[] areas = worksheet.GetPrintingPageBreaks(mDefaultImageOptions);
foreach(CellArea area in areas)
{
createPageText(area, page, worksheet);
page++;
}
}

private static ImageOrPrintOptions mDefaultImageOptions = new ImageOrPrintOptions() { IsCellAutoFit = true };

The worksheet “Additional Info” gives different number of pages - SheetRender returns 1
worksheet.GetPrintingPageBreaks(mDefaultImageOptions) returns 2 areas






Hi,



Please change the line of code:
i.e.,
private static ImageOrPrintOptions mDefaultImageOptions = new ImageOrPrintOptions() { IsCellAutoFit = true };

with:

private static ImageOrPrintOptions mDefaultImageOptions = new ImageOrPrintOptions() { IsCellAutoFit = true, PrintingPage = PrintingPageType.IgnoreBlank };

it works fine as I tested.

Thank you.

Thanks a lot.

This is working

Hi,


Good to know that if figures out 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.

Thank you.