From b06fca377a37e06186dc17a90feaa64a24e56f78 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Thu, 12 Sep 2024 18:10:14 +0200 Subject: [PATCH 1/2] fix: Support Header element within Title elements We encountered issues with a Word document where this is a valid combination. --- src/PhpWord/Element/AbstractContainer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index f9b2822a12..99987c70c6 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -253,7 +253,7 @@ private function checkValidity($method) 'Footnote' => ['Section', 'TextRun', 'Cell', 'ListItemRun'], 'Endnote' => ['Section', 'TextRun', 'Cell'], 'PreserveText' => ['Section', 'Header', 'Footer', 'Cell'], - 'Title' => ['Section', 'Cell'], + 'Title' => ['Section', 'Cell', 'Header'], 'TOC' => ['Section'], 'PageBreak' => ['Section'], 'Chart' => ['Section', 'Cell'], From 4c7aaeb373c04932980ab4070aa35374631abf46 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Thu, 12 Sep 2024 18:27:44 +0200 Subject: [PATCH 2/2] docs(changelog): Add note about supporting Header elements within Title --- docs/changes/1.x/1.4.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changes/1.x/1.4.0.md b/docs/changes/1.x/1.4.0.md index 13d9bc0937..7488d4b86d 100644 --- a/docs/changes/1.x/1.4.0.md +++ b/docs/changes/1.x/1.4.0.md @@ -11,6 +11,7 @@ - Writer ODText: Support for images inside a textRun by [@Progi1984](https://github.com/Progi1984) fixing [#2240](https://github.com/PHPOffice/PHPWord/issues/2240) in [#2668](https://github.com/PHPOffice/PHPWord/pull/2668) - Allow vAlign and vMerge on Style\Cell to be set to null by [@SpraxDev](https://github.com/SpraxDev) fixing [#2673](https://github.com/PHPOffice/PHPWord/issues/2673) in [#2676](https://github.com/PHPOffice/PHPWord/pull/2676) +- Support Header elements within Title elements by [@SpraxDev](https://github.com/SpraxDev) in [#2674](https://github.com/PHPOffice/PHPWord/pull/2674) ### Miscellaneous