From d0079db4faaab71c27bdbde4ebdcd423e263bc02 Mon Sep 17 00:00:00 2001 From: aVadim Date: Fri, 28 Jun 2024 22:30:44 +0300 Subject: [PATCH] fix --- src/FastExcelWriter/Writer/Writer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FastExcelWriter/Writer/Writer.php b/src/FastExcelWriter/Writer/Writer.php index 5cecea1..a77c6ee 100644 --- a/src/FastExcelWriter/Writer/Writer.php +++ b/src/FastExcelWriter/Writer/Writer.php @@ -1062,8 +1062,10 @@ protected function _writeSheetHead(Sheet $sheet): FileWriter $sheetViews = $sheet->getSheetViews(); $fileWriter->write(''); - foreach ($sheetViews[0]['_items'] as $item) { - $fileWriter->write('<' . $item['_tag'] . self::tagAttributes($item['_attr']) . '/>'); + if (!empty($sheetViews[0]['_items'])) { + foreach ($sheetViews[0]['_items'] as $item) { + $fileWriter->write('<' . $item['_tag'] . self::tagAttributes($item['_attr']) . '/>'); + } } $fileWriter->write('');