PageBreaks issue

Hi,


I am using Aspose.Cells in our project. I have a sheet in which I have to insert conditonal pagebreaks.
I have two queries :

1. When I try to get HPageBreaks collection it returns 0. The aim is to get the HPageBreaks collection and then adjust the rowindex based on some condition

2.If I insert some PageBreak using HPageBreaks.Add. Excel also inserts automatic page breaks. How do I reset/avoid those pagebreaks. I have used HPageBreaks.clear method but the purpose was not solved.

Any help is appreciated

Thanks

Hi,

Well, MS Excel does not have any record in the excel file to save pagebreaks (page setup) settings. It will calculate them automatically when you open the file in MS Excel, so, these are called automatic pagebreaks. I think you can only use HPageBreaks class and VPageBreaks to add hard page breaks same as in MS Excel: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/managing-page-breaks.html

Anyways, we will get back to you soon to further explain your inquiries.

Thank you.

Hi,

For your queries.....

1) When I try to get HPageBreaks collection it returns 0. The aim is to get the HPageBreaks collection and then adjust the rowindex based on some condition

HPageBreaks only contains custom page break(s). We do not add any MS Excel's automatic page breaks into it.

2) If I insert some PageBreak using HPageBreaks.Add. Excel also inserts automatic page breaks. How do I reset/avoid those pagebreaks. I have used HPageBreaks.clear method but the purpose was not solved.

If you want to avoid those automatic page breaks, please make sure that the page between your custom page breaks is only fit to one page width and height. For example, if there are two Hpagebreak(10,50), the row height of the rows between 10 and 50 must be less than or equal to the page size of printing settings.

Thank you.