1 | <?php |
||
9 | class SimpleExcelWriter |
||
10 | { |
||
11 | /** @var \Box\Spout\Writer\WriterInterface */ |
||
12 | private $writer; |
||
13 | |||
14 | private $path = ''; |
||
15 | |||
16 | private $processHeader = true; |
||
17 | |||
18 | private $processingFirstRow = true; |
||
19 | |||
20 | private $numberOfRows = 0; |
||
21 | |||
22 | public static function create(string $file) |
||
26 | |||
27 | public static function streamDownload(string $downloadName) |
||
28 | { |
||
29 | $simpleExcelWriter = new static($downloadName); |
||
30 | |||
31 | $simpleExcelWriter->getWriter()->openToBrowser($downloadName); |
||
32 | |||
33 | return $simpleExcelWriter; |
||
34 | } |
||
35 | |||
36 | public function __construct(string $path) |
||
44 | |||
45 | public function getPath(): string |
||
49 | |||
50 | public function getWriter(): WriterInterface |
||
54 | |||
55 | public function getNumberOfRows(): int |
||
59 | |||
60 | public function noHeaderRow() |
||
66 | |||
67 | /** |
||
68 | * @param \Box\Spout\Common\Entity\Row|array $row |
||
69 | * @param \Box\Spout\Common\Entity\Style\Style|null $style |
||
70 | */ |
||
71 | public function addRow($row, Style $style = null) |
||
88 | |||
89 | protected function writeHeaderFromRow(array $row) |
||
98 | |||
99 | public function toBrowser() |
||
105 | |||
106 | public function close() |
||
110 | |||
111 | public function __destruct() |
||
115 | } |
||
116 |