determine the page breaks in open xml document for .docx file RRS feed

  • Question

  • how can we determine page breaks in a documents. some ways are by locating the <w:br> tag with corresponding type or by locating <w:lastPageRenderedBreak>. still the document may miss out some page breaks. this happens when the text doesnot overflow to next page, but the user may force for continuously pressing "enter". this means i can generate a document with none of the above tags but still the document spans multiple pages. hope i made myself clear
    Tuesday, July 27, 2010 1:16 PM


  • Hi,

    Basically there are 3 types of breaks:

    - page breaks
     - section breaks
     - lastRenderedPageBreak

    Let's start with the page break. This can be identified as w:type. It breaks into a new page. Look this for more information:

    Then the sections. You can create a section using the <sectPr> node. Read this:

    Then the lastRenderedPageBreak. This is used for assistive technologies such as a narrator. Most breaks into a new page are not hardcoded using the <br> tag. Instead it is because of natural pagination in the office app. The page is just full. The office app can insert the <lastRenderedPageBreak> in a run which indicates that it's the last text on the page. Eg. the narrator can say 'there's a next page'. Read this for more information :

    If a user continuously press "enter", there is no way to know there are multiple pages using Open XML.

    Hope this helps!


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Ankush Microsoft Online Community Support
    • Proposed as answer by Ankush_Bhatia Wednesday, July 28, 2010 8:11 PM
    • Marked as answer by Ankush_Bhatia Friday, August 13, 2010 9:07 AM
    Tuesday, July 27, 2010 2:47 PM