Conversation
Paragraph::set_style and the setParagraphStyle op write text_align. Any other field of ParagraphStyle refuses with UnsupportedOperation. The op takes `align` as left, center, right or justify. - odf points the paragraph at a fresh automatic style P<n> that carries fo:text-align. It is made as a cell style is, so one base and one delta make one style. create_cell_style and create_paragraph_style now share the code that copies or inherits the base style. - docx writes w:jc at its rank in the CT_PPr sequence. Justified is `both`. - pptx writes a:pPr/@algn, and refuses start and end, because ST_TextAlignType has no value for either. The docx reader did not read w:jc="both", which is how Word writes a justified paragraph. It now reads it, so twelve docx pages of the reference output change. In each page, the only change is the alignment. The design doc also describes how the editor aligns, which the next commit adds. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tigcf9he3w1aHfNPJoEGsd
odr.editing.format({align}) sends one setParagraphStyle for each paragraph
that the selection reaches, and a collapsed caret aligns its own
paragraph. A style can hold align and run keys together. The editor checks
the paragraphs first and aligns them last, so a refused mark leaves no
paragraph aligned. It writes text-align on the x-p, as the renderer does.
onSelectionChange reports `align` where the paragraphs agree. Two
alignments of one paragraph fold into one op. The formatJustify* input
types are chords, and under scope `paragraph` they refuse as every chord
does.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tigcf9he3w1aHfNPJoEGsd
… npm Python binds Paragraph.set_style as it is. Java and Objective-C get Paragraph.setStyle and -[ODRParagraph setStyle:error:]. A ParagraphStyle can now be built and its fields written, so a caller builds the delta. Any field but textAlign refuses before the call reaches C++. The npm package's setParagraphStyle(id, style) takes the object that the page's odr.editing.format takes, and replays it through the envelope, so the parser of the wire checks it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tigcf9he3w1aHfNPJoEGsd
andiwand
added a commit
to opendocument-app/OpenDocument.test.output
that referenced
this pull request
Sep 29, 2026
…raphs The engine now reads w:jc="both", so justified docx paragraphs render with text-align:justify. resources/document.js and resources/editing.js carry the paragraph alignment of the document editor. From opendocument-app/OpenDocument.core#942.
Twelve docx pages now show text-align:justify where the file states w:jc="both", and the embedded document.js and editing.js align paragraphs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tigcf9he3w1aHfNPJoEGsd
Paragraph::set_style returns early when text_align is not set, so the engines no longer check it and no longer write an empty pPr. The tests share one tree walk for nth_run and nth_paragraph. The changelog entry and some doc comments are shorter. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168TSFHrPyguyvsxTXLXqMD
This branch has not been deployed
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
Summary
A paragraph now takes a horizontal alignment in every format that already takes other formatting. Cells of ods and xlsx files already take
alignthroughsetCellStyle, so this PR adds the same to text documents, presentations and drawings.Paragraph::set_style(ParagraphStyle)writestext_align. Any other field refuses withUnsupportedOperation. The adapter hook isParagraphAdapter::paragraph_set_style.{"op": "setParagraphStyle", "id": 9, "style": {"align": "center"}}, wherealignisleft,center,rightorjustify.P<n>withfo:text-align. One base and one delta make one style.create_cell_styleandcreate_paragraph_styleshare the code that copies or inherits the base style.w:jcat its rank inCT_PPr. Justified isboth.a:pPr/@algn.startandendrefuse, becauseST_TextAlignTypehas no value for either.odr.editing.format({align})aligns every paragraph that the selection reaches, and it can hold run keys too.onSelectionChangereportsalign. TheformatJustify*input types are chords.Paragraph.set_style, JavaParagraph.setStyle, Objective-C-[ODRParagraph setStyle:error:], and npmDocument.setParagraphStyle(id, style). In Java and Objective-C, aParagraphStylecan now be built and written.w:jc="both", which is how Word writes a justified paragraph. It now reads it.Reference output
This PR changes the reference output in two ways:
document.jschanges.text-align:justify. In nine of them this is the only change. In the threefile-sample_*.docxpages, the paragraph statesbothover a style that statesleft, sotext-align:leftbecomestext-align:justify.The output repos carry these files at
6976b72(public) and4e6b97d(private), andtest/data.cmakepins both. Nothing else in the full render changed.Test plan
odr_test: 1608 unit tests pass, and 15 of them are new inDocumentEdit(odf, docx, pptx, refusals, save round trips).test/browser/text/tests.html, headless Chrome: 217 checks, 0 failed.odr_jni_junit): 67 passed.swift teston the macOS xcframework): the two new tests pass, 0 failures.build-wasm, node): 56 passed.-Wall -Wextra -Werror.