feat(ooxml): write the seven text properties onto a run of a docx or pptx - #896
Merged
Conversation
This was referenced Sep 13, 2026
andiwand
force-pushed
the
feat/set-text-style-odf
branch
from
September 13, 2026 16:33
8841122 to
91c0702
Compare
…pptx A `w:t` and an `a:t` share their `w:r` / `a:r` with their siblings, so `text_set_style` cuts the run around the text with `TreeEditor::isolate`, each part keeping its properties, and writes into the part that holds it. `CT_RPr` is a sequence Word enforces, so each docx property lands at its rank and replaces an existing one whole. A highlight is `w:highlight` for one of Word's sixteen names and a `w:shd` shading otherwise; the reader now takes `w:shd` where no highlight names a colour, which moves the reference pages of four corpus files. In pptx the toggles and the size are `a:rPr` attributes, the colour an `a:solidFill` and the highlight an `a:highlight`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137vd79NGaB8nfLsdPoghM4
andiwand
force-pushed
the
feat/set-text-style-ooxml
branch
from
September 13, 2026 16:42
1454edb to
dfafb19
Compare
Four docx pages gain the run shading the reader now takes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137vd79NGaB8nfLsdPoghM4
andiwand
force-pushed
the
feat/set-text-style-ooxml
branch
from
September 13, 2026 16:48
5f72729 to
fc0a876
Compare
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.
🤖 Generated with Claude Code
Step 3 of the inline formatting plan (
docs/design/document-editing.md, decisions 11, 13 and 14). Rebased onto main after #895 merged.The cut. A
w:tand ana:tshare theirw:r/a:rwith their siblings, sotext_set_stylecuts the run around the text withTreeEditor::isolate, each part keeping itsw:rPr/a:rPr, and writes the delta into the part that holds the text.docx.
CT_RPris a sequence Word enforces, so each property lands at its rank (run_property_order) and replaces an existing one whole, since a stalew:themeColorwould win over a neww:val.w:bCs,w:iCsandw:szCsfollow their siblings. A highlight isw:highlightfor one of Word's sixteen names and aw:shd w:val="clear" w:fillshading otherwise; only one of the two stays. A test pins the savedw:rPrbyte for byte between thew:rFontsand thew:langthe fixture had.The reader learns
w:shdon a run where no highlight names a colour, so a saved shading renders on reopen. Four corpus files carry one, and their reference pages are regenerated and pinned here:sample1now shows its "inverse video" run white on black where it was white on white;15KB,23KBandphysicscarry white fills on runs, which Word paints too, and move one anti-aliased pixel column at most.pptx. The toggles and the size are
a:rPrattributes, the colour ana:solidFilland the highlight ana:highlight, each at its place in theCT_TextCharacterPropertiessequence. A run without ana:rPrgets one ahead of itsa:t; a highlight taken away removes the element, since there is nonone.Shared.
ooxml_utilgainsinsert_in_sequence,hex_color,highlight_nameandpoints, over the one sixteen-name tableread_color_attributealso reads.Verified. 11 new
DocumentEdittests over inline docx and pptx packages and one reader test for the shading; 443 tests of the document, odf, ooxml and html suites pass; the touched sources are clean under Homebrew clang-Wall -Wextra -Werror. Headless LibreOffice reopens an editedstyle-various-1.docxand.pptxand reads every property back, the#123456shading included.