Skip to content

XLSX: same-row worksheet drawings stack vertically and spill onto a blank page #459

Description

@developer0hye

Summary

Worksheet drawings anchored to the same row are emitted as consecutive flow boxes instead of overlays at their worksheet coordinates. Three shapes that Excel renders side by side on row 3 therefore form a diagonal vertical stack in office2pdf. The reserved flow height also spills onto an extra blank PDF page.

Found while re-auditing the regression fixture in #434 at 150 DPI against a native Microsoft Excel export.

Reproduction

Use tests/fixtures/xlsx/theme_color_drawing.xlsx from PR #434 after its print layout is updated to A4 landscape at 100% zoom.

cargo build --release -p office2pdf-cli
target/release/office2pdf \
  tests/fixtures/xlsx/theme_color_drawing.xlsx \
  -o /tmp/theme-color.pdf

pdfinfo /tmp/theme-color.pdf
pdftoppm -r 150 -png /tmp/theme-color.pdf /tmp/output

The drawing contains three xdr:twoCellAnchor elements with the same row interval (3:9) and different column intervals (B:D, F:H, J:L).

Expected

  • All three shapes share the same top and bottom coordinates, as in Excel.
  • The workbook exports to one A4 landscape page.
  • Drawing overlays do not reserve flow height.

Actual

  • Excel GT top coordinates at 150 DPI: 188, 188, 188.
  • office2pdf top coordinates: 246, 486, 726.
  • Excel GT page count: 1.
  • office2pdf page count: 2; page 2 is blank.
  • The CLI metric reports Pages: 1, so the extra page is introduced during Typst layout rather than XLSX parsing.

Root-cause evidence

generate_table_with_anchors emits every same-row anchor sequentially. generate_sheet_anchor wraps each text box in #box(width: 100%, height: ...), which advances the flow before the next same-row drawing. It does not preserve a drawing-level vertical offset.

Visual checklist

  • Page count/order: one extra blank page.
  • Element presence/content: title and all three labels are present.
  • Position: second and third shapes are displaced downward by one reserved box height each.
  • Size/fill/text color/alignment: independently audited; fill colors from XLSX: worksheet-drawing scheme colors ignore the workbook theme #430 are correct.
  • Rotation/flip/stroke/clipping: no deviation for this fixture.

Related: #240, #430, #434

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions