1 | <?php |
||
15 | class Writer extends AbstractMultiSheetsWriter |
||
16 | { |
||
17 | /** Default style font values */ |
||
18 | const DEFAULT_FONT_SIZE = 12; |
||
19 | const DEFAULT_FONT_NAME = 'Calibri'; |
||
20 | |||
21 | /** @var string Content-Type value for the header */ |
||
22 | protected static $headerContentType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
||
23 | |||
24 | /** @var string Temporary folder where the files to create the XLSX will be stored */ |
||
25 | protected $tempFolder; |
||
26 | |||
27 | /** @var bool Whether inline or shared strings should be used - inline string is more memory efficient */ |
||
28 | protected $shouldUseInlineStrings = true; |
||
29 | |||
30 | /** @var Internal\Workbook The workbook for the XLSX file */ |
||
31 | protected $book; |
||
32 | |||
33 | /** @var array contain column width information */ |
||
34 | protected $columnwidths = array(); |
||
35 | |||
36 | /** |
||
37 | * Sets a custom temporary folder for creating intermediate files/folders. |
||
38 | * This must be set before opening the writer. |
||
39 | * |
||
40 | * @api |
||
41 | * @param string $tempFolder Temporary folder where the files to create the XLSX will be stored |
||
42 | 3 | * @return Writer |
|
43 | * @throws \Box\Spout\Writer\Exception\WriterAlreadyOpenedException If the writer was already opened |
||
44 | 3 | */ |
|
45 | public function setTempFolder($tempFolder) |
||
52 | |||
53 | /** |
||
54 | * Use inline string to be more memory efficient. If set to false, it will use shared strings. |
||
55 | * This must be set before opening the writer. |
||
56 | * |
||
57 | * @api |
||
58 | * @param bool $shouldUseInlineStrings Whether inline or shared strings should be used |
||
59 | 54 | * @return Writer |
|
60 | * @throws \Box\Spout\Writer\Exception\WriterAlreadyOpenedException If the writer was already opened |
||
61 | 54 | */ |
|
62 | public function setShouldUseInlineStrings($shouldUseInlineStrings) |
||
69 | |||
70 | /** |
||
71 | * Clear all column width specification |
||
72 | * @return Writer |
||
73 | 96 | */ |
|
74 | public function clearColumnWidth() { |
||
83 | |||
84 | /** |
||
85 | 69 | * Add a width definition for the next sheet that will be generated |
|
86 | * @param number $width column width |
||
87 | 69 | * @param number $min column position ( A=1 ) where this width should take effect |
|
88 | * @param number $max end of range where width take effect ( default to min ) |
||
|
|||
89 | * @return Writer |
||
90 | */ |
||
91 | public function setColumnsWidth($width, $min, $max = null) { |
||
107 | |||
108 | /** |
||
109 | * Configures the write and sets the current sheet pointer to a new sheet. |
||
110 | * |
||
111 | * @return void |
||
112 | * @throws \Box\Spout\Common\Exception\IOException If unable to open the file for writing |
||
113 | 111 | */ |
|
114 | protected function openWriter() |
||
122 | |||
123 | /** |
||
124 | * @return Internal\Workbook The workbook representing the file to be written |
||
125 | */ |
||
126 | 63 | protected function getWorkbook() |
|
130 | 63 | ||
131 | 63 | /** |
|
132 | * Adds data to the currently opened writer. |
||
133 | * If shouldCreateNewSheetsAutomatically option is set to true, it will handle pagination |
||
134 | * with the creation of new worksheets if one worksheet has reached its maximum capicity. |
||
135 | * |
||
136 | * @param array $dataRow Array containing data to be written. |
||
137 | * Example $dataRow = ['data1', 1234, null, '', 'data5']; |
||
138 | * @param \Box\Spout\Writer\Style\Style $style Style to be applied to the row. |
||
139 | * @return void |
||
140 | * @throws \Box\Spout\Writer\Exception\WriterNotOpenedException If the book is not created yet |
||
141 | * @throws \Box\Spout\Common\Exception\IOException If unable to write data |
||
142 | */ |
||
143 | protected function addRowToWriter(array $dataRow, $style) |
||
148 | |||
149 | /** |
||
150 | * Returns the default style to be applied to rows. |
||
151 | * |
||
152 | * @return \Box\Spout\Writer\Style\Style |
||
153 | */ |
||
154 | protected function getDefaultRowStyle() |
||
161 | |||
162 | /** |
||
163 | * Closes the writer, preventing any additional writing. |
||
164 | * |
||
165 | * @return void |
||
166 | */ |
||
167 | protected function closeWriter() |
||
173 | } |
||
174 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.