1 | <?php |
||
27 | abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML |
||
28 | { |
||
29 | /** |
||
30 | * Temporary storage directory. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $tempDir = ''; |
||
35 | |||
36 | /** |
||
37 | * Font. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $font = 'freesans'; |
||
42 | |||
43 | /** |
||
44 | * Orientation (Over-ride). |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $orientation; |
||
49 | |||
50 | /** |
||
51 | * Paper size (Over-ride). |
||
52 | * |
||
53 | * @var int |
||
54 | */ |
||
55 | protected $paperSize; |
||
56 | |||
57 | /** |
||
58 | * Temporary storage for Save Array Return type. |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | private $saveArrayReturnType; |
||
63 | |||
64 | /** |
||
65 | * Paper Sizes xRef List. |
||
66 | * |
||
67 | * @var array |
||
68 | */ |
||
69 | protected static $paperSizes = [ |
||
70 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER => 'LETTER', // (8.5 in. by 11 in.) |
||
71 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER', // (8.5 in. by 11 in.) |
||
72 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID => [792.00, 1224.00], // (11 in. by 17 in.) |
||
73 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEDGER => [1224.00, 792.00], // (17 in. by 11 in.) |
||
74 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL => 'LEGAL', // (8.5 in. by 14 in.) |
||
75 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STATEMENT => [396.00, 612.00], // (5.5 in. by 8.5 in.) |
||
76 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE', // (7.25 in. by 10.5 in.) |
||
77 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3 => 'A3', // (297 mm by 420 mm) |
||
78 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4 => 'A4', // (210 mm by 297 mm) |
||
79 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_SMALL => 'A4', // (210 mm by 297 mm) |
||
80 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5 => 'A5', // (148 mm by 210 mm) |
||
81 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4 => 'B4', // (250 mm by 353 mm) |
||
82 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5 => 'B5', // (176 mm by 250 mm) |
||
83 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_FOLIO => 'FOLIO', // (8.5 in. by 13 in.) |
||
84 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_QUARTO => [609.45, 779.53], // (215 mm by 275 mm) |
||
85 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_1 => [720.00, 1008.00], // (10 in. by 14 in.) |
||
86 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_2 => [792.00, 1224.00], // (11 in. by 17 in.) |
||
87 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NOTE => 'LETTER', // (8.5 in. by 11 in.) |
||
88 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO9_ENVELOPE => [279.00, 639.00], // (3.875 in. by 8.875 in.) |
||
89 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO10_ENVELOPE => [297.00, 684.00], // (4.125 in. by 9.5 in.) |
||
90 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO11_ENVELOPE => [324.00, 747.00], // (4.5 in. by 10.375 in.) |
||
91 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO12_ENVELOPE => [342.00, 792.00], // (4.75 in. by 11 in.) |
||
92 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO14_ENVELOPE => [360.00, 828.00], // (5 in. by 11.5 in.) |
||
93 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C => [1224.00, 1584.00], // (17 in. by 22 in.) |
||
94 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_D => [1584.00, 2448.00], // (22 in. by 34 in.) |
||
95 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_E => [2448.00, 3168.00], // (34 in. by 44 in.) |
||
96 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_DL_ENVELOPE => [311.81, 623.62], // (110 mm by 220 mm) |
||
97 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5', // (162 mm by 229 mm) |
||
98 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3', // (324 mm by 458 mm) |
||
99 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4', // (229 mm by 324 mm) |
||
100 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6', // (114 mm by 162 mm) |
||
101 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C65_ENVELOPE => [323.15, 649.13], // (114 mm by 229 mm) |
||
102 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4', // (250 mm by 353 mm) |
||
103 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5', // (176 mm by 250 mm) |
||
104 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B6_ENVELOPE => [498.90, 354.33], // (176 mm by 125 mm) |
||
105 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ITALY_ENVELOPE => [311.81, 651.97], // (110 mm by 230 mm) |
||
106 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_MONARCH_ENVELOPE => [279.00, 540.00], // (3.875 in. by 7.5 in.) |
||
107 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_6_3_4_ENVELOPE => [261.00, 468.00], // (3.625 in. by 6.5 in.) |
||
108 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => [1071.00, 792.00], // (14.875 in. by 11 in.) |
||
109 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => [612.00, 864.00], // (8.5 in. by 12 in.) |
||
110 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO', // (8.5 in. by 13 in.) |
||
111 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B4 => 'B4', // (250 mm by 353 mm) |
||
112 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => [566.93, 419.53], // (200 mm by 148 mm) |
||
113 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_1 => [648.00, 792.00], // (9 in. by 11 in.) |
||
114 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_2 => [720.00, 792.00], // (10 in. by 11 in.) |
||
115 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_3 => [1080.00, 792.00], // (15 in. by 11 in.) |
||
116 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_INVITE_ENVELOPE => [623.62, 623.62], // (220 mm by 220 mm) |
||
117 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) |
||
118 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => [667.80, 1080.00], // (9.275 in. by 15 in.) |
||
119 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => [841.68, 1296.00], // (11.69 in. by 18 in.) |
||
120 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_EXTRA_PAPER => [668.98, 912.76], // (236 mm by 322 mm) |
||
121 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => [595.80, 792.00], // (8.275 in. by 11 in.) |
||
122 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4', // (210 mm by 297 mm) |
||
123 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) |
||
124 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => [643.46, 1009.13], // (227 mm by 356 mm) |
||
125 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => [864.57, 1380.47], // (305 mm by 487 mm) |
||
126 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => [612.00, 913.68], // (8.5 in. by 12.69 in.) |
||
127 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_PLUS_PAPER => [595.28, 935.43], // (210 mm by 330 mm) |
||
128 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5', // (148 mm by 210 mm) |
||
129 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => [515.91, 728.50], // (182 mm by 257 mm) |
||
130 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) |
||
131 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_EXTRA_PAPER => [493.23, 666.14], // (174 mm by 235 mm) |
||
132 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => [569.76, 782.36], // (201 mm by 276 mm) |
||
133 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A2_PAPER => 'A2', // (420 mm by 594 mm) |
||
134 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3', // (297 mm by 420 mm) |
||
135 | \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) |
||
136 | ]; |
||
137 | |||
138 | /** |
||
139 | * Create a new PDF Writer instance. |
||
140 | * |
||
141 | * @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object |
||
142 | */ |
||
143 | 4 | public function __construct(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet) |
|
149 | |||
150 | /** |
||
151 | * Get Font. |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | 1 | public function getFont() |
|
159 | |||
160 | /** |
||
161 | * Set font. Examples: |
||
162 | * 'arialunicid0-chinese-simplified' |
||
163 | * 'arialunicid0-chinese-traditional' |
||
164 | * 'arialunicid0-korean' |
||
165 | * 'arialunicid0-japanese'. |
||
166 | * |
||
167 | * @param string $fontName |
||
168 | */ |
||
169 | public function setFont($fontName) |
||
175 | |||
176 | /** |
||
177 | * Get Paper Size. |
||
178 | * |
||
179 | * @return int |
||
180 | */ |
||
181 | 4 | public function getPaperSize() |
|
185 | |||
186 | /** |
||
187 | * Set Paper Size. |
||
188 | * |
||
189 | * @param string $pValue Paper size |
||
190 | * |
||
191 | * @return self |
||
192 | */ |
||
193 | public function setPaperSize($pValue = \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER) |
||
199 | |||
200 | /** |
||
201 | * Get Orientation. |
||
202 | * |
||
203 | * @return string |
||
204 | */ |
||
205 | 4 | public function getOrientation() |
|
209 | |||
210 | /** |
||
211 | * Set Orientation. |
||
212 | * |
||
213 | * @param string $pValue Page orientation |
||
214 | * |
||
215 | * @return self |
||
216 | */ |
||
217 | 1 | public function setOrientation($pValue = \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_DEFAULT) |
|
223 | |||
224 | /** |
||
225 | * Get temporary storage directory. |
||
226 | * |
||
227 | * @return string |
||
228 | */ |
||
229 | public function getTempDir() |
||
233 | |||
234 | /** |
||
235 | * Set temporary storage directory. |
||
236 | * |
||
237 | * @param string $pValue Temporary storage directory |
||
238 | * |
||
239 | * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception when directory does not exist |
||
240 | * |
||
241 | * @return self |
||
242 | */ |
||
243 | public function setTempDir($pValue = '') |
||
253 | |||
254 | /** |
||
255 | * Save Spreadsheet to PDF file, pre-save. |
||
256 | * |
||
257 | * @param string $pFilename Name of the file to save as |
||
258 | * |
||
259 | * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception |
||
260 | */ |
||
261 | 4 | protected function prepareForSave($pFilename = null) |
|
282 | |||
283 | /** |
||
284 | * Save PhpSpreadsheet to PDF file, post-save. |
||
285 | * |
||
286 | * @param resource $fileHandle |
||
287 | * |
||
288 | * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception |
||
289 | */ |
||
290 | 4 | protected function restoreStateAfterSave($fileHandle) |
|
297 | } |
||
298 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.