GetPrintingPageBreaks returns 0 cell areas

Hi! In a workbook, I set print area to a long range that spans 2 pages horizontally. When I call GetPrintingPageBreaks, I get 0 cell areas as a result. Please, check the attached project!

Thank you.

Hi,

Thanks for using Aspose.Cells for .NET.

I have looked into your issue with your given code using the latest version:
Aspose.Cells
for .NET v7.3.1.3



I found that your workbook has actually two worksheets which are the following. One of which is VeryHidden.

1 - Cognos_Office_Connection_Cache (at position 0)
2 - Sheet1 (at position 1)

Since, your code is loading the worksheet at position 0, so you are getting wrong results.

So, the following code will work fine. I have attached the screenshot for your help/reference

C#


string filePath = @“F:\ExtractImagesFromWorkbook\ExtractImagesFromWorkbook\LongRange.xlsx”;


var workbook = new Workbook(filePath);

var worksheet = workbook.Worksheets[“Sheet1”];


var imgOpts = new ImageOrPrintOptions

{

PrintingPage = PrintingPageType.IgnoreBlank,

ImageFormat = ImageFormat.Jpeg

};


worksheet.PageSetup.PrintArea = “B2:I8”;

var areas = worksheet.GetPrintingPageBreaks(imgOpts);//areas count is 0, it should be 2



Screenshot:

Sorry for that, I didn’t know there is a very hidden worksheet on first position. Thank you for your quick response.

Hi,

Thanks for your posting.

It’s good to know that you understand the source of problem.

Let us know if you face any other issue, we will be glad to assist you further.