Skip to content

fix(docx): preserve WPG grouped content#205

Merged
developer0hye merged 1 commit into
mainfrom
fix/docx-wpg-content
Jul 13, 2026
Merged

fix(docx): preserve WPG grouped content#205
developer0hye merged 1 commit into
mainfrom
fix/docx-wpg-content

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

What changed

Preserve DOCX WordprocessingGroup (wpg) child shapes, text boxes, tables, and inline images that were previously dropped or partially parsed.

Why

docx-rs exposes only one child from a WPG group. The converter therefore lost sibling shapes and their text-box content. It also discarded group transforms, bodyPr text layout, and theme-backed colors.

Key changes

  • scan WPG groups from word/document.xml in document order
  • flatten nested group transforms into child positions and sizes
  • preserve supported shape geometry, fills, strokes, rich text-box blocks, tables, and inline images
  • retain text-box padding, vertical alignment, theme text colors, and geometry-aware text bounds
  • add strict real-world fixture assertions for grouped shape count, geometry, text, table cells, and layout metadata

Verification

  • cargo fmt --all -- --check
  • cargo test -p office2pdf (1083 passed)
  • cargo clippy -p office2pdf --all-targets -- -D warnings
  • Microsoft Word GT compared visually against matched Before and After renders at 120 DPI

Visual comparison

Microsoft Word GT Before After
Microsoft Word GT Before After

Related: #200
Related: #195

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit c1706db into main Jul 13, 2026
14 checks passed
@developer0hye
developer0hye deleted the fix/docx-wpg-content branch July 14, 2026 10:08
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