|
2 | 2 |
|
3 | 3 | namespace LaravelEnso\DataExport\Services; |
4 | 4 |
|
5 | | -use Box\Spout\Common\Entity\Row; |
6 | | -use Box\Spout\Writer\Common\Creator\Style\StyleBuilder; |
7 | | -use Box\Spout\Writer\Common\Creator\WriterEntityFactory; |
8 | | -use Box\Spout\Writer\XLSX\Writer; |
9 | 5 | use Illuminate\Support\Collection; |
10 | 6 | use Illuminate\Support\Facades\Config; |
11 | 7 | use Illuminate\Support\Facades\Storage; |
|
22 | 18 | use LaravelEnso\Files\Models\File; |
23 | 19 | use LaravelEnso\Files\Models\Type; |
24 | 20 | use LaravelEnso\Helpers\Services\OptimalChunk; |
| 21 | +use OpenSpout\Common\Entity\Row; |
| 22 | +use OpenSpout\Writer\XLSX\Writer; |
25 | 23 | use Throwable; |
26 | 24 |
|
27 | 25 | class ExcelExport |
@@ -82,14 +80,9 @@ private function before(): self |
82 | 80 |
|
83 | 81 | private function initWriter(): self |
84 | 82 | { |
85 | | - $this->writer = WriterEntityFactory::createXLSXWriter(); |
| 83 | + $this->writer = new Writer(); |
86 | 84 |
|
87 | | - $defaultStyle = (new StyleBuilder()) |
88 | | - ->setShouldWrapText(false) |
89 | | - ->build(); |
90 | | - |
91 | | - $this->writer->setDefaultRowStyle($defaultStyle) |
92 | | - ->openToFile(Storage::path($this->path())); |
| 85 | + $this->writer->openToFile(Storage::path($this->path())); |
93 | 86 |
|
94 | 87 | return $this; |
95 | 88 | } |
@@ -153,9 +146,9 @@ private function addRow($row) |
153 | 146 | $this->currentSheet++; |
154 | 147 | } |
155 | 148 |
|
156 | | - private function row($row): Row |
| 149 | + private function row(array $row): Row |
157 | 150 | { |
158 | | - return WriterEntityFactory::createRowFromArray($row); |
| 151 | + return new Row($row); |
159 | 152 | } |
160 | 153 |
|
161 | 154 | private function addSheet(): void |
|
0 commit comments