Skip to content

feat: add cell vertical alignment in tables#119

Merged
developer0hye merged 2 commits into
mainfrom
feat/cell-valign
Mar 6, 2026
Merged

feat: add cell vertical alignment in tables#119
developer0hye merged 2 commits into
mainfrom
feat/cell-valign

Conversation

@developer0hye

@developer0hye developer0hye commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • add CellVerticalAlign (Top/Center/Bottom) and vertical_align to the public TableCell IR
  • parse DOCX table cell vAlign and render Typst table.cell(align: ...) overrides
  • preserve exact DOCX row heights and emit Typst rows: (...) sizing so vertical alignment takes effect in fixed-height rows

Why

  • DOCX table cell vertical alignment was ignored
  • row-height preservation was needed for center/bottom alignment to have visible effect in common Word tables

Key changes

  • parse verticalAlign from DOCX cell properties
  • carry exact DOCX row heights (trHeight with hRule=exact) into TableRow.height
  • emit Typst table row sizing when any row has an explicit height
  • add parser and renderer coverage for vertical alignment and row-height behavior

Compatibility

  • TableCell is public through office2pdf::ir, so adding vertical_align is a public API change for downstream struct literals/destructuring

Test plan

  • cargo test -p office2pdf table --lib --offline
  • cargo test -p office2pdf row_height --lib --offline

Related: #111

Add CellVerticalAlign enum (Top/Center/Bottom) and vertical_align field
to TableCell IR. Parse vAlign from DOCX cell properties via serde_json.
Render as table.cell(align: top/horizon/bottom) in Typst output.

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit 7bc9e4d into main Mar 6, 2026
14 checks passed
@developer0hye
developer0hye deleted the feat/cell-valign branch March 6, 2026 15:12
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