Skip to content

fix(docx): apply the default paragraph style to pStyle-less paragraphs#315

Merged
developer0hye merged 1 commit into
mainfrom
fix/docx-default-paragraph-style
Jul 18, 2026
Merged

fix(docx): apply the default paragraph style to pStyle-less paragraphs#315
developer0hye merged 1 commit into
mainfrom
fix/docx-default-paragraph-style

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

Summary

  • Paragraphs without w:pStyle fell back to the synthetic doc-default entry with empty paragraph properties, dropping the default style's spacing/line spacing and compressing the page body
  • Fold the w:default="1" paragraph style into the doc-default cascade entry so the full chain (document defaults → default style → explicit style → direct formatting) resolves
  • Upstream fork fix (developer0hye/docx-rs@e483367): the library dropped the style default attribute on read and never wrote it

Test plan

  • New test: a default style carrying spacing/line spacing applies to a pStyle-less paragraph (TDD, red first)
  • Full workspace suite passes; fmt --check clean; clippy -D warnings clean

Visual verification (public FancyFoot fixture, page 1)

Word GT Before After
gt before after

Paragraph gaps now track GT instead of collapsing upward.

After-image re-audit

Inter-paragraph gaps are still a few percent tighter than Word's — that residue is single-spacing line-height parity (the #251 docGrid work covers Korean-locale grids; Latin documents without a grid still use Typst's leading) and stays under the #214/#213 umbrella line-height thread rather than this cascade issue.

Related: #288

🤖 Generated with Claude Code

Paragraphs without an explicit w:pStyle fell back to the synthetic
document-default entry, whose paragraph properties are empty — the
default style's spacing and line spacing (normally Normal, marked
w:default="1") were dropped, compressing the page body. Fold the
default paragraph style into the doc-default cascade entry so the full
chain (document defaults → default style → explicit style → direct
formatting) resolves.

Upstream fork fix: developer0hye/docx-rs@e483367 reads and writes the
style default attribute, which the library previously dropped.

Related: #288

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit a782767 into main Jul 18, 2026
14 checks passed
@developer0hye
developer0hye deleted the fix/docx-default-paragraph-style branch July 18, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant