Repository navigation
fix(docx): name the blank page Word adds before a section - #920
Merged
Merged
Conversation
Every section of a multi-section document numbers its pages from 1, and once the document states different even and odd pages, as it does for a page zone on some of them, Word starts every such section on an odd page. It adds a blank page before a section whose section before it runs to an odd number of pages, and the report said nothing. Measured in Word and LibreOffice on Windows, sections of one, one and one page came out five pages in Word and three in LibreOffice; two, one and one five in Word; one, three and two eight. LibreOffice adds none. With the numbers not restarted, or restarted at 2, or with even and odd pages not stated, Word adds none either, but each of those changes what the page numbers read or where the zones stand. The report now names each section Word adds a page before (page zone), from the page count the layout gives the section before it, and where that section has no layout, says where it would. The DOCX is written as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The DOCX export writes every section of a multi-section document with its pages numbered from 1
(
w:pgNumType w:start="1"), as the page numbers them. It states different even and odd pages forthe whole document (
w:evenAndOddHeaders) once any section has a page zone on even or odd pagesonly. With both, Word starts every section on an odd page, so it adds a blank page before a section
whose section before it runs to an odd number of pages. The report said nothing.
Measured in Word 16 and LibreOffice on Windows, with a zone on even pages in one section:
Word files a section's even and odd pages by the section's own numbers: the even-page footer
stood on each section's second page, where the page draws it, in both editors.
Edited by hand in the 1, 3 document, Word adds no page in three variants, but each one changes what it shows:
So the page cannot be avoided without changing what the page numbers read or where the zones stand.
What changed
DocxSemanticBackend.reportTheBlankPageBefore, called for each section after the firstwhere the document states different even and odd pages:
APPROXIMATEDnote, subjectpage zone, pathsection N: "Word adds a blank pagebefore this section: the section before it runs to one page, and Word starts every section
on an odd page where the document states different even and odd pages…";
odd number of pages";
Verification
DocxBlankPageBeforeSectionTest(new, 5 tests):./mvnw -B -ntp clean verify: BUILD SUCCESS (core 821, render-docx 1780, examples 93, qa 1820); the knowledge pack's--checkpasses.Lane: render-docx (semantic backend). A report note only; no output change.