diff --git a/CHANGELOG.md b/CHANGELOG.md index f567e658c6..c06cdf5893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). ### Fixed - More context options may be needed for http(s) image. [Php issue 17121](https://github.com/php/php-src/issues/17121) [PR #4276](https://github.com/PHPOffice/PhpSpreadsheet/pull/4276) +- Several fixed to ODS Writer. [Issue #4261](https://github.com/PHPOffice/PhpSpreadsheet/issues/4261) [PR #4263](https://github.com/PHPOffice/PhpSpreadsheet/pull/4263) [PR #4264](https://github.com/PHPOffice/PhpSpreadsheet/pull/4264) [PR #4266](https://github.com/PHPOffice/PhpSpreadsheet/pull/4266) ## 2024-12-08 - 3.6.0 diff --git a/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php b/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php index 1cc68faba1..92fc497e77 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php +++ b/src/PhpSpreadsheet/Writer/Ods/Cell/Style.php @@ -299,6 +299,7 @@ public function writeTableStyle(Worksheet $worksheet, int $sheetId): void 'style:name', sprintf('%s%d', self::TABLE_STYLE_PREFIX, $sheetId) ); + $this->writer->writeAttribute('style:master-page-name', 'Default'); $this->writer->startElement('style:table-properties'); diff --git a/src/PhpSpreadsheet/Writer/Ods/Styles.php b/src/PhpSpreadsheet/Writer/Ods/Styles.php index 448b1eff13..6bfdfb1b33 100644 --- a/src/PhpSpreadsheet/Writer/Ods/Styles.php +++ b/src/PhpSpreadsheet/Writer/Ods/Styles.php @@ -56,8 +56,17 @@ public function write(): string $objWriter->writeElement('office:font-face-decls'); $objWriter->writeElement('office:styles'); - $objWriter->writeElement('office:automatic-styles'); - $objWriter->writeElement('office:master-styles'); + $objWriter->startElement('office:automatic-styles'); + $objWriter->startElement('style:page-layout'); + $objWriter->writeAttribute('style:name', 'Mpm1'); + $objWriter->endElement(); // style:page-layout + $objWriter->endElement(); // office:automatic-styles + $objWriter->startElement('office:master-styles'); + $objWriter->startElement('style:master-page'); + $objWriter->writeAttribute('style:name', 'Default'); + $objWriter->writeAttribute('style:page-layout-name', 'Mpm1'); + $objWriter->endElement(); //style:master-page + $objWriter->endElement(); //office:master-styles $objWriter->endElement(); return $objWriter->getData(); diff --git a/tests/data/Writer/Ods/content-arrays.xml b/tests/data/Writer/Ods/content-arrays.xml index e4dc614c7b..8e72601a59 100644 --- a/tests/data/Writer/Ods/content-arrays.xml +++ b/tests/data/Writer/Ods/content-arrays.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/data/Writer/Ods/content-empty.xml b/tests/data/Writer/Ods/content-empty.xml index 51103e7463..e9015af896 100644 --- a/tests/data/Writer/Ods/content-empty.xml +++ b/tests/data/Writer/Ods/content-empty.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/data/Writer/Ods/content-hidden-worksheet.xml b/tests/data/Writer/Ods/content-hidden-worksheet.xml index c641c2320b..b583466701 100644 --- a/tests/data/Writer/Ods/content-hidden-worksheet.xml +++ b/tests/data/Writer/Ods/content-hidden-worksheet.xml @@ -3,10 +3,10 @@ - + - + diff --git a/tests/data/Writer/Ods/content-with-data.xml b/tests/data/Writer/Ods/content-with-data.xml index 6c9a7efb1d..bde23e29d3 100644 --- a/tests/data/Writer/Ods/content-with-data.xml +++ b/tests/data/Writer/Ods/content-with-data.xml @@ -3,10 +3,10 @@ - + - +