Skip to content

fix(docx): cell padding, white shading, and style-inherited list numbering#187

Open
nikith-18161 wants to merge 5 commits into
developer0hye:mainfrom
nikith-18161:fix/docx-table-and-list-rendering
Open

fix(docx): cell padding, white shading, and style-inherited list numbering#187
nikith-18161 wants to merge 5 commits into
developer0hye:mainfrom
nikith-18161:fix/docx-table-and-list-rendering

Conversation

@nikith-18161

Copy link
Copy Markdown

Summary

Three DOCX parser bugs fixed — cell padding early-exit, white cell background silently dropped, and Word built-in list styles (List Bullet / List Number) not rendering.

Changes

docx_tables.rs — Cell padding early-exit removed

extract_cell_padding() had a ? on a discarded extract_insets_from_margins_json() result that caused early return whenever any margin side was absent. Cells with partial margin specs (e.g. top+bottom only) lost all padding including table-level defaults.

docx_tables.rs — White cell background no longer skipped

extract_cell_shading() was skipping "FFFFFF" as if it were transparent. Cells explicitly set to white (to override a dark table background) now render correctly. Only "auto" is skipped.

docx_lists.rs + docx.rs — Style-inherited list numbering

extract_num_info() only checked the paragraph's inline <w:numPr>. Word built-in list styles (List Bullet, List Number) store their numbering on the style definition, not the paragraph. Added fallback to look up the style's numPr when the paragraph has none.

Testing

  • cargo test -p office2pdf --test docx_fixtures — 143 passed, 0 failed

Signed-off-by: nikith-18161 <nikith.molaka@progentys.com>
…sheet

Signed-off-by: nikith-18161 <nikith.molaka@progentys.com>
Signed-off-by: nikith-18161 <nikith.molaka@progentys.com>
Signed-off-by: nikith-18161 <nikith.molaka@progentys.com>
…ering

Three DOCX parser bugs fixed:

1. extract_cell_padding: a dangling ? on extract_insets_from_margins_json
   caused early return when any margin side was absent, silently dropping
   all padding including table-level inherited defaults.

2. extract_cell_shading: FFFFFF was skipped as if it were transparent.
   Cells explicitly set to white to override a dark table background
   were silently dropped. Only 'auto' should be skipped.

3. extract_num_info: Word built-in list styles (List Bullet, List Number)
   store numPr on the style definition, not the paragraph. The parser
   only checked paragraph-level numPr. Added fallback to style-level
   numbering so these lists render correctly.

Signed-off-by: nikith-18161 <nikith.molaka@progentys.com>
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