Is this the right forum for this topic? - I posted in the Office Open XML File Format Implementation, but was told that this forum was a better fit.
Tested in MSWord 2010.
For all of the following cases a 2 page doc is created by hitting enter until the cursor is moved to the next page. The first body element on page 2 is a...
body element | lastRenderedPageBreak exists? |
---|---|
blank paragraph | no |
paragraph with space | yes |
paragraph with text | yes |
a blank in-line textbox | yes |
an in-line picture | yes |
a table with blank first column paragraph | no |
a table with first column paragraph having a space | yes |
The result is the same for starting columns with those elements too.
It seems that when the first paragraph is missing a run, no lastRenderedPageBreak exists. Is there a reason why it was implemented this way? Why not create an empty run with just the lastRenderedPageBreak element inside?
The goal is to be able to read the word/document.xml and be able to determine where the page breaks are. There are work arounds for determining page breaks with the lastRenderedPageBreak element not present:
- If the previous paragraph used an explicit page/col break.
- If the previous paragraph ended a section (except continuous sections)
I can detect missing lastRenderedPageBreaks that cannot be derived from the 2 work arounds by looking at the docProps/app.xml Pages value. If it says 3 pages it should contain 2 lastRenderedPageBreaks (assuming you are using single column pages). If it doesn't contain 2 lastRenderedPageBreaks it most likely matched one of the above scenarios, but I won't have any idea on where the lastRenderedPageBreak should have been placed...
I understand that if I were modifying the xml directly, the lastRenderedPageBreak would become unreliable...but I'm just reading what MSWord is producing. Are there any plans to make the lastRenderedPageBreak element more consistent? Why are blank paragraph such a pain to deal with? Is there any solution to finding page breaks solely looking at the word/document.xml?
Thanks!