diff --git a/src/Spout/Writer/AbstractWriter.php b/src/Spout/Writer/AbstractWriter.php index 68d452f..2d8af16 100644 --- a/src/Spout/Writer/AbstractWriter.php +++ b/src/Spout/Writer/AbstractWriter.php @@ -205,4 +205,3 @@ abstract class AbstractWriter implements WriterInterface $this->isWriterOpened = false; } } - diff --git a/src/Spout/Writer/Internal/XLSX/Workbook.php b/src/Spout/Writer/Internal/XLSX/Workbook.php index e6ca0db..83f17b0 100644 --- a/src/Spout/Writer/Internal/XLSX/Workbook.php +++ b/src/Spout/Writer/Internal/XLSX/Workbook.php @@ -73,7 +73,7 @@ class Workbook $worksheetFilesFolder = $this->fileSystemHelper->getXlWorksheetsFolder(); $worksheet = new Worksheet($sheet, $worksheetFilesFolder, $this->sharedStringsHelper, $this->shouldUseInlineStrings); $this->worksheets[] = $worksheet; - + return $worksheet; } diff --git a/src/Spout/Writer/Sheet.php b/src/Spout/Writer/Sheet.php index f077028..d9b976a 100644 --- a/src/Spout/Writer/Sheet.php +++ b/src/Spout/Writer/Sheet.php @@ -27,6 +27,15 @@ class Sheet $this->name = self::DEFAULT_SHEET_NAME_PREFIX . ($sheetNumber + 1); } + /** + * @param string $sheetName The custom name of the sheet + * @return void + */ + public function setName($sheetName) + { + $this->name = $sheetName; + } + /** * @return int Number of the sheet, based on order of creation (zero-based) */ diff --git a/src/Spout/Writer/XLSX.php b/src/Spout/Writer/XLSX.php index 62e98f1..1f4e44d 100644 --- a/src/Spout/Writer/XLSX.php +++ b/src/Spout/Writer/XLSX.php @@ -125,6 +125,18 @@ class XLSX extends AbstractWriter return $this->book->getCurrentWorksheet()->getExternalSheet(); } + /** + * Returns the the workbook for the XLSX file + * + * @return Book The workbook for the XLSX file + * @throws \Box\Spout\Writer\Exception\WriterNotOpenedException If the writer has not been opened yet + */ + public function getBook() + { + $this->throwIfBookIsNotAvailable(); + return $this->book; + } + /** * Sets the given sheet as the current one. New data will be written to this sheet. * The writing will resume where it stopped (i.e. data won't be truncated).