No page break zone implementation question

I have created a report in excel that is then converted to a pdf on the server without user interaction.

There are certain areas of the report where we don’t want page breaks. I am able to use page scaling to get the report to render just one page wide. Therefore, only vertical page breaks are at issue.

Can I programmatically determine where excel is thinking about putting the page breaks. If so then I can determine if the page break occurs in a “page break free zone” and move it to the start of the zone.

If there is another way to get the same functionality please feel free to share it.

Hi,

Well, If you have the requirement to 1 Page Width and 1 Page Tall printing then you may also use pageSetup.FitToPagesTall = 1 as you are using pageSetup.FitToPagesWide = 1.

If your requirement is to generate multiple pages, then you have to remove the existing page breaks and add you own page breaks as per your requirement.

Please see the following link to Add / Remove the page breaks,

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/managing-page-breaks.html

Please do let us know if you need any further assistance, we will be happy to help you out.

Thank You & Best Regards,

Unfortuantly I do not have that requirement. My requirement is to limit to one page wide and that is all.

What I need to know is if it is possible for me to problematically determine where excel is going to perform page breaks without ever opening the file in excel. If this is possible then I can check to see if a page break is occurring in an area of my report that should not be split across pages and move it.

The report uses a wrapping text field so it is hard for me to just count rows.

Hi,

Thank you for considering Aspose.

If you want to limit to one page wide, please use the following codes,

pageSetup.FitToPagesWide = 1;
pageSetup.FitToPagesTall = 0

If you want to determine where excel is going to perform page breaks to avoid splitting report to two pages, I think you can simply set noncontiguous print areas to ignore this problem. See following codes to setting the print area:

workbook.Worksheets[0].PageSetup.PrintArea = “A1:C10,D10:G20”;

Aspose.Cells will print the file to the two pages with this print area.

Hope this will help you solve your issue.

Thank You & Best Regards,