Differences Between: [Versions 402 and 403]
1 <?php 2 3 declare(strict_types=1); 4 5 namespace OpenSpout\Writer\XLSX\Manager; 6 7 use OpenSpout\Writer\Common\Entity\Sheet; 8 use OpenSpout\Writer\Common\Entity\Workbook; 9 use OpenSpout\Writer\Common\Manager\AbstractWorkbookManager; 10 use OpenSpout\Writer\Common\Manager\Style\StyleMerger; 11 use OpenSpout\Writer\XLSX\Helper\FileSystemHelper; 12 use OpenSpout\Writer\XLSX\Manager\Style\StyleManager; 13 use OpenSpout\Writer\XLSX\Options; 14 15 /** 16 * @internal 17 * 18 * @property WorksheetManager $worksheetManager 19 * @property StyleManager $styleManager 20 * @property FileSystemHelper $fileSystemHelper 21 * @property Options $options 22 */ 23 final class WorkbookManager extends AbstractWorkbookManager 24 { 25 /** 26 * Maximum number of rows a XLSX sheet can contain. 27 * 28 * @see http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx 29 */ 30 private static int $maxRowsPerWorksheet = 1048576; 31 32 public function __construct( 33 Workbook $workbook, 34 Options $options, 35 WorksheetManager $worksheetManager, 36 StyleManager $styleManager, 37 StyleMerger $styleMerger, 38 FileSystemHelper $fileSystemHelper 39 ) { 40 parent::__construct( 41 $workbook, 42 $options, 43 $worksheetManager, 44 $styleManager, 45 $styleMerger, 46 $fileSystemHelper 47 ); 48 } 49 50 /** 51 * @return int Maximum number of rows/columns a sheet can contain 52 */ 53 protected function getMaxRowsPerWorksheet(): int 54 { 55 return self::$maxRowsPerWorksheet; 56 } 57 58 /** 59 * Closes custom objects that are still opened. 60 */ 61 protected function closeRemainingObjects(): void 62 { 63 $this->worksheetManager->getSharedStringsManager()->close(); 64 } 65 66 /** 67 * Writes all the necessary files to disk and zip them together to create the final file. 68 * 69 * @param resource $finalFilePointer Pointer to the spreadsheet that will be created 70 */ 71 protected function writeAllFilesToDiskAndZipThem($finalFilePointer): void 72 { 73 $worksheets = $this->getWorksheets(); 74 75 $this->fileSystemHelper 76 ->createContentFiles($this->options, $worksheets) 77 ->deleteWorksheetTempFolder() 78 ->createContentTypesFile($worksheets) 79 ->createWorkbookFile($worksheets) 80 ->createWorkbookRelsFile($worksheets) 81 ->createWorksheetRelsFiles($worksheets) 82 ->createStylesFile($this->styleManager) 83 ->zipRootFolderAndCopyToStream($finalFilePointer) 84 ; 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body