From 00da7f4b9cdf7946d43efa023146378305402c48 Mon Sep 17 00:00:00 2001 From: aVadim Date: Fri, 28 Jun 2024 21:56:16 +0300 Subject: [PATCH] minor update --- docs/02-sheets.md | 10 +++++----- src/FastExcelWriter/Sheet.php | 7 +++++++ src/FastExcelWriter/Writer/Writer.php | 5 +++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/02-sheets.md b/docs/02-sheets.md index 79d1a74..e594bf0 100644 --- a/docs/02-sheets.md +++ b/docs/02-sheets.md @@ -142,12 +142,12 @@ Column widths can be set in several ways ```php // Set width of column D to 24 -$this->setColWidth('D', 24); -$this->setColOptions('D', ['width' => 24]); +$sheet->setColWidth('D', 24); +$sheet->setColOptions('D', ['width' => 24]); // Set auto width -$this->setColWidth('D', 'auto'); -$this->setColWidthAuto('D'); -$this->setColOptions('D', ['width' => 'auto']); +$sheet->setColWidth('D', 'auto'); +$sheet->setColWidthAuto('D'); +$sheet->setColOptions('D', ['width' => 'auto']); // Set width of specific columns $sheet1->setColWidths(['B' => 10, 'C' => 'auto', 'E' => 30, 'F' => 40]); diff --git a/src/FastExcelWriter/Sheet.php b/src/FastExcelWriter/Sheet.php index fd9f658..0acd69f 100644 --- a/src/FastExcelWriter/Sheet.php +++ b/src/FastExcelWriter/Sheet.php @@ -140,6 +140,8 @@ class Sheet implements InterfaceSheetWriter protected array $sheetViews = []; + protected array $sheetFormatPr = []; + // bottom sheet nodes protected array $bottomNodesOptions = []; @@ -3738,6 +3740,11 @@ public function getSheetViews(): array return $result; } + public function getSheetFormatPr(): array + { + return $this->sheetFormatPr; + } + /** * @return array */ diff --git a/src/FastExcelWriter/Writer/Writer.php b/src/FastExcelWriter/Writer/Writer.php index ee9305f..ac560bc 100644 --- a/src/FastExcelWriter/Writer/Writer.php +++ b/src/FastExcelWriter/Writer/Writer.php @@ -1069,6 +1069,11 @@ protected function _writeSheetHead(Sheet $sheet): FileWriter $fileWriter->write(''); + $sheetFormatPr = $sheet->getSheetFormatPr(); + if ($sheetFormatPr) { + $fileWriter->write(''; + } + $cols = $sheet->getColAttributes(); if ($cols) { $fileWriter->write('');