From 9c1edb4356960b7c0479faf730b6dc2c6afe5e78 Mon Sep 17 00:00:00 2001 From: abo Date: Fri, 15 Sep 2017 12:05:55 +0300 Subject: [PATCH] Set the first column explicitly. --- src/Spout/Writer/XLSX/Writer.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Spout/Writer/XLSX/Writer.php b/src/Spout/Writer/XLSX/Writer.php index b38d69e..96006a8 100644 --- a/src/Spout/Writer/XLSX/Writer.php +++ b/src/Spout/Writer/XLSX/Writer.php @@ -85,18 +85,17 @@ class Writer extends AbstractMultiSheetsWriter /** * Add a width definition for the next sheet that will be generated * @param number $width column width + * @param int $start 1-based number of the first column where this width should take effect * @param int $count column range size where this width should take effect (default 1) * @return Writer */ - public function setColumnWidth($width, $count = 1) + public function setColumnWidth($width, $start, $count = 1) { - $countExisted = count($this->columnWidths); - $min = $countExisted ? $this->columnWidths[$countExisted - 1]['max'] + 1 : 1; - $max = $min + $count - 1; + $max = $start + $count - 1; $this->columnWidths[] = [ 'width' => $width, - 'min' => $min, + 'min' => $start, 'max' => $max ];