fix(docx): hold a value set from its start by a left tab stop - #788
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, andConsultingInvoice's detail values stood up to 2.4pt off.What changed
DocxLinePair.PairgainsfromItsStart. It is set when all three hold:TOP_LEFT,CENTER_LEFTorBOTTOM_LEFT);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.fromItsStartis set,tabStopis 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.writeLinePairwrites a left tab stop for such a pair and a right one otherwise.MIN_GAP,writeLinePair's doc anddocs/recipes/docx-export.mdnow describe both stops.Verification
./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 -amgives 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.aTitleAtTheLeftAndDatesAtTheRightAreOneLineSplitByARightTabstill asserts the right tab for a title and its dates.LumaStudioInvoice,ConsultingInvoice(each with its long variant) andNavySidebar. 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.