Repository navigation
feat: sections, headers of every kind and floating pictures both ways - #1
Merged
Merged
Conversation
A php-docx section per PhpWord section with its page setup and start; default, first-page and even-page headers and footers; floating pictures through PhpWord's image style. Pictures from php-docx now reach PhpWord as bytes: a data: URL was rejected as an invalid image. Requires php-docx ^1.18. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
php-docx 1.18.0 brought several sections per document and floating pictures (dskripchenko/php-docx#10). The bridge read only
$document->section, so it dropped every section after the first infromDocument()and merged PhpWord's sections into one intoDocument().Both ways now
breakType: next page, continuous, even or odd page).evenAndOddHeaders). Before, only default ones were carried, and PhpWord's headers of every kind were merged into one list.Image::$position↔ PhpWord's image style (positioning,posHorizontal/posVerticaland their…Rel,marginLeft/marginTopin points,wrappingStyle). Origins php-docx has no case for read as the nearest one.Fixed: pictures from php-docx were handed to PhpWord as a
data:URL, which PhpWord 1.x rejects (InvalidImageException), sofromDocument()failed on any document with a picture. They go as bytes now.Changed:
fromDocument()sets each section's page from the document's page setup instead of PhpWord's default page.Requires
dskripchenko/php-docx^1.18. README (en/ru/de/zh), the class docblock and CHANGELOG updated.Tests (
tests/SectionsAndFloatingTest.php): three sections to PhpWord (orientation, custom size, break type, header kinds, inherited headers); the same through PhpWord's own Word2007 writer and php-docx's reader; PhpWord sections to the AST (body, header kinds, page setup, start); a floating picture both ways; an inline picture stays inline. PHPUnit: 10 tests OK; PHPStan level 8: no errors.🤖 Generated with Claude Code