Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
aVadim483 committed Jun 28, 2024
1 parent 5baed26 commit 00da7f4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/02-sheets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
7 changes: 7 additions & 0 deletions src/FastExcelWriter/Sheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class Sheet implements InterfaceSheetWriter

protected array $sheetViews = [];

protected array $sheetFormatPr = [];

// bottom sheet nodes
protected array $bottomNodesOptions = [];

Expand Down Expand Up @@ -3738,6 +3740,11 @@ public function getSheetViews(): array
return $result;
}

public function getSheetFormatPr(): array
{
return $this->sheetFormatPr;
}

/**
* @return array
*/
Expand Down
5 changes: 5 additions & 0 deletions src/FastExcelWriter/Writer/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,11 @@ protected function _writeSheetHead(Sheet $sheet): FileWriter

$fileWriter->write('</sheetViews>');

$sheetFormatPr = $sheet->getSheetFormatPr();
if ($sheetFormatPr) {
$fileWriter->write('<sheetFormatPr ') . self::tagAttributes($sheetFormatPr) . '/>';
}

$cols = $sheet->getColAttributes();
if ($cols) {
$fileWriter->write('<cols>');
Expand Down

0 comments on commit 00da7f4

Please sign in to comment.