Repository navigation
feat: section columns and column break - #12
Open
serpentblade wants to merge 2 commits into
Open
serpentblade wants to merge 2 commits into
serpentblade wants to merge 2 commits into
Conversation
Section::$columns (Columns: count, space, separator, and per-column widths and per-gap spaces for unequal columns) is written as <w:cols> after <w:pgMar> in the section's <w:sectPr> and read back by SectionReader. DocumentBuilder::columns() sets the current section's columns, and newSection() takes them too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ColumnBreak is written as <w:p><w:r><w:br w:type="column"/></w:r></w:p> and read back by BodyReader, which splits a paragraph around it as it does for a page break. The builder gets columnBreak(). The PHPStan baseline gains the same inline/block mismatch entries PageBreak already has in BodyReader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Adds text columns to sections and a column break element, both written to and read back from OOXML.
Commits
feat: section columnsStyle\Columnsvalue:count,spaceTwips(default 720),separator, and for unequal columnswidthsTwips(one per column) andspacesTwips(one per gap). The constructor validates counts and signs.Section::$columns(?Columns, null is a single column), written byWord2007Writeras<w:cols>after<w:pgMar>and before<w:titlePg>(ECMA-376 order). Equal:<w:cols w:num w:space [w:sep="1"]/>. Unequal:<w:cols w:num w:equalWidth="0" [w:sep="1"]>with one<w:col w:w w:space/>per column, the last withoutw:space.SectionReader::columns()reads it back per section.DocumentBuilder::columns()sets the current section's columns;newSection()takes acolumnsargument (a new section is single-column unless given them).<w:cols w:space="720"/>(what Word writes in ordinary documents) reads as no columns (null), not a one-columnColumns.w:spaceis always written, also for unequal columns.feat: column breakElement\ColumnBreakblock, written as<w:p><w:r><w:br w:type="column"/></w:r></w:p>.BodyReaderreads<w:br w:type="column"/>and splits the paragraph around it, as it does for a page break (also dropped from list items, like a page break).columnBreak().PageBreakentries inBodyReader(the inline/block mismatch).The HTML serializer has no column concept and renders
ColumnBreakas nothing.Tests
New
tests/Writer/SectionColumnsTest.php(writer output for equal, unequal and separator cases, element order, per-section columns, round trips throughDocxReader, argument validation, column break round trip), plus cases inSectionsBuilderTest,BodyXmlBuilderTestandBodyReaderTest. Full suite: 512 tests passing.composer stan: no errors. The conformance reference document validates against the ECMA-376 XSDs (xsd-check.sh, all six parts) and passes the LibreOffice and python-docx consumer smoke.🤖 Generated with Claude Code