Free Support Forum - aspose.com

Recognizing page break before adding a section to an document

Hello,

is it possible to recognize, whether adding a section to an document leads to an page break?
I need it to avoid chopped sections by a page break.

Regards, Thilo

You can use Section.PageSetup.SectionStart property to control page break for the added section.

Best regards,

I know how to control the page break, but i want to know if adding a new section to my document leads to an page break.

If section's PageSetup.SectionStart property not equals SectionStart.Continuous then page break will be inserted for this section. Otherwise it depends on other properties of the section, whether it has different margins, headers/footers etc. If section formatting is identical to the previous section and section start is set to Continuous then no page break will be inserted.

Actual insertion of the page break is made by MS Word during rendering of the document based on the factors listed above. There is no direct property in Aspose.Words API that will inform you whether the page break will actually occur as this information is not stored directly in the document.

Best regards,

Okay. Then another question. Is it possible to tell the MS Word rendering process not to chop the section but add the inevitable page break BEFORE the section (SectionStart = NewPage)? Just like an indestructible section would act?

regards

Sorry, I don't understand the question. Please provide a more detailed description of what you are trying to achieve.

Best regards,

Please check the following ParagraphFormat properties - KeepTogether and KeepWithNext.

Maybe that is what you are looking for.

Best regards,