@@ -229,7 +229,7 @@ protected function renderTitle()
229
229
$ titles = $ this ->normalizeIndex ($ this ->getTitles ());
230
230
if ($ titles ) {
231
231
$ keys = array_keys ($ titles );
232
- $ col = array_shift ($ keys ) + 1 ; // Add 1 because PhpSpreadsheet is 1-based
232
+ $ col = array_shift ($ keys );
233
233
foreach ($ titles as $ title ) {
234
234
$ this ->_sheet ->setCellValueByColumnAndRow ($ col ++, $ this ->_row , $ title );
235
235
}
@@ -265,7 +265,7 @@ protected function renderRows()
265
265
protected function renderRow ($ data , $ row , $ formats , $ formatters , $ callbacks , $ types )
266
266
{
267
267
foreach (array_values ($ data ) as $ i => $ value ) {
268
- $ col = $ i + self ::normalizeColumn ($ this ->startColumn ) + 1 ; // Add 1 because PhpSpreadsheet is 1-based
268
+ $ col = $ i + self ::normalizeColumn ($ this ->startColumn );
269
269
if (isset ($ formatters [$ col ]) && is_callable ($ formatters [$ col ])) {
270
270
$ value = call_user_func ($ formatters [$ col ], $ value , $ row , $ data );
271
271
}
@@ -307,12 +307,12 @@ protected function normalizeIndex($data)
307
307
/**
308
308
* @param int|string $column the column either as int or as string. If
309
309
* numeric, the startColumn offset will be added.
310
- * @return int the normalized numeric column index (0 -based).
310
+ * @return int the normalized numeric column index (1 -based).
311
311
*/
312
312
public function normalizeColumn ($ column )
313
313
{
314
314
if (is_string ($ column )) {
315
- return \PhpOffice \PhpSpreadsheet \Cell \Coordinate::columnIndexFromString ($ column ) - 1 ;
315
+ return \PhpOffice \PhpSpreadsheet \Cell \Coordinate::columnIndexFromString ($ column );
316
316
} else {
317
317
return $ column + self ::normalizeColumn ($ this ->startColumn );
318
318
}
0 commit comments