Skip to content

XLSX: worksheet drawing anchors use undersized row and column metrics #460

Description

@developer0hye

Summary

Worksheet xdr:twoCellAnchor geometry is rendered smaller than Microsoft Excel even after print scaling is removed from the comparison. The error accumulates across columns, shifting later drawings left.

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

Reproduction

Convert tests/fixtures/xlsx/theme_color_drawing.xlsx from PR #434 after its print layout is updated to A4 landscape at 100% zoom, then render the Excel GT and office2pdf PDFs with pdftoppm -r 150.

The sheet uses explicit width 6.7109375 for columns A:M, default row height 18pt, and three two-cell anchors spanning three columns and six rows.

Expected

Drawing bounds match the worksheet row/column geometry used by Excel.

Actual

Pixel-exact fill bounds at 150 DPI:

Shape Excel GT bounds office2pdf bounds
accent1 294x225+202+188 283x213+199+246
accent1 lighter 60 294x225+594+188 283x213+577+486
accent6 shade 75 294x225+985+188 283x213+954+726

The vertical stacking is tracked separately. This issue is specifically the per-shape size and cumulative horizontal-coordinate error:

  • width is 11 px too small;
  • height is 12 px too small;
  • the third shape starts 31 px too far left.

Root-cause evidence

anchored_image, which also sizes SheetTextBox, resolves DrawingML anchors through the table print metrics (column_width_to_pt and native_excel_pdf_row_height). The resulting drawing bounds do not match Excel's two-cell anchor geometry. This is an implementation-based inference to verify in the fix.

Visual checklist

Related: #235, #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