Skip to content

Word fixes from the reporters' files: header page counts, default font, page breaks, frames - #1534

Merged
KnifeLemon merged 5 commits into
builtin-enginesfrom
p4/b16-reporter-fixes
Nov 14, 2026
Merged

KnifeLemon merged 5 commits into
builtin-enginesfrom
p4/b16-reporter-fixes

Conversation

@KnifeLemon

Copy link
Copy Markdown
Owner

Fixes found by running the reporters' own files of #1180, #1313, #1194, #1152, #993, #1315 and #979 through the built-in engines and comparing with Word's or PowerPoint's PDF where the reporter attached one, and with LibreOffice 26.2 otherwise. No reporter file is in the repository: every test builds its document in code.

#1152: header page numbers and table of contents

  • Wrong: a PAGE or NUMPAGES field in a table of a first-page header kept the number Word last saved ("Page 1 of 2" in a three-page document). That was a workaround for rhwp, which leaves such a number blank.
  • Change: the field is read as a page number that also keeps Word's text (HField.Stored). The renderer counts the pages; the HWPX writer still writes Word's text, so the rhwp route is unchanged.
  • Wrong: table of contents entries came out blue and underlined. Word gives each entry's link the Hyperlink character style but draws the entries in the TOC styles' look (Word's own PDF and LibreOffice agree).
  • Change: inside a TOC field's result the Hyperlink character style is left out. Links elsewhere stay blue.

#1180: documents that name no font

  • Wrong: when a document's defaults and styles name no font, Word draws it in Times New Roman. The renderer used its own wider sans serif, so one worksheet ran to 9 pages instead of 7.
  • Change: such documents get Times New Roman for Latin and complex-script text. Documents that name a font or a theme font are unchanged. The four documents now come to 4, 5, 4 and 7 pages, the same as LibreOffice.

#1194: page breaks at the end of a paragraph

  • Wrong: the empty rest of a paragraph that ends with a page break became a paragraph at the top of the new page. Word keeps that paragraph mark on the old page. Every chapter therefore started an empty line plus the paragraph's space-after lower.
  • Change: the next paragraph or table now starts the new page. Numbered paragraphs and paragraphs that end a section keep their rest, as before.
  • Result: the report goes from 25 pages to 24 (Word: 22). The rest is tracked separately.

#1313: hidden shapes and frames

  • Wrong: a VML shape with visibility:hidden was drawn. The form's spare copy of its WordArt came out squeezed over the title.
  • Change: hidden VML shapes are skipped.
  • Wrong: a paragraph in a frame (w:framePr) placed on the page or within the margins stayed in the text. The verification code came out under the signature instead of at the bottom right.
  • Change: such paragraphs go into a borderless box of the frame's size at its place. The box floats at the paragraph before it and takes no room in the text. Frames that move with the text, and drop caps, are unchanged.

Checked, nothing to change here

Tests

  • New tests in ReportedCasesTests:
    • Issue1152_page_x_of_y_in_a_first_page_header_table_counts_every_page
    • Issue1152_table_of_contents_entries_are_not_drawn_as_blue_links
    • Issue1180_text_in_a_document_that_names_no_font_is_in_times_new_roman
    • Issue1194_a_page_break_at_the_end_of_a_paragraph_leaves_no_empty_line_on_the_next_page
    • Issue1313_a_frame_sits_where_its_page_position_puts_it
  • New test in WordWatermarkTests: A_hidden_wordart_shape_is_left_out.
  • Filtered Filee.Engines.Tests run: 405 passed, 23 skipped, 1 failed.
    • The failure was OcrTests.A_scanned_pdf_becomes_a_docx… (a missing temp path). It passes when run alone.
    • Filter: Docx, ReportedCases, FileeRenderer, DocReader, DocumentModel, PageComposer, DocumentFuzz, WordWatermark, Floating, DocumentHostile.
  • dotnet format Filee.slnx --verify-no-changes --severity warn is clean.

🤖 Generated with Claude Code

KnifeLemon and others added 5 commits November 15, 2026 02:34
… renderer (#1152)

A PAGE or NUMPAGES field in a table of a first-page header kept the number
Word last saved ("Page 1 of 2" in a three-page document), because rhwp
leaves such a number blank. The field is now read as a page number that
also holds Word's text: the renderer counts the pages, and the HWPX writer
still writes Word's text for rhwp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1180)

When a document's defaults and styles name no font at all, Word draws its
Latin and complex-script text in Times New Roman. The renderer fell back to
its own sans serif, which is wider: one of the worksheets ran two pages longer.
Documents that name a font or a theme font keep it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng page break (#1194)

A paragraph that ends right after its page break keeps its mark on the old
page in Word. The reader made that empty rest a paragraph of its own at the
top of the new page, so every chapter after such a break started a line and
the paragraph's space after lower, and long reports ran pages over. The next
paragraph or table now starts the page instead. A numbered paragraph or one
that ends a section keeps its rest as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es (#1313)

- A VML shape with visibility:hidden (a form's spare copy of its WordArt) was
  drawn, squeezed into its 50 pt box over the title.
- A paragraph in a frame (w:framePr) placed on the page or within the margins
  stayed in the text: the form's verification code came out under the
  signature in the middle of the page. Such paragraphs now go into a box of
  the frame's size at its place, floating at the paragraph before them, so they
  take no room in the text. Frames that move with the text and drop caps stay
  as they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s blue (#1152)

Word writes each entry of a table of contents as a link in the Hyperlink
character style, yet draws the entries in the TOC styles' look, as
LibreOffice does. The renderer drew every entry blue and underlined. In a
TOC field's result the Hyperlink character style is now left out; links
elsewhere keep it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KnifeLemon KnifeLemon added the built-in engines Filee: built-in engines (Project 4), on the builtin-engines branch, not released yet label Nov 14, 2026
@KnifeLemon
KnifeLemon merged commit 8054be6 into builtin-engines Nov 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

built-in engines Filee: built-in engines (Project 4), on the builtin-engines branch, not released yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant