Skip to content

fix(docx): hold a value set from its start by a left tab stop - #788

Merged
DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-line-pair-left-tab
Sep 30, 2026
Merged

DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-line-pair-left-tab

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Why

When a layer holds two texts on one line (a label and its value, or a title and its dates), the export writes them as a single Word line split by a tab stop. That stop was always a right tab at the right-hand text's end.

A value aligned left, in a layer placed from the left, starts at its column whatever its length. After a right tab it started wherever the editor's slightly narrower setting of it ended. In Word, LumaStudioInvoice's IBAN stood 2.6pt right of the bank details above it, and ConsultingInvoice's detail values stood up to 2.4pt off.

What changed

  • DocxLinePair.Pair gains fromItsStart. It is set when all three hold:
    • the right-hand paragraph is aligned left;
    • its layer is placed from the left (TOP_LEFT, CENTER_LEFT or BOTTOM_LEFT);
    • the overlay leaves at least MIN_GAP (4pt) past the text's end. When the start is held, the end runs free. Without the room, an editor setting the text wider would break its last word onto a line of its own, hidden under the exact line height.
  • Tab position. When fromItsStart is set, tabStop is where the text starts, not where it ends. Any other text keeps the right tab at its end, as before; a date at the right of a band is one such text.
  • writeLinePair writes a left tab stop for such a pair and a right one otherwise.
  • Docs. The class Javadoc, MIN_GAP, writeLinePair's doc and docs/recipes/docx-export.md now describe both stops.

Verification

  • Full reactor gate: ./mvnw -B -ntp clean verify -pl :graph-compose-core,:graph-compose-render-pdf,:graph-compose-render-docx,:graph-compose-render-pptx,:graph-compose-templates,:graph-compose-testing,:graph-compose-qa,:graph-compose-coverage -am gives BUILD SUCCESS (1791 + 127 tests). After install, examples are 93 green and the knowledge checks are green.
  • DocxLinePairTest.aValueSetFromItsStartIsHeldThereByALeftTab: an IBAN row gets a left tab where the value starts on the page. It fails when the right tab is kept.
  • aValueSetFromItsEndOrRightUpToTheEdgeKeepsItsRightTab: each of two values keeps the right tab, and each half fails with its guard switched off.
    • One is placed from the right, with 30pt to spare past its end.
    • The other is placed from the left and runs to a point short of the row's end.
  • aTitleAtTheLeftAndDatesAtTheRightAreOneLineSplitByARightTab still asserts the right tab for a title and its dates.
  • Template corpus (62 documents), converted to PDF by Word.
    • Documents that change: LumaStudioInvoice, ConsultingInvoice (each with its long variant) and NavySidebar. Their vertical drift is unchanged.
    • LumaStudioInvoice: every bank detail value, the IBAN included, starts at 444.2pt, against 444.1 on the page. The IBAN was at 446.7.
    • ConsultingInvoice: lines more than 1pt off across fall from 3 to 0 (4 to 0 in the long variant).
    • NavySidebar: unchanged across.

Lane: shared-engine (render-docx). No public API change.

@DemchaAV
DemchaAV merged commit e73e181 into 2.5-dev Sep 30, 2026
12 checks passed
@DemchaAV
DemchaAV deleted the fix/docx-line-pair-left-tab branch September 30, 2026 10:02
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