Skip to content

DOCX: w:wordWrap is not parsed, so a paragraph asking for character-level Hangul breaking still breaks at word level #730

Description

@developer0hye

Summary

w:wordWrap is Word's switch between Hangul word-level and character-level line breaking,
and office2pdf does not parse it. w:val="1" keeps Hangul eojeol whole; w:val="0" allows
breaking at any syllable. #626 implemented the word-level rule for every non-justified DOCX
paragraph, which is right for Word-authored documents but cannot honour a document that
explicitly asks for character-level breaking.

Blocked on an upstream change: the pinned docx-rs fork has no word_wrap field anywhere in
docx-core, so the value cannot reach ParagraphStyle until that lands.

Measured — native Microsoft Word for Mac one-factor probes

All variants of the same Korean text in the same document (host: 02_contract_ko.docx),
line-end x positions from the exported PDFs:

probe paragraph properties Word's breaking
PLAIN no pStyle, no wordWrap mid-eojeol (503.62 / 510.41 / 510.41)
PLAINWW1 <w:wordWrap w:val="1"/> eojeol only (490.54 / 496.21 / 482.02)
PLAINWW0 <w:wordWrap w:val="0"/> mid-eojeol
LIST pStyle=ListParagraph eojeol only
LISTWW0 pStyle=ListParagraph + w:val="0" mid-eojeol — the property overrides the style

So w:wordWrap is the exact discriminator, and it overrides the style chain.

Why the golden mocks disagree with Word's usual default

02_contract_ko and 10_research_report_ko define no Normal style at all
(word/styles.xml is byte-identical between them, 4433 bytes, and w:docDefaults/w:pPrDefault
is empty). Their unstyled paragraphs therefore fall through to the Word application's own
built-in default paragraph style, which on a Korean install carries wordWrap=0. Adding an
empty <w:style w:default="1" w:styleId="Normal"> to styles.xml flips the same paragraph to
eojeol-only breaking — probe E, verified.

Observable today: 10_research_report_ko page 2's italic note paragraph is the corpus's only
non-justified mid-eojeol break in any Korean GT, and #626 keeps 표시되어야 whole where that GT
splits it (표|시되어야). That page goes 37/44 → 35/44 matched lines; every other line is
unchanged. It is a fixture artifact of the missing Normal style rather than behaviour a
Word-authored document exhibits.

Expected

w:wordWrap is parsed into ParagraphStyle and gates paragraph_eojeol_wrap, so a paragraph
declaring w:val="0" breaks at syllables even when it is not justified.

Actual

The property is dropped at parse time, so every non-justified Korean paragraph takes the
word-level rule regardless of what the document asked for.

Related: #626

Found in: the #626 fix-PR remediation, native Word 16.x one-factor probes (2026-07-31). Probe
documents and exports archived under /Volumes/T7/scratch/626/fix5/word_probes/.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions