@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * |
505 | 505 | * @access private |
506 | 506 | * @param mixed $token The token to convert. |
507 | - * @return mixed the converted token on success |
|
507 | + * @return string the converted token on success |
|
508 | 508 | */ |
509 | 509 | private function convert($token) |
510 | 510 | { |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @access private |
576 | 576 | * @param string $string A string for conversion to its ptg value. |
577 | - * @return mixed the converted token on success |
|
577 | + * @return string the converted token on success |
|
578 | 578 | */ |
579 | 579 | private function convertString($string) |
580 | 580 | { |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * |
655 | 655 | * @access private |
656 | 656 | * @param string $token An Excel range in the Sheet1!A1:A2 format. |
657 | - * @return mixed The packed ptgArea3d token on success. |
|
657 | + * @return string The packed ptgArea3d token on success. |
|
658 | 658 | */ |
659 | 659 | private function convertRange3d($token) |
660 | 660 | { |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | * |
727 | 727 | * @access private |
728 | 728 | * @param string $cell An Excel cell reference |
729 | - * @return mixed The packed ptgRef3d token on success. |
|
729 | + * @return string The packed ptgRef3d token on success. |
|
730 | 730 | */ |
731 | 731 | private function convertRef3d($cell) |
732 | 732 | { |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | * |
835 | 835 | * @access private |
836 | 836 | * @param string $ext_ref The name of the external reference |
837 | - * @return mixed The reference index in packed() format on success |
|
837 | + * @return string The reference index in packed() format on success |
|
838 | 838 | */ |
839 | 839 | private function getRefIndex($ext_ref) |
840 | 840 | { |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | * |
926 | 926 | * @access private |
927 | 927 | * @param string $cell The Excel cell reference to be packed |
928 | - * @return array Array containing the row and column in packed() format |
|
928 | + * @return string[] Array containing the row and column in packed() format |
|
929 | 929 | */ |
930 | 930 | private function cellToPackedRowcol($cell) |
931 | 931 | { |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | * |
955 | 955 | * @access private |
956 | 956 | * @param string $range The Excel range to be packed |
957 | - * @return array Array containing (row1,col1,row2,col2) in packed() format |
|
957 | + * @return string[] Array containing (row1,col1,row2,col2) in packed() format |
|
958 | 958 | */ |
959 | 959 | private function rangeToPackedRange($range) |
960 | 960 | { |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | * Checks if it's a valid token. |
1076 | 1076 | * |
1077 | 1077 | * @access private |
1078 | - * @param mixed $token The token to check. |
|
1078 | + * @param string $token The token to check. |
|
1079 | 1079 | * @return mixed The checked token or false on failure |
1080 | 1080 | */ |
1081 | 1081 | private function match($token) |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | * @access public |
1158 | 1158 | * @param string $formula The formula to parse, without the initial equal |
1159 | 1159 | * sign (=). |
1160 | - * @return mixed true on success |
|
1160 | + * @return boolean true on success |
|
1161 | 1161 | */ |
1162 | 1162 | public function parse($formula) |
1163 | 1163 | { |
@@ -674,7 +674,7 @@ |
||
674 | 674 | list($row1, $col1) = $this->cellToPackedRowcol($cell1); |
675 | 675 | list($row2, $col2) = $this->cellToPackedRowcol($cell2); |
676 | 676 | } else { // It's a rows range (like 26:27) |
677 | - list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1.':'.$cell2); |
|
677 | + list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1.':'.$cell2); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | // The ptg value depends on the class of the ptg. |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function __construct() |
116 | 116 | { |
117 | - $this->currentCharacter = 0; |
|
118 | - $this->currentToken = ''; // The token we are working on. |
|
119 | - $this->formula = ''; // The formula to parse. |
|
120 | - $this->lookAhead = ''; // The character ahead of the current char. |
|
121 | - $this->parseTree = ''; // The parse tree to be generated. |
|
122 | - $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's |
|
117 | + $this->currentCharacter = 0; |
|
118 | + $this->currentToken = ''; // The token we are working on. |
|
119 | + $this->formula = ''; // The formula to parse. |
|
120 | + $this->lookAhead = ''; // The character ahead of the current char. |
|
121 | + $this->parseTree = ''; // The parse tree to be generated. |
|
122 | + $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's |
|
123 | 123 | $this->externalSheets = array(); |
124 | 124 | $this->references = array(); |
125 | 125 | } |
@@ -245,256 +245,256 @@ discard block |
||
245 | 245 | // |
246 | 246 | $this->functions = array( |
247 | 247 | // function ptg args class vol |
248 | - 'COUNT' => array( 0, -1, 0, 0 ), |
|
249 | - 'IF' => array( 1, -1, 1, 0 ), |
|
250 | - 'ISNA' => array( 2, 1, 1, 0 ), |
|
251 | - 'ISERROR' => array( 3, 1, 1, 0 ), |
|
252 | - 'SUM' => array( 4, -1, 0, 0 ), |
|
253 | - 'AVERAGE' => array( 5, -1, 0, 0 ), |
|
254 | - 'MIN' => array( 6, -1, 0, 0 ), |
|
255 | - 'MAX' => array( 7, -1, 0, 0 ), |
|
256 | - 'ROW' => array( 8, -1, 0, 0 ), |
|
257 | - 'COLUMN' => array( 9, -1, 0, 0 ), |
|
258 | - 'NA' => array( 10, 0, 0, 0 ), |
|
259 | - 'NPV' => array( 11, -1, 1, 0 ), |
|
260 | - 'STDEV' => array( 12, -1, 0, 0 ), |
|
261 | - 'DOLLAR' => array( 13, -1, 1, 0 ), |
|
262 | - 'FIXED' => array( 14, -1, 1, 0 ), |
|
263 | - 'SIN' => array( 15, 1, 1, 0 ), |
|
264 | - 'COS' => array( 16, 1, 1, 0 ), |
|
265 | - 'TAN' => array( 17, 1, 1, 0 ), |
|
266 | - 'ATAN' => array( 18, 1, 1, 0 ), |
|
267 | - 'PI' => array( 19, 0, 1, 0 ), |
|
268 | - 'SQRT' => array( 20, 1, 1, 0 ), |
|
269 | - 'EXP' => array( 21, 1, 1, 0 ), |
|
270 | - 'LN' => array( 22, 1, 1, 0 ), |
|
271 | - 'LOG10' => array( 23, 1, 1, 0 ), |
|
272 | - 'ABS' => array( 24, 1, 1, 0 ), |
|
273 | - 'INT' => array( 25, 1, 1, 0 ), |
|
274 | - 'SIGN' => array( 26, 1, 1, 0 ), |
|
275 | - 'ROUND' => array( 27, 2, 1, 0 ), |
|
276 | - 'LOOKUP' => array( 28, -1, 0, 0 ), |
|
277 | - 'INDEX' => array( 29, -1, 0, 1 ), |
|
278 | - 'REPT' => array( 30, 2, 1, 0 ), |
|
279 | - 'MID' => array( 31, 3, 1, 0 ), |
|
280 | - 'LEN' => array( 32, 1, 1, 0 ), |
|
281 | - 'VALUE' => array( 33, 1, 1, 0 ), |
|
282 | - 'TRUE' => array( 34, 0, 1, 0 ), |
|
283 | - 'FALSE' => array( 35, 0, 1, 0 ), |
|
284 | - 'AND' => array( 36, -1, 0, 0 ), |
|
285 | - 'OR' => array( 37, -1, 0, 0 ), |
|
286 | - 'NOT' => array( 38, 1, 1, 0 ), |
|
287 | - 'MOD' => array( 39, 2, 1, 0 ), |
|
288 | - 'DCOUNT' => array( 40, 3, 0, 0 ), |
|
289 | - 'DSUM' => array( 41, 3, 0, 0 ), |
|
290 | - 'DAVERAGE' => array( 42, 3, 0, 0 ), |
|
291 | - 'DMIN' => array( 43, 3, 0, 0 ), |
|
292 | - 'DMAX' => array( 44, 3, 0, 0 ), |
|
293 | - 'DSTDEV' => array( 45, 3, 0, 0 ), |
|
294 | - 'VAR' => array( 46, -1, 0, 0 ), |
|
295 | - 'DVAR' => array( 47, 3, 0, 0 ), |
|
296 | - 'TEXT' => array( 48, 2, 1, 0 ), |
|
297 | - 'LINEST' => array( 49, -1, 0, 0 ), |
|
298 | - 'TREND' => array( 50, -1, 0, 0 ), |
|
299 | - 'LOGEST' => array( 51, -1, 0, 0 ), |
|
300 | - 'GROWTH' => array( 52, -1, 0, 0 ), |
|
301 | - 'PV' => array( 56, -1, 1, 0 ), |
|
302 | - 'FV' => array( 57, -1, 1, 0 ), |
|
303 | - 'NPER' => array( 58, -1, 1, 0 ), |
|
304 | - 'PMT' => array( 59, -1, 1, 0 ), |
|
305 | - 'RATE' => array( 60, -1, 1, 0 ), |
|
306 | - 'MIRR' => array( 61, 3, 0, 0 ), |
|
307 | - 'IRR' => array( 62, -1, 0, 0 ), |
|
308 | - 'RAND' => array( 63, 0, 1, 1 ), |
|
309 | - 'MATCH' => array( 64, -1, 0, 0 ), |
|
310 | - 'DATE' => array( 65, 3, 1, 0 ), |
|
311 | - 'TIME' => array( 66, 3, 1, 0 ), |
|
312 | - 'DAY' => array( 67, 1, 1, 0 ), |
|
313 | - 'MONTH' => array( 68, 1, 1, 0 ), |
|
314 | - 'YEAR' => array( 69, 1, 1, 0 ), |
|
315 | - 'WEEKDAY' => array( 70, -1, 1, 0 ), |
|
316 | - 'HOUR' => array( 71, 1, 1, 0 ), |
|
317 | - 'MINUTE' => array( 72, 1, 1, 0 ), |
|
318 | - 'SECOND' => array( 73, 1, 1, 0 ), |
|
319 | - 'NOW' => array( 74, 0, 1, 1 ), |
|
320 | - 'AREAS' => array( 75, 1, 0, 1 ), |
|
321 | - 'ROWS' => array( 76, 1, 0, 1 ), |
|
322 | - 'COLUMNS' => array( 77, 1, 0, 1 ), |
|
323 | - 'OFFSET' => array( 78, -1, 0, 1 ), |
|
324 | - 'SEARCH' => array( 82, -1, 1, 0 ), |
|
325 | - 'TRANSPOSE' => array( 83, 1, 1, 0 ), |
|
326 | - 'TYPE' => array( 86, 1, 1, 0 ), |
|
327 | - 'ATAN2' => array( 97, 2, 1, 0 ), |
|
328 | - 'ASIN' => array( 98, 1, 1, 0 ), |
|
329 | - 'ACOS' => array( 99, 1, 1, 0 ), |
|
330 | - 'CHOOSE' => array( 100, -1, 1, 0 ), |
|
331 | - 'HLOOKUP' => array( 101, -1, 0, 0 ), |
|
332 | - 'VLOOKUP' => array( 102, -1, 0, 0 ), |
|
333 | - 'ISREF' => array( 105, 1, 0, 0 ), |
|
334 | - 'LOG' => array( 109, -1, 1, 0 ), |
|
335 | - 'CHAR' => array( 111, 1, 1, 0 ), |
|
336 | - 'LOWER' => array( 112, 1, 1, 0 ), |
|
337 | - 'UPPER' => array( 113, 1, 1, 0 ), |
|
338 | - 'PROPER' => array( 114, 1, 1, 0 ), |
|
339 | - 'LEFT' => array( 115, -1, 1, 0 ), |
|
340 | - 'RIGHT' => array( 116, -1, 1, 0 ), |
|
341 | - 'EXACT' => array( 117, 2, 1, 0 ), |
|
342 | - 'TRIM' => array( 118, 1, 1, 0 ), |
|
343 | - 'REPLACE' => array( 119, 4, 1, 0 ), |
|
344 | - 'SUBSTITUTE' => array( 120, -1, 1, 0 ), |
|
345 | - 'CODE' => array( 121, 1, 1, 0 ), |
|
346 | - 'FIND' => array( 124, -1, 1, 0 ), |
|
347 | - 'CELL' => array( 125, -1, 0, 1 ), |
|
348 | - 'ISERR' => array( 126, 1, 1, 0 ), |
|
349 | - 'ISTEXT' => array( 127, 1, 1, 0 ), |
|
350 | - 'ISNUMBER' => array( 128, 1, 1, 0 ), |
|
351 | - 'ISBLANK' => array( 129, 1, 1, 0 ), |
|
352 | - 'T' => array( 130, 1, 0, 0 ), |
|
353 | - 'N' => array( 131, 1, 0, 0 ), |
|
354 | - 'DATEVALUE' => array( 140, 1, 1, 0 ), |
|
355 | - 'TIMEVALUE' => array( 141, 1, 1, 0 ), |
|
356 | - 'SLN' => array( 142, 3, 1, 0 ), |
|
357 | - 'SYD' => array( 143, 4, 1, 0 ), |
|
358 | - 'DDB' => array( 144, -1, 1, 0 ), |
|
359 | - 'INDIRECT' => array( 148, -1, 1, 1 ), |
|
360 | - 'CALL' => array( 150, -1, 1, 0 ), |
|
361 | - 'CLEAN' => array( 162, 1, 1, 0 ), |
|
362 | - 'MDETERM' => array( 163, 1, 2, 0 ), |
|
363 | - 'MINVERSE' => array( 164, 1, 2, 0 ), |
|
364 | - 'MMULT' => array( 165, 2, 2, 0 ), |
|
365 | - 'IPMT' => array( 167, -1, 1, 0 ), |
|
366 | - 'PPMT' => array( 168, -1, 1, 0 ), |
|
367 | - 'COUNTA' => array( 169, -1, 0, 0 ), |
|
368 | - 'PRODUCT' => array( 183, -1, 0, 0 ), |
|
369 | - 'FACT' => array( 184, 1, 1, 0 ), |
|
370 | - 'DPRODUCT' => array( 189, 3, 0, 0 ), |
|
371 | - 'ISNONTEXT' => array( 190, 1, 1, 0 ), |
|
372 | - 'STDEVP' => array( 193, -1, 0, 0 ), |
|
373 | - 'VARP' => array( 194, -1, 0, 0 ), |
|
374 | - 'DSTDEVP' => array( 195, 3, 0, 0 ), |
|
375 | - 'DVARP' => array( 196, 3, 0, 0 ), |
|
376 | - 'TRUNC' => array( 197, -1, 1, 0 ), |
|
377 | - 'ISLOGICAL' => array( 198, 1, 1, 0 ), |
|
378 | - 'DCOUNTA' => array( 199, 3, 0, 0 ), |
|
379 | - 'USDOLLAR' => array( 204, -1, 1, 0 ), |
|
380 | - 'FINDB' => array( 205, -1, 1, 0 ), |
|
381 | - 'SEARCHB' => array( 206, -1, 1, 0 ), |
|
382 | - 'REPLACEB' => array( 207, 4, 1, 0 ), |
|
383 | - 'LEFTB' => array( 208, -1, 1, 0 ), |
|
384 | - 'RIGHTB' => array( 209, -1, 1, 0 ), |
|
385 | - 'MIDB' => array( 210, 3, 1, 0 ), |
|
386 | - 'LENB' => array( 211, 1, 1, 0 ), |
|
387 | - 'ROUNDUP' => array( 212, 2, 1, 0 ), |
|
388 | - 'ROUNDDOWN' => array( 213, 2, 1, 0 ), |
|
389 | - 'ASC' => array( 214, 1, 1, 0 ), |
|
390 | - 'DBCS' => array( 215, 1, 1, 0 ), |
|
391 | - 'RANK' => array( 216, -1, 0, 0 ), |
|
392 | - 'ADDRESS' => array( 219, -1, 1, 0 ), |
|
393 | - 'DAYS360' => array( 220, -1, 1, 0 ), |
|
394 | - 'TODAY' => array( 221, 0, 1, 1 ), |
|
395 | - 'VDB' => array( 222, -1, 1, 0 ), |
|
396 | - 'MEDIAN' => array( 227, -1, 0, 0 ), |
|
397 | - 'SUMPRODUCT' => array( 228, -1, 2, 0 ), |
|
398 | - 'SINH' => array( 229, 1, 1, 0 ), |
|
399 | - 'COSH' => array( 230, 1, 1, 0 ), |
|
400 | - 'TANH' => array( 231, 1, 1, 0 ), |
|
401 | - 'ASINH' => array( 232, 1, 1, 0 ), |
|
402 | - 'ACOSH' => array( 233, 1, 1, 0 ), |
|
403 | - 'ATANH' => array( 234, 1, 1, 0 ), |
|
404 | - 'DGET' => array( 235, 3, 0, 0 ), |
|
405 | - 'INFO' => array( 244, 1, 1, 1 ), |
|
406 | - 'DB' => array( 247, -1, 1, 0 ), |
|
407 | - 'FREQUENCY' => array( 252, 2, 0, 0 ), |
|
408 | - 'ERROR.TYPE' => array( 261, 1, 1, 0 ), |
|
409 | - 'REGISTER.ID' => array( 267, -1, 1, 0 ), |
|
410 | - 'AVEDEV' => array( 269, -1, 0, 0 ), |
|
411 | - 'BETADIST' => array( 270, -1, 1, 0 ), |
|
412 | - 'GAMMALN' => array( 271, 1, 1, 0 ), |
|
413 | - 'BETAINV' => array( 272, -1, 1, 0 ), |
|
414 | - 'BINOMDIST' => array( 273, 4, 1, 0 ), |
|
415 | - 'CHIDIST' => array( 274, 2, 1, 0 ), |
|
416 | - 'CHIINV' => array( 275, 2, 1, 0 ), |
|
417 | - 'COMBIN' => array( 276, 2, 1, 0 ), |
|
418 | - 'CONFIDENCE' => array( 277, 3, 1, 0 ), |
|
419 | - 'CRITBINOM' => array( 278, 3, 1, 0 ), |
|
420 | - 'EVEN' => array( 279, 1, 1, 0 ), |
|
421 | - 'EXPONDIST' => array( 280, 3, 1, 0 ), |
|
422 | - 'FDIST' => array( 281, 3, 1, 0 ), |
|
423 | - 'FINV' => array( 282, 3, 1, 0 ), |
|
424 | - 'FISHER' => array( 283, 1, 1, 0 ), |
|
425 | - 'FISHERINV' => array( 284, 1, 1, 0 ), |
|
426 | - 'FLOOR' => array( 285, 2, 1, 0 ), |
|
427 | - 'GAMMADIST' => array( 286, 4, 1, 0 ), |
|
428 | - 'GAMMAINV' => array( 287, 3, 1, 0 ), |
|
429 | - 'CEILING' => array( 288, 2, 1, 0 ), |
|
430 | - 'HYPGEOMDIST' => array( 289, 4, 1, 0 ), |
|
431 | - 'LOGNORMDIST' => array( 290, 3, 1, 0 ), |
|
432 | - 'LOGINV' => array( 291, 3, 1, 0 ), |
|
433 | - 'NEGBINOMDIST' => array( 292, 3, 1, 0 ), |
|
434 | - 'NORMDIST' => array( 293, 4, 1, 0 ), |
|
435 | - 'NORMSDIST' => array( 294, 1, 1, 0 ), |
|
436 | - 'NORMINV' => array( 295, 3, 1, 0 ), |
|
437 | - 'NORMSINV' => array( 296, 1, 1, 0 ), |
|
438 | - 'STANDARDIZE' => array( 297, 3, 1, 0 ), |
|
439 | - 'ODD' => array( 298, 1, 1, 0 ), |
|
440 | - 'PERMUT' => array( 299, 2, 1, 0 ), |
|
441 | - 'POISSON' => array( 300, 3, 1, 0 ), |
|
442 | - 'TDIST' => array( 301, 3, 1, 0 ), |
|
443 | - 'WEIBULL' => array( 302, 4, 1, 0 ), |
|
444 | - 'SUMXMY2' => array( 303, 2, 2, 0 ), |
|
445 | - 'SUMX2MY2' => array( 304, 2, 2, 0 ), |
|
446 | - 'SUMX2PY2' => array( 305, 2, 2, 0 ), |
|
447 | - 'CHITEST' => array( 306, 2, 2, 0 ), |
|
448 | - 'CORREL' => array( 307, 2, 2, 0 ), |
|
449 | - 'COVAR' => array( 308, 2, 2, 0 ), |
|
450 | - 'FORECAST' => array( 309, 3, 2, 0 ), |
|
451 | - 'FTEST' => array( 310, 2, 2, 0 ), |
|
452 | - 'INTERCEPT' => array( 311, 2, 2, 0 ), |
|
453 | - 'PEARSON' => array( 312, 2, 2, 0 ), |
|
454 | - 'RSQ' => array( 313, 2, 2, 0 ), |
|
455 | - 'STEYX' => array( 314, 2, 2, 0 ), |
|
456 | - 'SLOPE' => array( 315, 2, 2, 0 ), |
|
457 | - 'TTEST' => array( 316, 4, 2, 0 ), |
|
458 | - 'PROB' => array( 317, -1, 2, 0 ), |
|
459 | - 'DEVSQ' => array( 318, -1, 0, 0 ), |
|
460 | - 'GEOMEAN' => array( 319, -1, 0, 0 ), |
|
461 | - 'HARMEAN' => array( 320, -1, 0, 0 ), |
|
462 | - 'SUMSQ' => array( 321, -1, 0, 0 ), |
|
463 | - 'KURT' => array( 322, -1, 0, 0 ), |
|
464 | - 'SKEW' => array( 323, -1, 0, 0 ), |
|
465 | - 'ZTEST' => array( 324, -1, 0, 0 ), |
|
466 | - 'LARGE' => array( 325, 2, 0, 0 ), |
|
467 | - 'SMALL' => array( 326, 2, 0, 0 ), |
|
468 | - 'QUARTILE' => array( 327, 2, 0, 0 ), |
|
469 | - 'PERCENTILE' => array( 328, 2, 0, 0 ), |
|
470 | - 'PERCENTRANK' => array( 329, -1, 0, 0 ), |
|
471 | - 'MODE' => array( 330, -1, 2, 0 ), |
|
472 | - 'TRIMMEAN' => array( 331, 2, 0, 0 ), |
|
473 | - 'TINV' => array( 332, 2, 1, 0 ), |
|
474 | - 'CONCATENATE' => array( 336, -1, 1, 0 ), |
|
475 | - 'POWER' => array( 337, 2, 1, 0 ), |
|
476 | - 'RADIANS' => array( 342, 1, 1, 0 ), |
|
477 | - 'DEGREES' => array( 343, 1, 1, 0 ), |
|
478 | - 'SUBTOTAL' => array( 344, -1, 0, 0 ), |
|
479 | - 'SUMIF' => array( 345, -1, 0, 0 ), |
|
480 | - 'COUNTIF' => array( 346, 2, 0, 0 ), |
|
481 | - 'COUNTBLANK' => array( 347, 1, 0, 0 ), |
|
482 | - 'ISPMT' => array( 350, 4, 1, 0 ), |
|
483 | - 'DATEDIF' => array( 351, 3, 1, 0 ), |
|
484 | - 'DATESTRING' => array( 352, 1, 1, 0 ), |
|
485 | - 'NUMBERSTRING' => array( 353, 2, 1, 0 ), |
|
486 | - 'ROMAN' => array( 354, -1, 1, 0 ), |
|
487 | - 'GETPIVOTDATA' => array( 358, -1, 0, 0 ), |
|
488 | - 'HYPERLINK' => array( 359, -1, 1, 0 ), |
|
489 | - 'PHONETIC' => array( 360, 1, 0, 0 ), |
|
490 | - 'AVERAGEA' => array( 361, -1, 0, 0 ), |
|
491 | - 'MAXA' => array( 362, -1, 0, 0 ), |
|
492 | - 'MINA' => array( 363, -1, 0, 0 ), |
|
493 | - 'STDEVPA' => array( 364, -1, 0, 0 ), |
|
494 | - 'VARPA' => array( 365, -1, 0, 0 ), |
|
495 | - 'STDEVA' => array( 366, -1, 0, 0 ), |
|
496 | - 'VARA' => array( 367, -1, 0, 0 ), |
|
497 | - 'BAHTTEXT' => array( 368, 1, 0, 0 ), |
|
248 | + 'COUNT' => array(0, -1, 0, 0), |
|
249 | + 'IF' => array(1, -1, 1, 0), |
|
250 | + 'ISNA' => array(2, 1, 1, 0), |
|
251 | + 'ISERROR' => array(3, 1, 1, 0), |
|
252 | + 'SUM' => array(4, -1, 0, 0), |
|
253 | + 'AVERAGE' => array(5, -1, 0, 0), |
|
254 | + 'MIN' => array(6, -1, 0, 0), |
|
255 | + 'MAX' => array(7, -1, 0, 0), |
|
256 | + 'ROW' => array(8, -1, 0, 0), |
|
257 | + 'COLUMN' => array(9, -1, 0, 0), |
|
258 | + 'NA' => array(10, 0, 0, 0), |
|
259 | + 'NPV' => array(11, -1, 1, 0), |
|
260 | + 'STDEV' => array(12, -1, 0, 0), |
|
261 | + 'DOLLAR' => array(13, -1, 1, 0), |
|
262 | + 'FIXED' => array(14, -1, 1, 0), |
|
263 | + 'SIN' => array(15, 1, 1, 0), |
|
264 | + 'COS' => array(16, 1, 1, 0), |
|
265 | + 'TAN' => array(17, 1, 1, 0), |
|
266 | + 'ATAN' => array(18, 1, 1, 0), |
|
267 | + 'PI' => array(19, 0, 1, 0), |
|
268 | + 'SQRT' => array(20, 1, 1, 0), |
|
269 | + 'EXP' => array(21, 1, 1, 0), |
|
270 | + 'LN' => array(22, 1, 1, 0), |
|
271 | + 'LOG10' => array(23, 1, 1, 0), |
|
272 | + 'ABS' => array(24, 1, 1, 0), |
|
273 | + 'INT' => array(25, 1, 1, 0), |
|
274 | + 'SIGN' => array(26, 1, 1, 0), |
|
275 | + 'ROUND' => array(27, 2, 1, 0), |
|
276 | + 'LOOKUP' => array(28, -1, 0, 0), |
|
277 | + 'INDEX' => array(29, -1, 0, 1), |
|
278 | + 'REPT' => array(30, 2, 1, 0), |
|
279 | + 'MID' => array(31, 3, 1, 0), |
|
280 | + 'LEN' => array(32, 1, 1, 0), |
|
281 | + 'VALUE' => array(33, 1, 1, 0), |
|
282 | + 'TRUE' => array(34, 0, 1, 0), |
|
283 | + 'FALSE' => array(35, 0, 1, 0), |
|
284 | + 'AND' => array(36, -1, 0, 0), |
|
285 | + 'OR' => array(37, -1, 0, 0), |
|
286 | + 'NOT' => array(38, 1, 1, 0), |
|
287 | + 'MOD' => array(39, 2, 1, 0), |
|
288 | + 'DCOUNT' => array(40, 3, 0, 0), |
|
289 | + 'DSUM' => array(41, 3, 0, 0), |
|
290 | + 'DAVERAGE' => array(42, 3, 0, 0), |
|
291 | + 'DMIN' => array(43, 3, 0, 0), |
|
292 | + 'DMAX' => array(44, 3, 0, 0), |
|
293 | + 'DSTDEV' => array(45, 3, 0, 0), |
|
294 | + 'VAR' => array(46, -1, 0, 0), |
|
295 | + 'DVAR' => array(47, 3, 0, 0), |
|
296 | + 'TEXT' => array(48, 2, 1, 0), |
|
297 | + 'LINEST' => array(49, -1, 0, 0), |
|
298 | + 'TREND' => array(50, -1, 0, 0), |
|
299 | + 'LOGEST' => array(51, -1, 0, 0), |
|
300 | + 'GROWTH' => array(52, -1, 0, 0), |
|
301 | + 'PV' => array(56, -1, 1, 0), |
|
302 | + 'FV' => array(57, -1, 1, 0), |
|
303 | + 'NPER' => array(58, -1, 1, 0), |
|
304 | + 'PMT' => array(59, -1, 1, 0), |
|
305 | + 'RATE' => array(60, -1, 1, 0), |
|
306 | + 'MIRR' => array(61, 3, 0, 0), |
|
307 | + 'IRR' => array(62, -1, 0, 0), |
|
308 | + 'RAND' => array(63, 0, 1, 1), |
|
309 | + 'MATCH' => array(64, -1, 0, 0), |
|
310 | + 'DATE' => array(65, 3, 1, 0), |
|
311 | + 'TIME' => array(66, 3, 1, 0), |
|
312 | + 'DAY' => array(67, 1, 1, 0), |
|
313 | + 'MONTH' => array(68, 1, 1, 0), |
|
314 | + 'YEAR' => array(69, 1, 1, 0), |
|
315 | + 'WEEKDAY' => array(70, -1, 1, 0), |
|
316 | + 'HOUR' => array(71, 1, 1, 0), |
|
317 | + 'MINUTE' => array(72, 1, 1, 0), |
|
318 | + 'SECOND' => array(73, 1, 1, 0), |
|
319 | + 'NOW' => array(74, 0, 1, 1), |
|
320 | + 'AREAS' => array(75, 1, 0, 1), |
|
321 | + 'ROWS' => array(76, 1, 0, 1), |
|
322 | + 'COLUMNS' => array(77, 1, 0, 1), |
|
323 | + 'OFFSET' => array(78, -1, 0, 1), |
|
324 | + 'SEARCH' => array(82, -1, 1, 0), |
|
325 | + 'TRANSPOSE' => array(83, 1, 1, 0), |
|
326 | + 'TYPE' => array(86, 1, 1, 0), |
|
327 | + 'ATAN2' => array(97, 2, 1, 0), |
|
328 | + 'ASIN' => array(98, 1, 1, 0), |
|
329 | + 'ACOS' => array(99, 1, 1, 0), |
|
330 | + 'CHOOSE' => array(100, -1, 1, 0), |
|
331 | + 'HLOOKUP' => array(101, -1, 0, 0), |
|
332 | + 'VLOOKUP' => array(102, -1, 0, 0), |
|
333 | + 'ISREF' => array(105, 1, 0, 0), |
|
334 | + 'LOG' => array(109, -1, 1, 0), |
|
335 | + 'CHAR' => array(111, 1, 1, 0), |
|
336 | + 'LOWER' => array(112, 1, 1, 0), |
|
337 | + 'UPPER' => array(113, 1, 1, 0), |
|
338 | + 'PROPER' => array(114, 1, 1, 0), |
|
339 | + 'LEFT' => array(115, -1, 1, 0), |
|
340 | + 'RIGHT' => array(116, -1, 1, 0), |
|
341 | + 'EXACT' => array(117, 2, 1, 0), |
|
342 | + 'TRIM' => array(118, 1, 1, 0), |
|
343 | + 'REPLACE' => array(119, 4, 1, 0), |
|
344 | + 'SUBSTITUTE' => array(120, -1, 1, 0), |
|
345 | + 'CODE' => array(121, 1, 1, 0), |
|
346 | + 'FIND' => array(124, -1, 1, 0), |
|
347 | + 'CELL' => array(125, -1, 0, 1), |
|
348 | + 'ISERR' => array(126, 1, 1, 0), |
|
349 | + 'ISTEXT' => array(127, 1, 1, 0), |
|
350 | + 'ISNUMBER' => array(128, 1, 1, 0), |
|
351 | + 'ISBLANK' => array(129, 1, 1, 0), |
|
352 | + 'T' => array(130, 1, 0, 0), |
|
353 | + 'N' => array(131, 1, 0, 0), |
|
354 | + 'DATEVALUE' => array(140, 1, 1, 0), |
|
355 | + 'TIMEVALUE' => array(141, 1, 1, 0), |
|
356 | + 'SLN' => array(142, 3, 1, 0), |
|
357 | + 'SYD' => array(143, 4, 1, 0), |
|
358 | + 'DDB' => array(144, -1, 1, 0), |
|
359 | + 'INDIRECT' => array(148, -1, 1, 1), |
|
360 | + 'CALL' => array(150, -1, 1, 0), |
|
361 | + 'CLEAN' => array(162, 1, 1, 0), |
|
362 | + 'MDETERM' => array(163, 1, 2, 0), |
|
363 | + 'MINVERSE' => array(164, 1, 2, 0), |
|
364 | + 'MMULT' => array(165, 2, 2, 0), |
|
365 | + 'IPMT' => array(167, -1, 1, 0), |
|
366 | + 'PPMT' => array(168, -1, 1, 0), |
|
367 | + 'COUNTA' => array(169, -1, 0, 0), |
|
368 | + 'PRODUCT' => array(183, -1, 0, 0), |
|
369 | + 'FACT' => array(184, 1, 1, 0), |
|
370 | + 'DPRODUCT' => array(189, 3, 0, 0), |
|
371 | + 'ISNONTEXT' => array(190, 1, 1, 0), |
|
372 | + 'STDEVP' => array(193, -1, 0, 0), |
|
373 | + 'VARP' => array(194, -1, 0, 0), |
|
374 | + 'DSTDEVP' => array(195, 3, 0, 0), |
|
375 | + 'DVARP' => array(196, 3, 0, 0), |
|
376 | + 'TRUNC' => array(197, -1, 1, 0), |
|
377 | + 'ISLOGICAL' => array(198, 1, 1, 0), |
|
378 | + 'DCOUNTA' => array(199, 3, 0, 0), |
|
379 | + 'USDOLLAR' => array(204, -1, 1, 0), |
|
380 | + 'FINDB' => array(205, -1, 1, 0), |
|
381 | + 'SEARCHB' => array(206, -1, 1, 0), |
|
382 | + 'REPLACEB' => array(207, 4, 1, 0), |
|
383 | + 'LEFTB' => array(208, -1, 1, 0), |
|
384 | + 'RIGHTB' => array(209, -1, 1, 0), |
|
385 | + 'MIDB' => array(210, 3, 1, 0), |
|
386 | + 'LENB' => array(211, 1, 1, 0), |
|
387 | + 'ROUNDUP' => array(212, 2, 1, 0), |
|
388 | + 'ROUNDDOWN' => array(213, 2, 1, 0), |
|
389 | + 'ASC' => array(214, 1, 1, 0), |
|
390 | + 'DBCS' => array(215, 1, 1, 0), |
|
391 | + 'RANK' => array(216, -1, 0, 0), |
|
392 | + 'ADDRESS' => array(219, -1, 1, 0), |
|
393 | + 'DAYS360' => array(220, -1, 1, 0), |
|
394 | + 'TODAY' => array(221, 0, 1, 1), |
|
395 | + 'VDB' => array(222, -1, 1, 0), |
|
396 | + 'MEDIAN' => array(227, -1, 0, 0), |
|
397 | + 'SUMPRODUCT' => array(228, -1, 2, 0), |
|
398 | + 'SINH' => array(229, 1, 1, 0), |
|
399 | + 'COSH' => array(230, 1, 1, 0), |
|
400 | + 'TANH' => array(231, 1, 1, 0), |
|
401 | + 'ASINH' => array(232, 1, 1, 0), |
|
402 | + 'ACOSH' => array(233, 1, 1, 0), |
|
403 | + 'ATANH' => array(234, 1, 1, 0), |
|
404 | + 'DGET' => array(235, 3, 0, 0), |
|
405 | + 'INFO' => array(244, 1, 1, 1), |
|
406 | + 'DB' => array(247, -1, 1, 0), |
|
407 | + 'FREQUENCY' => array(252, 2, 0, 0), |
|
408 | + 'ERROR.TYPE' => array(261, 1, 1, 0), |
|
409 | + 'REGISTER.ID' => array(267, -1, 1, 0), |
|
410 | + 'AVEDEV' => array(269, -1, 0, 0), |
|
411 | + 'BETADIST' => array(270, -1, 1, 0), |
|
412 | + 'GAMMALN' => array(271, 1, 1, 0), |
|
413 | + 'BETAINV' => array(272, -1, 1, 0), |
|
414 | + 'BINOMDIST' => array(273, 4, 1, 0), |
|
415 | + 'CHIDIST' => array(274, 2, 1, 0), |
|
416 | + 'CHIINV' => array(275, 2, 1, 0), |
|
417 | + 'COMBIN' => array(276, 2, 1, 0), |
|
418 | + 'CONFIDENCE' => array(277, 3, 1, 0), |
|
419 | + 'CRITBINOM' => array(278, 3, 1, 0), |
|
420 | + 'EVEN' => array(279, 1, 1, 0), |
|
421 | + 'EXPONDIST' => array(280, 3, 1, 0), |
|
422 | + 'FDIST' => array(281, 3, 1, 0), |
|
423 | + 'FINV' => array(282, 3, 1, 0), |
|
424 | + 'FISHER' => array(283, 1, 1, 0), |
|
425 | + 'FISHERINV' => array(284, 1, 1, 0), |
|
426 | + 'FLOOR' => array(285, 2, 1, 0), |
|
427 | + 'GAMMADIST' => array(286, 4, 1, 0), |
|
428 | + 'GAMMAINV' => array(287, 3, 1, 0), |
|
429 | + 'CEILING' => array(288, 2, 1, 0), |
|
430 | + 'HYPGEOMDIST' => array(289, 4, 1, 0), |
|
431 | + 'LOGNORMDIST' => array(290, 3, 1, 0), |
|
432 | + 'LOGINV' => array(291, 3, 1, 0), |
|
433 | + 'NEGBINOMDIST' => array(292, 3, 1, 0), |
|
434 | + 'NORMDIST' => array(293, 4, 1, 0), |
|
435 | + 'NORMSDIST' => array(294, 1, 1, 0), |
|
436 | + 'NORMINV' => array(295, 3, 1, 0), |
|
437 | + 'NORMSINV' => array(296, 1, 1, 0), |
|
438 | + 'STANDARDIZE' => array(297, 3, 1, 0), |
|
439 | + 'ODD' => array(298, 1, 1, 0), |
|
440 | + 'PERMUT' => array(299, 2, 1, 0), |
|
441 | + 'POISSON' => array(300, 3, 1, 0), |
|
442 | + 'TDIST' => array(301, 3, 1, 0), |
|
443 | + 'WEIBULL' => array(302, 4, 1, 0), |
|
444 | + 'SUMXMY2' => array(303, 2, 2, 0), |
|
445 | + 'SUMX2MY2' => array(304, 2, 2, 0), |
|
446 | + 'SUMX2PY2' => array(305, 2, 2, 0), |
|
447 | + 'CHITEST' => array(306, 2, 2, 0), |
|
448 | + 'CORREL' => array(307, 2, 2, 0), |
|
449 | + 'COVAR' => array(308, 2, 2, 0), |
|
450 | + 'FORECAST' => array(309, 3, 2, 0), |
|
451 | + 'FTEST' => array(310, 2, 2, 0), |
|
452 | + 'INTERCEPT' => array(311, 2, 2, 0), |
|
453 | + 'PEARSON' => array(312, 2, 2, 0), |
|
454 | + 'RSQ' => array(313, 2, 2, 0), |
|
455 | + 'STEYX' => array(314, 2, 2, 0), |
|
456 | + 'SLOPE' => array(315, 2, 2, 0), |
|
457 | + 'TTEST' => array(316, 4, 2, 0), |
|
458 | + 'PROB' => array(317, -1, 2, 0), |
|
459 | + 'DEVSQ' => array(318, -1, 0, 0), |
|
460 | + 'GEOMEAN' => array(319, -1, 0, 0), |
|
461 | + 'HARMEAN' => array(320, -1, 0, 0), |
|
462 | + 'SUMSQ' => array(321, -1, 0, 0), |
|
463 | + 'KURT' => array(322, -1, 0, 0), |
|
464 | + 'SKEW' => array(323, -1, 0, 0), |
|
465 | + 'ZTEST' => array(324, -1, 0, 0), |
|
466 | + 'LARGE' => array(325, 2, 0, 0), |
|
467 | + 'SMALL' => array(326, 2, 0, 0), |
|
468 | + 'QUARTILE' => array(327, 2, 0, 0), |
|
469 | + 'PERCENTILE' => array(328, 2, 0, 0), |
|
470 | + 'PERCENTRANK' => array(329, -1, 0, 0), |
|
471 | + 'MODE' => array(330, -1, 2, 0), |
|
472 | + 'TRIMMEAN' => array(331, 2, 0, 0), |
|
473 | + 'TINV' => array(332, 2, 1, 0), |
|
474 | + 'CONCATENATE' => array(336, -1, 1, 0), |
|
475 | + 'POWER' => array(337, 2, 1, 0), |
|
476 | + 'RADIANS' => array(342, 1, 1, 0), |
|
477 | + 'DEGREES' => array(343, 1, 1, 0), |
|
478 | + 'SUBTOTAL' => array(344, -1, 0, 0), |
|
479 | + 'SUMIF' => array(345, -1, 0, 0), |
|
480 | + 'COUNTIF' => array(346, 2, 0, 0), |
|
481 | + 'COUNTBLANK' => array(347, 1, 0, 0), |
|
482 | + 'ISPMT' => array(350, 4, 1, 0), |
|
483 | + 'DATEDIF' => array(351, 3, 1, 0), |
|
484 | + 'DATESTRING' => array(352, 1, 1, 0), |
|
485 | + 'NUMBERSTRING' => array(353, 2, 1, 0), |
|
486 | + 'ROMAN' => array(354, -1, 1, 0), |
|
487 | + 'GETPIVOTDATA' => array(358, -1, 0, 0), |
|
488 | + 'HYPERLINK' => array(359, -1, 1, 0), |
|
489 | + 'PHONETIC' => array(360, 1, 0, 0), |
|
490 | + 'AVERAGEA' => array(361, -1, 0, 0), |
|
491 | + 'MAXA' => array(362, -1, 0, 0), |
|
492 | + 'MINA' => array(363, -1, 0, 0), |
|
493 | + 'STDEVPA' => array(364, -1, 0, 0), |
|
494 | + 'VARPA' => array(365, -1, 0, 0), |
|
495 | + 'STDEVA' => array(366, -1, 0, 0), |
|
496 | + 'VARA' => array(367, -1, 0, 0), |
|
497 | + 'BAHTTEXT' => array(368, 1, 0, 0), |
|
498 | 498 | ); |
499 | 499 | } |
500 | 500 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | */ |
598 | 598 | private function convertFunction($token, $num_args) |
599 | 599 | { |
600 | - $args = $this->functions[$token][1]; |
|
600 | + $args = $this->functions[$token][1]; |
|
601 | 601 | // $volatile = $this->functions[$token][3]; |
602 | 602 | |
603 | 603 | // Fixed number of args eg. TIME($i, $j, $k). |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | // TODO: use real error codes |
645 | 645 | throw new \PhpSpreadsheet\Writer\Exception("Unknown class $class"); |
646 | 646 | } |
647 | - return $ptgArea . $row1 . $row2 . $col1. $col2; |
|
647 | + return $ptgArea . $row1 . $row2 . $col1 . $col2; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | /** |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | list($row1, $col1) = $this->cellToPackedRowcol($cell1); |
674 | 674 | list($row2, $col2) = $this->cellToPackedRowcol($cell2); |
675 | 675 | } else { // It's a rows range (like 26:27) |
676 | - list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1.':'.$cell2); |
|
676 | + list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1 . ':' . $cell2); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | // The ptg value depends on the class of the ptg. |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | // throw new \PhpSpreadsheet\Writer\Exception("Unknown class $class"); |
688 | 688 | // } |
689 | 689 | |
690 | - return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2; |
|
690 | + return $ptgArea . $ext_ref . $row1 . $row2 . $col1 . $col2; |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | /** |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | // // TODO: use real error codes |
717 | 717 | // throw new \PhpSpreadsheet\Writer\Exception("Unknown class $class"); |
718 | 718 | // } |
719 | - return $ptgRef.$row.$col; |
|
719 | + return $ptgRef . $row . $col; |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | /** |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | // throw new \PhpSpreadsheet\Writer\Exception("Unknown class $class"); |
752 | 752 | // } |
753 | 753 | |
754 | - return $ptgRef . $ext_ref. $row . $col; |
|
754 | + return $ptgRef . $ext_ref . $row . $col; |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | /** |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | if ($i < ($formula_length - 1)) { |
1040 | - $this->lookAhead = $this->formula{$i+1}; |
|
1040 | + $this->lookAhead = $this->formula{$i + 1}; |
|
1041 | 1041 | } |
1042 | 1042 | $token = ''; |
1043 | 1043 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | $token .= $this->formula{$i}; |
1047 | 1047 | |
1048 | 1048 | if ($i < ($formula_length - 1)) { |
1049 | - $this->lookAhead = $this->formula{$i+1}; |
|
1049 | + $this->lookAhead = $this->formula{$i + 1}; |
|
1050 | 1050 | } else { |
1051 | 1051 | $this->lookAhead = ''; |
1052 | 1052 | } |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | if ($i < ($formula_length - 2)) { |
1064 | - $this->lookAhead = $this->formula{$i+2}; |
|
1064 | + $this->lookAhead = $this->formula{$i + 2}; |
|
1065 | 1065 | } else { // if we run out of characters lookAhead becomes empty |
1066 | 1066 | $this->lookAhead = ''; |
1067 | 1067 | } |
@@ -1129,10 +1129,10 @@ discard block |
||
1129 | 1129 | } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) { |
1130 | 1130 | // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 |
1131 | 1131 | return $token; |
1132 | - } elseif (is_numeric($token) and (!is_numeric($token.$this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) { |
|
1132 | + } elseif (is_numeric($token) and (!is_numeric($token . $this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) { |
|
1133 | 1133 | // If it's a number (check that it's not a sheet name or range) |
1134 | 1134 | return $token; |
1135 | - } elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->lookAhead != '"' and (substr_count($token, '"')%2 == 0)) { |
|
1135 | + } elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->lookAhead != '"' and (substr_count($token, '"') % 2 == 0)) { |
|
1136 | 1136 | // If it's a string (of maximum 255 characters) |
1137 | 1137 | return $token; |
1138 | 1138 | } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') { |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $this->formula = $formula; |
1165 | 1165 | $this->lookAhead = isset($formula{1}) ? $formula{1} : ''; |
1166 | 1166 | $this->advance(); |
1167 | - $this->parseTree = $this->condition(); |
|
1167 | + $this->parseTree = $this->condition(); |
|
1168 | 1168 | return true; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1329,12 +1329,12 @@ discard block |
||
1329 | 1329 | private function fact() |
1330 | 1330 | { |
1331 | 1331 | if ($this->currentToken == "(") { |
1332 | - $this->advance(); // eat the "(" |
|
1332 | + $this->advance(); // eat the "(" |
|
1333 | 1333 | $result = $this->parenthesizedExpression(); |
1334 | 1334 | if ($this->currentToken != ")") { |
1335 | 1335 | throw new \PhpSpreadsheet\Writer\Exception("')' token expected."); |
1336 | 1336 | } |
1337 | - $this->advance(); // eat the ")" |
|
1337 | + $this->advance(); // eat the ")" |
|
1338 | 1338 | return $result; |
1339 | 1339 | } |
1340 | 1340 | // if it's a reference |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | // If it's a number or a percent |
1378 | 1378 | if ($this->lookAhead == '%') { |
1379 | 1379 | $result = $this->createTree('ptgPercent', $this->currentToken, ''); |
1380 | - $this->advance(); // Skip the percentage operator once we've pre-built that tree |
|
1380 | + $this->advance(); // Skip the percentage operator once we've pre-built that tree |
|
1381 | 1381 | } else { |
1382 | 1382 | $result = $this->createTree($this->currentToken, '', ''); |
1383 | 1383 | } |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | $result = $this->func(); |
1389 | 1389 | return $result; |
1390 | 1390 | } |
1391 | - throw new \PhpSpreadsheet\Writer\Exception("Syntax error: ".$this->currentToken.", lookahead: ".$this->lookAhead.", current char: ".$this->currentCharacter); |
|
1391 | + throw new \PhpSpreadsheet\Writer\Exception("Syntax error: " . $this->currentToken . ", lookahead: " . $this->lookAhead . ", current char: " . $this->currentCharacter); |
|
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | /** |
@@ -1404,12 +1404,12 @@ discard block |
||
1404 | 1404 | $function = strtoupper($this->currentToken); |
1405 | 1405 | $result = ''; // initialize result |
1406 | 1406 | $this->advance(); |
1407 | - $this->advance(); // eat the "(" |
|
1407 | + $this->advance(); // eat the "(" |
|
1408 | 1408 | while ($this->currentToken != ')') { |
1409 | 1409 | /**/ |
1410 | 1410 | if ($num_args > 0) { |
1411 | 1411 | if ($this->currentToken == "," || $this->currentToken == ";") { |
1412 | - $this->advance(); // eat the "," or ";" |
|
1412 | + $this->advance(); // eat the "," or ";" |
|
1413 | 1413 | } else { |
1414 | 1414 | throw new \PhpSpreadsheet\Writer\Exception("Syntax error: comma expected in function $function, arg #{$num_args}"); |
1415 | 1415 | } |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | $result = $this->createTree($function, $result, $num_args); |
1434 | - $this->advance(); // eat the ")" |
|
1434 | + $this->advance(); // eat the ")" |
|
1435 | 1435 | return $result; |
1436 | 1436 | } |
1437 | 1437 | |
@@ -1511,7 +1511,7 @@ discard block |
||
1511 | 1511 | $left_tree = ''; |
1512 | 1512 | } |
1513 | 1513 | // add it's left subtree and return. |
1514 | - return $left_tree.$this->convertFunction($tree['value'], $tree['right']); |
|
1514 | + return $left_tree . $this->convertFunction($tree['value'], $tree['right']); |
|
1515 | 1515 | } else { |
1516 | 1516 | $converted_tree = $this->convert($tree['value']); |
1517 | 1517 | } |
@@ -200,10 +200,12 @@ discard block |
||
200 | 200 | * @param int &$str_unique Total number of unique strings |
201 | 201 | * @param array &$str_table String Table |
202 | 202 | * @param array &$colors Colour Table |
203 | - * @param mixed $parser The formula parser created for the Workbook |
|
203 | + * @param Parser $parser The formula parser created for the Workbook |
|
204 | 204 | * @param boolean $preCalculateFormulas Flag indicating whether formulas should be calculated or just written |
205 | 205 | * @param string $phpSheet The worksheet to write |
206 | 206 | * @param \PHPExcel\Worksheet $phpSheet |
207 | + * @param integer $str_total |
|
208 | + * @param integer $str_unique |
|
207 | 209 | */ |
208 | 210 | public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet) |
209 | 211 | { |
@@ -614,7 +616,7 @@ discard block |
||
614 | 616 | * @param integer $row Zero indexed row |
615 | 617 | * @param integer $col Zero indexed column |
616 | 618 | * @param float $num The number to write |
617 | - * @param mixed $xfIndex The optional XF format |
|
619 | + * @param integer $xfIndex The optional XF format |
|
618 | 620 | * @return integer |
619 | 621 | */ |
620 | 622 | private function writeNumber($row, $col, $num, $xfIndex) |
@@ -652,7 +654,7 @@ discard block |
||
652 | 654 | * @param int $row Row index (0-based) |
653 | 655 | * @param int $col Column index (0-based) |
654 | 656 | * @param string $str The string |
655 | - * @param mixed $xfIndex The XF format index for the cell |
|
657 | + * @param integer $xfIndex The XF format index for the cell |
|
656 | 658 | * @param array $arrcRun Index to Font record and characters beginning |
657 | 659 | */ |
658 | 660 | private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) |
@@ -720,7 +722,7 @@ discard block |
||
720 | 722 | * @param integer $row Zero indexed row |
721 | 723 | * @param integer $col Zero indexed column |
722 | 724 | * @param string $str The string to write |
723 | - * @param mixed $xfIndex The XF format index for the cell |
|
725 | + * @param integer $xfIndex The XF format index for the cell |
|
724 | 726 | * @return integer |
725 | 727 | */ |
726 | 728 | private function writeLabelSst($row, $col, $str, $xfIndex) |
@@ -785,7 +787,7 @@ discard block |
||
785 | 787 | * |
786 | 788 | * @param integer $row Zero indexed row |
787 | 789 | * @param integer $col Zero indexed column |
788 | - * @param mixed $xfIndex The XF format index |
|
790 | + * @param integer $xfIndex The XF format index |
|
789 | 791 | */ |
790 | 792 | public function writeBlank($row, $col, $xfIndex) |
791 | 793 | { |
@@ -830,7 +832,7 @@ discard block |
||
830 | 832 | * @param integer $row Zero indexed row |
831 | 833 | * @param integer $col Zero indexed column |
832 | 834 | * @param string $formula The formula text string |
833 | - * @param mixed $xfIndex The XF format index |
|
835 | + * @param integer $xfIndex The XF format index |
|
834 | 836 | * @param mixed $calculatedValue Calculated value |
835 | 837 | * @return integer |
836 | 838 | */ |
@@ -2307,8 +2309,8 @@ discard block |
||
2307 | 2309 | * @param mixed $bitmap The bitmap filename or GD-image resource |
2308 | 2310 | * @param integer $x The horizontal position (offset) of the image inside the cell. |
2309 | 2311 | * @param integer $y The vertical position (offset) of the image inside the cell. |
2310 | - * @param float $scale_x The horizontal scale |
|
2311 | - * @param float $scale_y The vertical scale |
|
2312 | + * @param integer $scale_x The horizontal scale |
|
2313 | + * @param integer $scale_y The vertical scale |
|
2312 | 2314 | */ |
2313 | 2315 | public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) |
2314 | 2316 | { |
@@ -1019,8 +1019,8 @@ discard block |
||
1019 | 1019 | |
1020 | 1020 | // Write the packed data |
1021 | 1021 | $this->append($header . $data . |
1022 | - $unknown1 . $options . |
|
1023 | - $unknown2 . $url_len . $url); |
|
1022 | + $unknown1 . $options . |
|
1023 | + $unknown2 . $url_len . $url); |
|
1024 | 1024 | return 0; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | |
1069 | 1069 | // Write the packed data |
1070 | 1070 | $this->append($header . $data . |
1071 | - $unknown1 . $options . |
|
1072 | - $url_len . $url); |
|
1071 | + $unknown1 . $options . |
|
1072 | + $url_len . $url); |
|
1073 | 1073 | return 0; |
1074 | 1074 | } |
1075 | 1075 | |
@@ -1151,14 +1151,14 @@ discard block |
||
1151 | 1151 | |
1152 | 1152 | // Pack the main data stream |
1153 | 1153 | $data = pack("vvvv", $row1, $row2, $col1, $col2) . |
1154 | - $unknown1 . |
|
1155 | - $link_type . |
|
1156 | - $unknown2 . |
|
1157 | - $up_count . |
|
1158 | - $dir_short_len. |
|
1159 | - $dir_short . |
|
1160 | - $unknown3 . |
|
1161 | - $stream_len ;/*. |
|
1154 | + $unknown1 . |
|
1155 | + $link_type . |
|
1156 | + $unknown2 . |
|
1157 | + $up_count . |
|
1158 | + $dir_short_len. |
|
1159 | + $dir_short . |
|
1160 | + $unknown3 . |
|
1161 | + $stream_len ;/*. |
|
1162 | 1162 | $dir_long_len . |
1163 | 1163 | $unknown4 . |
1164 | 1164 | $dir_long . |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $this->_preCalculateFormulas = $preCalculateFormulas; |
217 | 217 | $this->stringTotal = &$str_total; |
218 | - $this->stringUnique = &$str_unique; |
|
218 | + $this->stringUnique = &$str_unique; |
|
219 | 219 | $this->stringTable = &$str_table; |
220 | 220 | $this->colors = &$colors; |
221 | 221 | $this->parser = $parser; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | //$this->offset = 0; |
227 | 227 | $this->xlsStringMaxLength = 255; |
228 | 228 | $this->columnInfo = array(); |
229 | - $this->selection = array(0,0,0,0); |
|
229 | + $this->selection = array(0, 0, 0, 0); |
|
230 | 230 | $this->activePane = 3; |
231 | 231 | |
232 | 232 | $this->_print_headers = 0; |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | $minR = 1; |
243 | 243 | $minC = 'A'; |
244 | 244 | |
245 | - $maxR = $this->phpSheet->getHighestRow(); |
|
245 | + $maxR = $this->phpSheet->getHighestRow(); |
|
246 | 246 | $maxC = $this->phpSheet->getHighestColumn(); |
247 | 247 | |
248 | 248 | // Determine lowest and highest column and row |
249 | 249 | // $this->firstRowIndex = ($minR > 65535) ? 65535 : $minR; |
250 | - $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ; |
|
250 | + $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR; |
|
251 | 251 | |
252 | 252 | $this->firstColumnIndex = \PhpSpreadsheet\Cell::columnIndexFromString($minC); |
253 | 253 | $this->lastColumnIndex = \PhpSpreadsheet\Cell::columnIndexFromString($maxC); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | $columnDimensions = $phpSheet->getColumnDimensions(); |
297 | - $maxCol = $this->lastColumnIndex -1; |
|
297 | + $maxCol = $this->lastColumnIndex - 1; |
|
298 | 298 | for ($i = 0; $i <= $maxCol; ++$i) { |
299 | 299 | $hidden = 0; |
300 | 300 | $level = 0; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | $firstCellCoordinates = \PhpSpreadsheet\Cell::coordinateFromString($firstCell); // e.g. array(0, 1) |
547 | - $lastCellCoordinates = \PhpSpreadsheet\Cell::coordinateFromString($lastCell); // e.g. array(1, 6) |
|
547 | + $lastCellCoordinates = \PhpSpreadsheet\Cell::coordinateFromString($lastCell); // e.g. array(1, 6) |
|
548 | 548 | |
549 | 549 | return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, \PhpSpreadsheet\Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, \PhpSpreadsheet\Cell::columnIndexFromString($lastCellCoordinates[0]) - 1); |
550 | 550 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | |
562 | 562 | // Return data stored in memory |
563 | 563 | if (isset($this->_data)) { |
564 | - $tmp = $this->_data; |
|
564 | + $tmp = $this->_data; |
|
565 | 565 | unset($this->_data); |
566 | 566 | return $tmp; |
567 | 567 | } |
@@ -618,17 +618,17 @@ discard block |
||
618 | 618 | */ |
619 | 619 | private function writeNumber($row, $col, $num, $xfIndex) |
620 | 620 | { |
621 | - $record = 0x0203; // Record identifier |
|
622 | - $length = 0x000E; // Number of bytes to follow |
|
621 | + $record = 0x0203; // Record identifier |
|
622 | + $length = 0x000E; // Number of bytes to follow |
|
623 | 623 | |
624 | - $header = pack("vv", $record, $length); |
|
625 | - $data = pack("vvv", $row, $col, $xfIndex); |
|
626 | - $xl_double = pack("d", $num); |
|
624 | + $header = pack("vv", $record, $length); |
|
625 | + $data = pack("vvv", $row, $col, $xfIndex); |
|
626 | + $xl_double = pack("d", $num); |
|
627 | 627 | if (self::getByteOrder()) { // if it's Big Endian |
628 | 628 | $xl_double = strrev($xl_double); |
629 | 629 | } |
630 | 630 | |
631 | - $this->append($header.$data.$xl_double); |
|
631 | + $this->append($header . $data . $xl_double); |
|
632 | 632 | return(0); |
633 | 633 | } |
634 | 634 | |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | */ |
657 | 657 | private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) |
658 | 658 | { |
659 | - $record = 0x00FD; // Record identifier |
|
660 | - $length = 0x000A; // Bytes to follow |
|
659 | + $record = 0x00FD; // Record identifier |
|
660 | + $length = 0x000A; // Bytes to follow |
|
661 | 661 | $str = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeShort($str, $arrcRun); |
662 | 662 | |
663 | 663 | /* check if string is already present */ |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | } |
667 | 667 | $this->stringTotal++; |
668 | 668 | |
669 | - $header = pack('vv', $record, $length); |
|
670 | - $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]); |
|
671 | - $this->append($header.$data); |
|
669 | + $header = pack('vv', $record, $length); |
|
670 | + $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]); |
|
671 | + $this->append($header . $data); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | /** |
@@ -689,20 +689,20 @@ discard block |
||
689 | 689 | private function writeLabel($row, $col, $str, $xfIndex) |
690 | 690 | { |
691 | 691 | $strlen = strlen($str); |
692 | - $record = 0x0204; // Record identifier |
|
693 | - $length = 0x0008 + $strlen; // Bytes to follow |
|
692 | + $record = 0x0204; // Record identifier |
|
693 | + $length = 0x0008 + $strlen; // Bytes to follow |
|
694 | 694 | |
695 | 695 | $str_error = 0; |
696 | 696 | |
697 | 697 | if ($strlen > $this->xlsStringMaxLength) { // LABEL must be < 255 chars |
698 | - $str = substr($str, 0, $this->xlsStringMaxLength); |
|
698 | + $str = substr($str, 0, $this->xlsStringMaxLength); |
|
699 | 699 | $length = 0x0008 + $this->xlsStringMaxLength; |
700 | 700 | $strlen = $this->xlsStringMaxLength; |
701 | 701 | $str_error = -3; |
702 | 702 | } |
703 | 703 | |
704 | - $header = pack("vv", $record, $length); |
|
705 | - $data = pack("vvvv", $row, $col, $xfIndex, $strlen); |
|
704 | + $header = pack("vv", $record, $length); |
|
705 | + $data = pack("vvvv", $row, $col, $xfIndex, $strlen); |
|
706 | 706 | $this->append($header . $data . $str); |
707 | 707 | return($str_error); |
708 | 708 | } |
@@ -724,8 +724,8 @@ discard block |
||
724 | 724 | */ |
725 | 725 | private function writeLabelSst($row, $col, $str, $xfIndex) |
726 | 726 | { |
727 | - $record = 0x00FD; // Record identifier |
|
728 | - $length = 0x000A; // Bytes to follow |
|
727 | + $record = 0x00FD; // Record identifier |
|
728 | + $length = 0x000A; // Bytes to follow |
|
729 | 729 | |
730 | 730 | $str = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($str); |
731 | 731 | |
@@ -735,9 +735,9 @@ discard block |
||
735 | 735 | } |
736 | 736 | $this->stringTotal++; |
737 | 737 | |
738 | - $header = pack('vv', $record, $length); |
|
739 | - $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]); |
|
740 | - $this->append($header.$data); |
|
738 | + $header = pack('vv', $record, $length); |
|
739 | + $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]); |
|
740 | + $this->append($header . $data); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | /** |
@@ -750,14 +750,14 @@ discard block |
||
750 | 750 | */ |
751 | 751 | private function writeNote($row, $col, $note) |
752 | 752 | { |
753 | - $note_length = strlen($note); |
|
754 | - $record = 0x001C; // Record identifier |
|
755 | - $max_length = 2048; // Maximun length for a NOTE record |
|
753 | + $note_length = strlen($note); |
|
754 | + $record = 0x001C; // Record identifier |
|
755 | + $max_length = 2048; // Maximun length for a NOTE record |
|
756 | 756 | |
757 | 757 | // Length for this record is no more than 2048 + 6 |
758 | 758 | $length = 0x0006 + min($note_length, 2048); |
759 | 759 | $header = pack("vv", $record, $length); |
760 | - $data = pack("vvv", $row, $col, $note_length); |
|
760 | + $data = pack("vvv", $row, $col, $note_length); |
|
761 | 761 | $this->append($header . $data . substr($note, 0, 2048)); |
762 | 762 | |
763 | 763 | for ($i = $max_length; $i < $note_length; $i += $max_length) { |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $length = 0x0006 + strlen($chunk); |
766 | 766 | $header = pack("vv", $record, $length); |
767 | 767 | $data = pack("vvv", -1, 0, strlen($chunk)); |
768 | - $this->append($header.$data.$chunk); |
|
768 | + $this->append($header . $data . $chunk); |
|
769 | 769 | } |
770 | 770 | return(0); |
771 | 771 | } |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | */ |
789 | 789 | public function writeBlank($row, $col, $xfIndex) |
790 | 790 | { |
791 | - $record = 0x0201; // Record identifier |
|
792 | - $length = 0x0006; // Number of bytes to follow |
|
791 | + $record = 0x0201; // Record identifier |
|
792 | + $length = 0x0006; // Number of bytes to follow |
|
793 | 793 | |
794 | 794 | $header = pack("vv", $record, $length); |
795 | 795 | $data = pack("vvv", $row, $col, $xfIndex); |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | */ |
836 | 836 | private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue) |
837 | 837 | { |
838 | - $record = 0x0006; // Record identifier |
|
838 | + $record = 0x0006; // Record identifier |
|
839 | 839 | |
840 | 840 | // Initialize possible additional value for STRING record that should be written after the FORMULA record? |
841 | 841 | $stringValue = null; |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | // we use best effort to determine data type |
847 | 847 | if (is_bool($calculatedValue)) { |
848 | 848 | // Boolean value |
849 | - $num = pack('CCCvCv', 0x01, 0x00, (int)$calculatedValue, 0x00, 0x00, 0xFFFF); |
|
849 | + $num = pack('CCCvCv', 0x01, 0x00, (int) $calculatedValue, 0x00, 0x00, 0xFFFF); |
|
850 | 850 | } elseif (is_int($calculatedValue) || is_float($calculatedValue)) { |
851 | 851 | // Numeric value |
852 | 852 | $num = pack('d', $calculatedValue); |
@@ -870,8 +870,8 @@ discard block |
||
870 | 870 | $num = pack('d', 0x00); |
871 | 871 | } |
872 | 872 | |
873 | - $grbit = 0x03; // Option flags |
|
874 | - $unknown = 0x0000; // Must be zero |
|
873 | + $grbit = 0x03; // Option flags |
|
874 | + $unknown = 0x0000; // Must be zero |
|
875 | 875 | |
876 | 876 | // Strip the '=' or '@' sign at the beginning of the formula string |
877 | 877 | if ($formula{0} == '=') { |
@@ -887,8 +887,8 @@ discard block |
||
887 | 887 | $error = $this->parser->parse($formula); |
888 | 888 | $formula = $this->parser->toReversePolish(); |
889 | 889 | |
890 | - $formlen = strlen($formula); // Length of the binary string |
|
891 | - $length = 0x16 + $formlen; // Length of the record data |
|
890 | + $formlen = strlen($formula); // Length of the binary string |
|
891 | + $length = 0x16 + $formlen; // Length of the record data |
|
892 | 892 | |
893 | 893 | $header = pack("vv", $record, $length); |
894 | 894 | |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | */ |
915 | 915 | private function writeStringRecord($stringValue) |
916 | 916 | { |
917 | - $record = 0x0207; // Record identifier |
|
917 | + $record = 0x0207; // Record identifier |
|
918 | 918 | $data = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($stringValue); |
919 | 919 | |
920 | 920 | $length = strlen($data); |
@@ -992,8 +992,8 @@ discard block |
||
992 | 992 | */ |
993 | 993 | public function writeUrlWeb($row1, $col1, $row2, $col2, $url) |
994 | 994 | { |
995 | - $record = 0x01B8; // Record identifier |
|
996 | - $length = 0x00000; // Bytes to follow |
|
995 | + $record = 0x01B8; // Record identifier |
|
996 | + $length = 0x00000; // Bytes to follow |
|
997 | 997 | |
998 | 998 | // Pack the undocumented parts of the hyperlink stream |
999 | 999 | $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000"); |
@@ -1037,8 +1037,8 @@ discard block |
||
1037 | 1037 | */ |
1038 | 1038 | public function writeUrlInternal($row1, $col1, $row2, $col2, $url) |
1039 | 1039 | { |
1040 | - $record = 0x01B8; // Record identifier |
|
1041 | - $length = 0x00000; // Bytes to follow |
|
1040 | + $record = 0x01B8; // Record identifier |
|
1041 | + $length = 0x00000; // Bytes to follow |
|
1042 | 1042 | |
1043 | 1043 | // Strip URL type |
1044 | 1044 | $url = preg_replace('/^internal:/', '', $url); |
@@ -1096,8 +1096,8 @@ discard block |
||
1096 | 1096 | return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format)); |
1097 | 1097 | } |
1098 | 1098 | |
1099 | - $record = 0x01B8; // Record identifier |
|
1100 | - $length = 0x00000; // Bytes to follow |
|
1099 | + $record = 0x01B8; // Record identifier |
|
1100 | + $length = 0x00000; // Bytes to follow |
|
1101 | 1101 | |
1102 | 1102 | // Strip URL type and change Unix dir separator to Dos style (if needed) |
1103 | 1103 | // |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | if (preg_match('/^[A-Z]:/', $url)) { |
1114 | 1114 | $absolute = 0x02; // absolute path on Windows, e.g. C:\... |
1115 | 1115 | } |
1116 | - $link_type = 0x01 | $absolute; |
|
1116 | + $link_type = 0x01 | $absolute; |
|
1117 | 1117 | |
1118 | 1118 | // Determine if the link contains a sheet reference and change some of the |
1119 | 1119 | // parameters accordingly. |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | $dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0"; |
1136 | 1136 | |
1137 | 1137 | // Store the long dir name as a wchar string (non-null terminated) |
1138 | - $dir_long = $dir_long . "\0"; |
|
1138 | + $dir_long = $dir_long . "\0"; |
|
1139 | 1139 | |
1140 | 1140 | // Pack the lengths of the dir strings |
1141 | 1141 | $dir_short_len = pack("V", strlen($dir_short)); |
@@ -1149,15 +1149,15 @@ discard block |
||
1149 | 1149 | $unknown4 = pack("v", 0x03); |
1150 | 1150 | |
1151 | 1151 | // Pack the main data stream |
1152 | - $data = pack("vvvv", $row1, $row2, $col1, $col2) . |
|
1153 | - $unknown1 . |
|
1154 | - $link_type . |
|
1155 | - $unknown2 . |
|
1156 | - $up_count . |
|
1157 | - $dir_short_len. |
|
1158 | - $dir_short . |
|
1159 | - $unknown3 . |
|
1160 | - $stream_len ;/*. |
|
1152 | + $data = pack("vvvv", $row1, $row2, $col1, $col2) . |
|
1153 | + $unknown1 . |
|
1154 | + $link_type . |
|
1155 | + $unknown2 . |
|
1156 | + $up_count . |
|
1157 | + $dir_short_len . |
|
1158 | + $dir_short . |
|
1159 | + $unknown3 . |
|
1160 | + $stream_len; /*. |
|
1161 | 1161 | $dir_long_len . |
1162 | 1162 | $unknown4 . |
1163 | 1163 | $dir_long . |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | $header = pack("vv", $record, $length); |
1170 | 1170 | |
1171 | 1171 | // Write the packed data |
1172 | - $this->append($header. $data); |
|
1172 | + $this->append($header . $data); |
|
1173 | 1173 | return 0; |
1174 | 1174 | } |
1175 | 1175 | |
@@ -1185,14 +1185,14 @@ discard block |
||
1185 | 1185 | */ |
1186 | 1186 | private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0) |
1187 | 1187 | { |
1188 | - $record = 0x0208; // Record identifier |
|
1189 | - $length = 0x0010; // Number of bytes to follow |
|
1190 | - |
|
1191 | - $colMic = 0x0000; // First defined column |
|
1192 | - $colMac = 0x0000; // Last defined column |
|
1193 | - $irwMac = 0x0000; // Used by Excel to optimise loading |
|
1194 | - $reserved = 0x0000; // Reserved |
|
1195 | - $grbit = 0x0000; // Option flags |
|
1188 | + $record = 0x0208; // Record identifier |
|
1189 | + $length = 0x0010; // Number of bytes to follow |
|
1190 | + |
|
1191 | + $colMic = 0x0000; // First defined column |
|
1192 | + $colMac = 0x0000; // Last defined column |
|
1193 | + $irwMac = 0x0000; // Used by Excel to optimise loading |
|
1194 | + $reserved = 0x0000; // Reserved |
|
1195 | + $grbit = 0x0000; // Option flags |
|
1196 | 1196 | $ixfe = $xfIndex; |
1197 | 1197 | |
1198 | 1198 | if ($height < 0) { |
@@ -1201,9 +1201,9 @@ discard block |
||
1201 | 1201 | |
1202 | 1202 | // Use writeRow($row, null, $XF) to set XF format without setting height |
1203 | 1203 | if ($height != null) { |
1204 | - $miyRw = $height * 20; // row height |
|
1204 | + $miyRw = $height * 20; // row height |
|
1205 | 1205 | } else { |
1206 | - $miyRw = 0xff; // default row height is 256 |
|
1206 | + $miyRw = 0xff; // default row height is 256 |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | // Set the options flags. fUnsynced is used to show that the font and row |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | |
1227 | 1227 | $header = pack("vv", $record, $length); |
1228 | 1228 | $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac, $reserved, $grbit, $ixfe); |
1229 | - $this->append($header.$data); |
|
1229 | + $this->append($header . $data); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | /** |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | $data = pack('VVvvv', $this->firstRowIndex, $this->lastRowIndex + 1, $this->firstColumnIndex, $this->lastColumnIndex + 1, 0x0000); // reserved |
1241 | 1241 | |
1242 | 1242 | $header = pack("vv", $record, $length); |
1243 | - $this->append($header.$data); |
|
1243 | + $this->append($header . $data); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | /** |
@@ -1248,53 +1248,53 @@ discard block |
||
1248 | 1248 | */ |
1249 | 1249 | private function writeWindow2() |
1250 | 1250 | { |
1251 | - $record = 0x023E; // Record identifier |
|
1251 | + $record = 0x023E; // Record identifier |
|
1252 | 1252 | $length = 0x0012; |
1253 | 1253 | |
1254 | - $grbit = 0x00B6; // Option flags |
|
1255 | - $rwTop = 0x0000; // Top row visible in window |
|
1256 | - $colLeft = 0x0000; // Leftmost column visible in window |
|
1254 | + $grbit = 0x00B6; // Option flags |
|
1255 | + $rwTop = 0x0000; // Top row visible in window |
|
1256 | + $colLeft = 0x0000; // Leftmost column visible in window |
|
1257 | 1257 | |
1258 | 1258 | |
1259 | 1259 | // The options flags that comprise $grbit |
1260 | - $fDspFmla = 0; // 0 - bit |
|
1260 | + $fDspFmla = 0; // 0 - bit |
|
1261 | 1261 | $fDspGrid = $this->phpSheet->getShowGridlines() ? 1 : 0; // 1 |
1262 | 1262 | $fDspRwCol = $this->phpSheet->getShowRowColHeaders() ? 1 : 0; // 2 |
1263 | - $fFrozen = $this->phpSheet->getFreezePane() ? 1 : 0; // 3 |
|
1264 | - $fDspZeros = 1; // 4 |
|
1265 | - $fDefaultHdr = 1; // 5 |
|
1263 | + $fFrozen = $this->phpSheet->getFreezePane() ? 1 : 0; // 3 |
|
1264 | + $fDspZeros = 1; // 4 |
|
1265 | + $fDefaultHdr = 1; // 5 |
|
1266 | 1266 | $fArabic = $this->phpSheet->getRightToLeft() ? 1 : 0; // 6 |
1267 | - $fDspGuts = $this->outlineOn; // 7 |
|
1268 | - $fFrozenNoSplit = 0; // 0 - bit |
|
1267 | + $fDspGuts = $this->outlineOn; // 7 |
|
1268 | + $fFrozenNoSplit = 0; // 0 - bit |
|
1269 | 1269 | // no support in PhpSpreadsheet for selected sheet, therefore sheet is only selected if it is the active sheet |
1270 | 1270 | $fSelected = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0; |
1271 | - $fPaged = 1; // 2 |
|
1271 | + $fPaged = 1; // 2 |
|
1272 | 1272 | $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === \PhpSpreadsheet\Worksheet\SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; |
1273 | 1273 | |
1274 | 1274 | $grbit = $fDspFmla; |
1275 | - $grbit |= $fDspGrid << 1; |
|
1276 | - $grbit |= $fDspRwCol << 2; |
|
1277 | - $grbit |= $fFrozen << 3; |
|
1278 | - $grbit |= $fDspZeros << 4; |
|
1279 | - $grbit |= $fDefaultHdr << 5; |
|
1280 | - $grbit |= $fArabic << 6; |
|
1281 | - $grbit |= $fDspGuts << 7; |
|
1275 | + $grbit |= $fDspGrid << 1; |
|
1276 | + $grbit |= $fDspRwCol << 2; |
|
1277 | + $grbit |= $fFrozen << 3; |
|
1278 | + $grbit |= $fDspZeros << 4; |
|
1279 | + $grbit |= $fDefaultHdr << 5; |
|
1280 | + $grbit |= $fArabic << 6; |
|
1281 | + $grbit |= $fDspGuts << 7; |
|
1282 | 1282 | $grbit |= $fFrozenNoSplit << 8; |
1283 | - $grbit |= $fSelected << 9; |
|
1284 | - $grbit |= $fPaged << 10; |
|
1283 | + $grbit |= $fSelected << 9; |
|
1284 | + $grbit |= $fPaged << 10; |
|
1285 | 1285 | $grbit |= $fPageBreakPreview << 11; |
1286 | 1286 | |
1287 | 1287 | $header = pack("vv", $record, $length); |
1288 | 1288 | $data = pack("vvv", $grbit, $rwTop, $colLeft); |
1289 | 1289 | |
1290 | 1290 | // FIXME !!! |
1291 | - $rgbHdr = 0x0040; // Row/column heading and gridline color index |
|
1291 | + $rgbHdr = 0x0040; // Row/column heading and gridline color index |
|
1292 | 1292 | $zoom_factor_page_break = ($fPageBreakPreview ? $this->phpSheet->getSheetView()->getZoomScale() : 0x0000); |
1293 | - $zoom_factor_normal = $this->phpSheet->getSheetView()->getZoomScaleNormal(); |
|
1293 | + $zoom_factor_normal = $this->phpSheet->getSheetView()->getZoomScaleNormal(); |
|
1294 | 1294 | |
1295 | 1295 | $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000); |
1296 | 1296 | |
1297 | - $this->append($header.$data); |
|
1297 | + $this->append($header . $data); |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | /** |
@@ -1311,8 +1311,8 @@ discard block |
||
1311 | 1311 | // convert to twips |
1312 | 1312 | $defaultRowHeight = (int) 20 * $defaultRowHeight; |
1313 | 1313 | |
1314 | - $record = 0x0225; // Record identifier |
|
1315 | - $length = 0x0004; // Number of bytes to follow |
|
1314 | + $record = 0x0225; // Record identifier |
|
1315 | + $length = 0x0004; // Number of bytes to follow |
|
1316 | 1316 | |
1317 | 1317 | $header = pack("vv", $record, $length); |
1318 | 1318 | $data = pack("vv", 1, $defaultRowHeight); |
@@ -1326,8 +1326,8 @@ discard block |
||
1326 | 1326 | { |
1327 | 1327 | $defaultColWidth = 8; |
1328 | 1328 | |
1329 | - $record = 0x0055; // Record identifier |
|
1330 | - $length = 0x0002; // Number of bytes to follow |
|
1329 | + $record = 0x0055; // Record identifier |
|
1330 | + $length = 0x0002; // Number of bytes to follow |
|
1331 | 1331 | |
1332 | 1332 | $header = pack("vv", $record, $length); |
1333 | 1333 | $data = pack("v", $defaultColWidth); |
@@ -1376,20 +1376,20 @@ discard block |
||
1376 | 1376 | } else { |
1377 | 1377 | $level = 0; |
1378 | 1378 | } |
1379 | - $record = 0x007D; // Record identifier |
|
1380 | - $length = 0x000C; // Number of bytes to follow |
|
1379 | + $record = 0x007D; // Record identifier |
|
1380 | + $length = 0x000C; // Number of bytes to follow |
|
1381 | 1381 | |
1382 | - $coldx *= 256; // Convert to units of 1/256 of a char |
|
1382 | + $coldx *= 256; // Convert to units of 1/256 of a char |
|
1383 | 1383 | |
1384 | 1384 | $ixfe = $xfIndex; |
1385 | - $reserved = 0x0000; // Reserved |
|
1385 | + $reserved = 0x0000; // Reserved |
|
1386 | 1386 | |
1387 | 1387 | $level = max(0, min($level, 7)); |
1388 | 1388 | $grbit |= $level << 8; |
1389 | 1389 | |
1390 | 1390 | $header = pack("vv", $record, $length); |
1391 | 1391 | $data = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved); |
1392 | - $this->append($header.$data); |
|
1392 | + $this->append($header . $data); |
|
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | /** |
@@ -1423,20 +1423,20 @@ discard block |
||
1423 | 1423 | $rwFirst = min($rwFirst, 65535); |
1424 | 1424 | $rwLast = min($rwLast, 65535); |
1425 | 1425 | |
1426 | - $record = 0x001D; // Record identifier |
|
1427 | - $length = 0x000F; // Number of bytes to follow |
|
1426 | + $record = 0x001D; // Record identifier |
|
1427 | + $length = 0x000F; // Number of bytes to follow |
|
1428 | 1428 | |
1429 | - $pnn = $this->activePane; // Pane position |
|
1430 | - $rwAct = $rwFirst; // Active row |
|
1431 | - $colAct = $colFirst; // Active column |
|
1432 | - $irefAct = 0; // Active cell ref |
|
1433 | - $cref = 1; // Number of refs |
|
1429 | + $pnn = $this->activePane; // Pane position |
|
1430 | + $rwAct = $rwFirst; // Active row |
|
1431 | + $colAct = $colFirst; // Active column |
|
1432 | + $irefAct = 0; // Active cell ref |
|
1433 | + $cref = 1; // Number of refs |
|
1434 | 1434 | |
1435 | 1435 | if (!isset($rwLast)) { |
1436 | - $rwLast = $rwFirst; // Last row in reference |
|
1436 | + $rwLast = $rwFirst; // Last row in reference |
|
1437 | 1437 | } |
1438 | 1438 | if (!isset($colLast)) { |
1439 | - $colLast = $colFirst; // Last col in reference |
|
1439 | + $colLast = $colFirst; // Last col in reference |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | // Swap last row/col for first row/col as necessary |
@@ -1543,21 +1543,21 @@ discard block |
||
1543 | 1543 | $record = 0x0867; |
1544 | 1544 | |
1545 | 1545 | // prepare options |
1546 | - $options = (int) !$this->phpSheet->getProtection()->getObjects() |
|
1547 | - | (int) !$this->phpSheet->getProtection()->getScenarios() << 1 |
|
1548 | - | (int) !$this->phpSheet->getProtection()->getFormatCells() << 2 |
|
1549 | - | (int) !$this->phpSheet->getProtection()->getFormatColumns() << 3 |
|
1550 | - | (int) !$this->phpSheet->getProtection()->getFormatRows() << 4 |
|
1551 | - | (int) !$this->phpSheet->getProtection()->getInsertColumns() << 5 |
|
1552 | - | (int) !$this->phpSheet->getProtection()->getInsertRows() << 6 |
|
1553 | - | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks() << 7 |
|
1554 | - | (int) !$this->phpSheet->getProtection()->getDeleteColumns() << 8 |
|
1555 | - | (int) !$this->phpSheet->getProtection()->getDeleteRows() << 9 |
|
1556 | - | (int) !$this->phpSheet->getProtection()->getSelectLockedCells() << 10 |
|
1557 | - | (int) !$this->phpSheet->getProtection()->getSort() << 11 |
|
1558 | - | (int) !$this->phpSheet->getProtection()->getAutoFilter() << 12 |
|
1559 | - | (int) !$this->phpSheet->getProtection()->getPivotTables() << 13 |
|
1560 | - | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14 ; |
|
1546 | + $options = (int) !$this->phpSheet->getProtection()->getObjects() |
|
1547 | + | (int) !$this->phpSheet->getProtection()->getScenarios() << 1 |
|
1548 | + | (int) !$this->phpSheet->getProtection()->getFormatCells() << 2 |
|
1549 | + | (int) !$this->phpSheet->getProtection()->getFormatColumns() << 3 |
|
1550 | + | (int) !$this->phpSheet->getProtection()->getFormatRows() << 4 |
|
1551 | + | (int) !$this->phpSheet->getProtection()->getInsertColumns() << 5 |
|
1552 | + | (int) !$this->phpSheet->getProtection()->getInsertRows() << 6 |
|
1553 | + | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks() << 7 |
|
1554 | + | (int) !$this->phpSheet->getProtection()->getDeleteColumns() << 8 |
|
1555 | + | (int) !$this->phpSheet->getProtection()->getDeleteRows() << 9 |
|
1556 | + | (int) !$this->phpSheet->getProtection()->getSelectLockedCells() << 10 |
|
1557 | + | (int) !$this->phpSheet->getProtection()->getSort() << 11 |
|
1558 | + | (int) !$this->phpSheet->getProtection()->getAutoFilter() << 12 |
|
1559 | + | (int) !$this->phpSheet->getProtection()->getPivotTables() << 13 |
|
1560 | + | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14; |
|
1561 | 1561 | |
1562 | 1562 | // record data |
1563 | 1563 | $recordData = pack( |
@@ -1620,7 +1620,7 @@ discard block |
||
1620 | 1620 | |
1621 | 1621 | $length = strlen($recordData); |
1622 | 1622 | |
1623 | - $record = 0x0868; // Record identifier |
|
1623 | + $record = 0x0868; // Record identifier |
|
1624 | 1624 | $header = pack("vv", $record, $length); |
1625 | 1625 | $this->append($header . $recordData); |
1626 | 1626 | } |
@@ -1640,8 +1640,8 @@ discard block |
||
1640 | 1640 | */ |
1641 | 1641 | private function writeExterncount($count) |
1642 | 1642 | { |
1643 | - $record = 0x0016; // Record identifier |
|
1644 | - $length = 0x0002; // Number of bytes to follow |
|
1643 | + $record = 0x0016; // Record identifier |
|
1644 | + $length = 0x0002; // Number of bytes to follow |
|
1645 | 1645 | |
1646 | 1646 | $header = pack("vv", $record, $length); |
1647 | 1647 | $data = pack("v", $count); |
@@ -1658,20 +1658,20 @@ discard block |
||
1658 | 1658 | */ |
1659 | 1659 | private function writeExternsheet($sheetname) |
1660 | 1660 | { |
1661 | - $record = 0x0017; // Record identifier |
|
1661 | + $record = 0x0017; // Record identifier |
|
1662 | 1662 | |
1663 | 1663 | // References to the current sheet are encoded differently to references to |
1664 | 1664 | // external sheets. |
1665 | 1665 | // |
1666 | 1666 | if ($this->phpSheet->getTitle() == $sheetname) { |
1667 | 1667 | $sheetname = ''; |
1668 | - $length = 0x02; // The following 2 bytes |
|
1669 | - $cch = 1; // The following byte |
|
1670 | - $rgch = 0x02; // Self reference |
|
1668 | + $length = 0x02; // The following 2 bytes |
|
1669 | + $cch = 1; // The following byte |
|
1670 | + $rgch = 0x02; // Self reference |
|
1671 | 1671 | } else { |
1672 | 1672 | $length = 0x02 + strlen($sheetname); |
1673 | 1673 | $cch = strlen($sheetname); |
1674 | - $rgch = 0x03; // Reference to a sheet in the current workbook |
|
1674 | + $rgch = 0x03; // Reference to a sheet in the current workbook |
|
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | $header = pack("vv", $record, $length); |
@@ -1706,8 +1706,8 @@ discard block |
||
1706 | 1706 | } else { |
1707 | 1707 | $pnnAct = null; |
1708 | 1708 | } |
1709 | - $record = 0x0041; // Record identifier |
|
1710 | - $length = 0x000A; // Number of bytes to follow |
|
1709 | + $record = 0x0041; // Record identifier |
|
1710 | + $length = 0x000A; // Number of bytes to follow |
|
1711 | 1711 | |
1712 | 1712 | // Code specific to frozen or thawed panes. |
1713 | 1713 | if ($this->phpSheet->getFreezePane()) { |
@@ -1732,8 +1732,8 @@ discard block |
||
1732 | 1732 | // The default column width is 8.43 |
1733 | 1733 | // The following slope and intersection values were interpolated. |
1734 | 1734 | // |
1735 | - $y = 20*$y + 255; |
|
1736 | - $x = 113.879*$x + 390; |
|
1735 | + $y = 20 * $y + 255; |
|
1736 | + $x = 113.879 * $x + 390; |
|
1737 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | |
@@ -1767,47 +1767,47 @@ discard block |
||
1767 | 1767 | */ |
1768 | 1768 | private function writeSetup() |
1769 | 1769 | { |
1770 | - $record = 0x00A1; // Record identifier |
|
1771 | - $length = 0x0022; // Number of bytes to follow |
|
1770 | + $record = 0x00A1; // Record identifier |
|
1771 | + $length = 0x0022; // Number of bytes to follow |
|
1772 | 1772 | |
1773 | - $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size |
|
1773 | + $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size |
|
1774 | 1774 | |
1775 | 1775 | $iScale = $this->phpSheet->getPageSetup()->getScale() ? |
1776 | - $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor |
|
1776 | + $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor |
|
1777 | 1777 | |
1778 | - $iPageStart = 0x01; // Starting page number |
|
1779 | - $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide |
|
1780 | - $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high |
|
1781 | - $grbit = 0x00; // Option flags |
|
1782 | - $iRes = 0x0258; // Print resolution |
|
1783 | - $iVRes = 0x0258; // Vertical print resolution |
|
1778 | + $iPageStart = 0x01; // Starting page number |
|
1779 | + $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide |
|
1780 | + $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high |
|
1781 | + $grbit = 0x00; // Option flags |
|
1782 | + $iRes = 0x0258; // Print resolution |
|
1783 | + $iVRes = 0x0258; // Vertical print resolution |
|
1784 | 1784 | |
1785 | - $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin |
|
1785 | + $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin |
|
1786 | 1786 | |
1787 | - $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin |
|
1788 | - $iCopies = 0x01; // Number of copies |
|
1787 | + $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin |
|
1788 | + $iCopies = 0x01; // Number of copies |
|
1789 | 1789 | |
1790 | - $fLeftToRight = 0x0; // Print over then down |
|
1790 | + $fLeftToRight = 0x0; // Print over then down |
|
1791 | 1791 | |
1792 | 1792 | // Page orientation |
1793 | 1793 | $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == \PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE) ? |
1794 | 1794 | 0x0 : 0x1; |
1795 | 1795 | |
1796 | - $fNoPls = 0x0; // Setup not read from printer |
|
1797 | - $fNoColor = 0x0; // Print black and white |
|
1798 | - $fDraft = 0x0; // Print draft quality |
|
1799 | - $fNotes = 0x0; // Print notes |
|
1800 | - $fNoOrient = 0x0; // Orientation not set |
|
1801 | - $fUsePage = 0x0; // Use custom starting page |
|
1796 | + $fNoPls = 0x0; // Setup not read from printer |
|
1797 | + $fNoColor = 0x0; // Print black and white |
|
1798 | + $fDraft = 0x0; // Print draft quality |
|
1799 | + $fNotes = 0x0; // Print notes |
|
1800 | + $fNoOrient = 0x0; // Orientation not set |
|
1801 | + $fUsePage = 0x0; // Use custom starting page |
|
1802 | 1802 | |
1803 | 1803 | $grbit = $fLeftToRight; |
1804 | - $grbit |= $fLandscape << 1; |
|
1805 | - $grbit |= $fNoPls << 2; |
|
1806 | - $grbit |= $fNoColor << 3; |
|
1807 | - $grbit |= $fDraft << 4; |
|
1808 | - $grbit |= $fNotes << 5; |
|
1809 | - $grbit |= $fNoOrient << 6; |
|
1810 | - $grbit |= $fUsePage << 7; |
|
1804 | + $grbit |= $fLandscape << 1; |
|
1805 | + $grbit |= $fNoPls << 2; |
|
1806 | + $grbit |= $fNoColor << 3; |
|
1807 | + $grbit |= $fDraft << 4; |
|
1808 | + $grbit |= $fNotes << 5; |
|
1809 | + $grbit |= $fNoOrient << 6; |
|
1810 | + $grbit |= $fUsePage << 7; |
|
1811 | 1811 | |
1812 | 1812 | $numHdr = pack("d", $numHdr); |
1813 | 1813 | $numFtr = pack("d", $numFtr); |
@@ -1818,7 +1818,7 @@ discard block |
||
1818 | 1818 | |
1819 | 1819 | $header = pack("vv", $record, $length); |
1820 | 1820 | $data1 = pack("vvvvvvvv", $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes); |
1821 | - $data2 = $numHdr.$numFtr; |
|
1821 | + $data2 = $numHdr . $numFtr; |
|
1822 | 1822 | $data3 = pack("v", $iCopies); |
1823 | 1823 | $this->append($header . $data1 . $data2 . $data3); |
1824 | 1824 | } |
@@ -1828,7 +1828,7 @@ discard block |
||
1828 | 1828 | */ |
1829 | 1829 | private function writeHeader() |
1830 | 1830 | { |
1831 | - $record = 0x0014; // Record identifier |
|
1831 | + $record = 0x0014; // Record identifier |
|
1832 | 1832 | |
1833 | 1833 | /* removing for now |
1834 | 1834 | // need to fix character count (multibyte!) |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | $recordData = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader()); |
1843 | 1843 | $length = strlen($recordData); |
1844 | 1844 | |
1845 | - $header = pack("vv", $record, $length); |
|
1845 | + $header = pack("vv", $record, $length); |
|
1846 | 1846 | |
1847 | 1847 | $this->append($header . $recordData); |
1848 | 1848 | } |
@@ -1852,7 +1852,7 @@ discard block |
||
1852 | 1852 | */ |
1853 | 1853 | private function writeFooter() |
1854 | 1854 | { |
1855 | - $record = 0x0015; // Record identifier |
|
1855 | + $record = 0x0015; // Record identifier |
|
1856 | 1856 | |
1857 | 1857 | /* removing for now |
1858 | 1858 | // need to fix character count (multibyte!) |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | $recordData = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter()); |
1867 | 1867 | $length = strlen($recordData); |
1868 | 1868 | |
1869 | - $header = pack("vv", $record, $length); |
|
1869 | + $header = pack("vv", $record, $length); |
|
1870 | 1870 | |
1871 | 1871 | $this->append($header . $recordData); |
1872 | 1872 | } |
@@ -1878,15 +1878,15 @@ discard block |
||
1878 | 1878 | */ |
1879 | 1879 | private function writeHcenter() |
1880 | 1880 | { |
1881 | - $record = 0x0083; // Record identifier |
|
1882 | - $length = 0x0002; // Bytes to follow |
|
1881 | + $record = 0x0083; // Record identifier |
|
1882 | + $length = 0x0002; // Bytes to follow |
|
1883 | 1883 | |
1884 | - $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering |
|
1884 | + $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering |
|
1885 | 1885 | |
1886 | 1886 | $header = pack("vv", $record, $length); |
1887 | 1887 | $data = pack("v", $fHCenter); |
1888 | 1888 | |
1889 | - $this->append($header.$data); |
|
1889 | + $this->append($header . $data); |
|
1890 | 1890 | } |
1891 | 1891 | |
1892 | 1892 | /** |
@@ -1894,10 +1894,10 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | private function writeVcenter() |
1896 | 1896 | { |
1897 | - $record = 0x0084; // Record identifier |
|
1898 | - $length = 0x0002; // Bytes to follow |
|
1897 | + $record = 0x0084; // Record identifier |
|
1898 | + $length = 0x0002; // Bytes to follow |
|
1899 | 1899 | |
1900 | - $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering |
|
1900 | + $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering |
|
1901 | 1901 | |
1902 | 1902 | $header = pack("vv", $record, $length); |
1903 | 1903 | $data = pack("v", $fVCenter); |
@@ -1909,10 +1909,10 @@ discard block |
||
1909 | 1909 | */ |
1910 | 1910 | private function writeMarginLeft() |
1911 | 1911 | { |
1912 | - $record = 0x0026; // Record identifier |
|
1913 | - $length = 0x0008; // Bytes to follow |
|
1912 | + $record = 0x0026; // Record identifier |
|
1913 | + $length = 0x0008; // Bytes to follow |
|
1914 | 1914 | |
1915 | - $margin = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches |
|
1915 | + $margin = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches |
|
1916 | 1916 | |
1917 | 1917 | $header = pack("vv", $record, $length); |
1918 | 1918 | $data = pack("d", $margin); |
@@ -1928,10 +1928,10 @@ discard block |
||
1928 | 1928 | */ |
1929 | 1929 | private function writeMarginRight() |
1930 | 1930 | { |
1931 | - $record = 0x0027; // Record identifier |
|
1932 | - $length = 0x0008; // Bytes to follow |
|
1931 | + $record = 0x0027; // Record identifier |
|
1932 | + $length = 0x0008; // Bytes to follow |
|
1933 | 1933 | |
1934 | - $margin = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches |
|
1934 | + $margin = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches |
|
1935 | 1935 | |
1936 | 1936 | $header = pack("vv", $record, $length); |
1937 | 1937 | $data = pack("d", $margin); |
@@ -1947,10 +1947,10 @@ discard block |
||
1947 | 1947 | */ |
1948 | 1948 | private function writeMarginTop() |
1949 | 1949 | { |
1950 | - $record = 0x0028; // Record identifier |
|
1951 | - $length = 0x0008; // Bytes to follow |
|
1950 | + $record = 0x0028; // Record identifier |
|
1951 | + $length = 0x0008; // Bytes to follow |
|
1952 | 1952 | |
1953 | - $margin = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches |
|
1953 | + $margin = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches |
|
1954 | 1954 | |
1955 | 1955 | $header = pack("vv", $record, $length); |
1956 | 1956 | $data = pack("d", $margin); |
@@ -1966,10 +1966,10 @@ discard block |
||
1966 | 1966 | */ |
1967 | 1967 | private function writeMarginBottom() |
1968 | 1968 | { |
1969 | - $record = 0x0029; // Record identifier |
|
1970 | - $length = 0x0008; // Bytes to follow |
|
1969 | + $record = 0x0029; // Record identifier |
|
1970 | + $length = 0x0008; // Bytes to follow |
|
1971 | 1971 | |
1972 | - $margin = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches |
|
1972 | + $margin = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches |
|
1973 | 1973 | |
1974 | 1974 | $header = pack("vv", $record, $length); |
1975 | 1975 | $data = pack("d", $margin); |
@@ -1985,10 +1985,10 @@ discard block |
||
1985 | 1985 | */ |
1986 | 1986 | private function writePrintHeaders() |
1987 | 1987 | { |
1988 | - $record = 0x002a; // Record identifier |
|
1989 | - $length = 0x0002; // Bytes to follow |
|
1988 | + $record = 0x002a; // Record identifier |
|
1989 | + $length = 0x0002; // Bytes to follow |
|
1990 | 1990 | |
1991 | - $fPrintRwCol = $this->_print_headers; // Boolean flag |
|
1991 | + $fPrintRwCol = $this->_print_headers; // Boolean flag |
|
1992 | 1992 | |
1993 | 1993 | $header = pack("vv", $record, $length); |
1994 | 1994 | $data = pack("v", $fPrintRwCol); |
@@ -2001,13 +2001,13 @@ discard block |
||
2001 | 2001 | */ |
2002 | 2002 | private function writePrintGridlines() |
2003 | 2003 | { |
2004 | - $record = 0x002b; // Record identifier |
|
2005 | - $length = 0x0002; // Bytes to follow |
|
2004 | + $record = 0x002b; // Record identifier |
|
2005 | + $length = 0x0002; // Bytes to follow |
|
2006 | 2006 | |
2007 | - $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag |
|
2007 | + $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag |
|
2008 | 2008 | |
2009 | 2009 | $header = pack("vv", $record, $length); |
2010 | - $data = pack("v", $fPrintGrid); |
|
2010 | + $data = pack("v", $fPrintGrid); |
|
2011 | 2011 | $this->append($header . $data); |
2012 | 2012 | } |
2013 | 2013 | |
@@ -2017,10 +2017,10 @@ discard block |
||
2017 | 2017 | */ |
2018 | 2018 | private function writeGridset() |
2019 | 2019 | { |
2020 | - $record = 0x0082; // Record identifier |
|
2021 | - $length = 0x0002; // Bytes to follow |
|
2020 | + $record = 0x0082; // Record identifier |
|
2021 | + $length = 0x0002; // Bytes to follow |
|
2022 | 2022 | |
2023 | - $fGridSet = !$this->phpSheet->getPrintGridlines(); // Boolean flag |
|
2023 | + $fGridSet = !$this->phpSheet->getPrintGridlines(); // Boolean flag |
|
2024 | 2024 | |
2025 | 2025 | $header = pack("vv", $record, $length); |
2026 | 2026 | $data = pack("v", $fGridSet); |
@@ -2032,8 +2032,8 @@ discard block |
||
2032 | 2032 | */ |
2033 | 2033 | private function writeAutoFilterInfo() |
2034 | 2034 | { |
2035 | - $record = 0x009D; // Record identifier |
|
2036 | - $length = 0x0002; // Bytes to follow |
|
2035 | + $record = 0x009D; // Record identifier |
|
2036 | + $length = 0x0002; // Bytes to follow |
|
2037 | 2037 | |
2038 | 2038 | $rangeBounds = \PhpSpreadsheet\Cell::rangeBoundaries($this->phpSheet->getAutoFilter()->getRange()); |
2039 | 2039 | $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0]; |
@@ -2052,11 +2052,11 @@ discard block |
||
2052 | 2052 | */ |
2053 | 2053 | private function writeGuts() |
2054 | 2054 | { |
2055 | - $record = 0x0080; // Record identifier |
|
2056 | - $length = 0x0008; // Bytes to follow |
|
2055 | + $record = 0x0080; // Record identifier |
|
2056 | + $length = 0x0008; // Bytes to follow |
|
2057 | 2057 | |
2058 | - $dxRwGut = 0x0000; // Size of row gutter |
|
2059 | - $dxColGut = 0x0000; // Size of col gutter |
|
2058 | + $dxRwGut = 0x0000; // Size of row gutter |
|
2059 | + $dxColGut = 0x0000; // Size of col gutter |
|
2060 | 2060 | |
2061 | 2061 | // determine maximum row outline level |
2062 | 2062 | $maxRowOutlineLevel = 0; |
@@ -2064,7 +2064,7 @@ discard block |
||
2064 | 2064 | $maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel()); |
2065 | 2065 | } |
2066 | 2066 | |
2067 | - $col_level = 0; |
|
2067 | + $col_level = 0; |
|
2068 | 2068 | |
2069 | 2069 | // Calculate the maximum column outline level. The equivalent calculation |
2070 | 2070 | // for the row outline level is carried out in writeRow(). |
@@ -2087,7 +2087,7 @@ discard block |
||
2087 | 2087 | $header = pack("vv", $record, $length); |
2088 | 2088 | $data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level); |
2089 | 2089 | |
2090 | - $this->append($header.$data); |
|
2090 | + $this->append($header . $data); |
|
2091 | 2091 | } |
2092 | 2092 | |
2093 | 2093 | /** |
@@ -2096,15 +2096,15 @@ discard block |
||
2096 | 2096 | */ |
2097 | 2097 | private function writeWsbool() |
2098 | 2098 | { |
2099 | - $record = 0x0081; // Record identifier |
|
2100 | - $length = 0x0002; // Bytes to follow |
|
2099 | + $record = 0x0081; // Record identifier |
|
2100 | + $length = 0x0002; // Bytes to follow |
|
2101 | 2101 | $grbit = 0x0000; |
2102 | 2102 | |
2103 | 2103 | // The only option that is of interest is the flag for fit to page. So we |
2104 | 2104 | // set all the options in one go. |
2105 | 2105 | // |
2106 | 2106 | // Set the option flags |
2107 | - $grbit |= 0x0001; // Auto page breaks visible |
|
2107 | + $grbit |= 0x0001; // Auto page breaks visible |
|
2108 | 2108 | if ($this->outlineStyle) { |
2109 | 2109 | $grbit |= 0x0020; // Auto outline styles |
2110 | 2110 | } |
@@ -2164,9 +2164,9 @@ discard block |
||
2164 | 2164 | array_shift($hbreaks); |
2165 | 2165 | } |
2166 | 2166 | |
2167 | - $record = 0x001b; // Record identifier |
|
2168 | - $cbrk = count($hbreaks); // Number of page breaks |
|
2169 | - $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2167 | + $record = 0x001b; // Record identifier |
|
2168 | + $cbrk = count($hbreaks); // Number of page breaks |
|
2169 | + $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2170 | 2170 | |
2171 | 2171 | $header = pack("vv", $record, $length); |
2172 | 2172 | $data = pack("v", $cbrk); |
@@ -2191,9 +2191,9 @@ discard block |
||
2191 | 2191 | array_shift($vbreaks); |
2192 | 2192 | } |
2193 | 2193 | |
2194 | - $record = 0x001a; // Record identifier |
|
2195 | - $cbrk = count($vbreaks); // Number of page breaks |
|
2196 | - $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2194 | + $record = 0x001a; // Record identifier |
|
2195 | + $cbrk = count($vbreaks); // Number of page breaks |
|
2196 | + $length = 2 + 6 * $cbrk; // Bytes to follow |
|
2197 | 2197 | |
2198 | 2198 | $header = pack("vv", $record, $length); |
2199 | 2199 | $data = pack("v", $cbrk); |
@@ -2217,15 +2217,15 @@ discard block |
||
2217 | 2217 | return; |
2218 | 2218 | } |
2219 | 2219 | |
2220 | - $record = 0x0012; // Record identifier |
|
2221 | - $length = 0x0002; // Bytes to follow |
|
2220 | + $record = 0x0012; // Record identifier |
|
2221 | + $length = 0x0002; // Bytes to follow |
|
2222 | 2222 | |
2223 | - $fLock = 1; // Worksheet is protected |
|
2223 | + $fLock = 1; // Worksheet is protected |
|
2224 | 2224 | |
2225 | - $header = pack("vv", $record, $length); |
|
2226 | - $data = pack("v", $fLock); |
|
2225 | + $header = pack("vv", $record, $length); |
|
2226 | + $data = pack("v", $fLock); |
|
2227 | 2227 | |
2228 | - $this->append($header.$data); |
|
2228 | + $this->append($header . $data); |
|
2229 | 2229 | } |
2230 | 2230 | |
2231 | 2231 | /** |
@@ -2286,10 +2286,10 @@ discard block |
||
2286 | 2286 | return; |
2287 | 2287 | } |
2288 | 2288 | |
2289 | - $record = 0x0013; // Record identifier |
|
2290 | - $length = 0x0002; // Bytes to follow |
|
2289 | + $record = 0x0013; // Record identifier |
|
2290 | + $length = 0x0002; // Bytes to follow |
|
2291 | 2291 | |
2292 | - $wPassword = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password |
|
2292 | + $wPassword = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password |
|
2293 | 2293 | |
2294 | 2294 | $header = pack("vv", $record, $length); |
2295 | 2295 | $data = pack("v", $wPassword); |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | $lcb = $size; |
2330 | 2330 | |
2331 | 2331 | $header = pack("vvvvV", $record, $length, $cf, $env, $lcb); |
2332 | - $this->append($header.$data); |
|
2332 | + $this->append($header . $data); |
|
2333 | 2333 | } |
2334 | 2334 | |
2335 | 2335 | /** |
@@ -2386,8 +2386,8 @@ discard block |
||
2386 | 2386 | public function positionImage($col_start, $row_start, $x1, $y1, $width, $height) |
2387 | 2387 | { |
2388 | 2388 | // Initialise end cell to the same as the start cell |
2389 | - $col_end = $col_start; // Col containing lower right corner of object |
|
2390 | - $row_end = $row_start; // Row containing bottom right corner of object |
|
2389 | + $col_end = $col_start; // Col containing lower right corner of object |
|
2390 | + $row_end = $row_start; // Row containing bottom right corner of object |
|
2391 | 2391 | |
2392 | 2392 | // Zero the specified offset if greater than the cell dimensions |
2393 | 2393 | if ($x1 >= \PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_start))) { |
@@ -2397,8 +2397,8 @@ discard block |
||
2397 | 2397 | $y1 = 0; |
2398 | 2398 | } |
2399 | 2399 | |
2400 | - $width = $width + $x1 -1; |
|
2401 | - $height = $height + $y1 -1; |
|
2400 | + $width = $width + $x1 - 1; |
|
2401 | + $height = $height + $y1 - 1; |
|
2402 | 2402 | |
2403 | 2403 | // Subtract the underlying cell widths to find the end cell of the image |
2404 | 2404 | while ($width >= \PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_end))) { |
@@ -2418,21 +2418,21 @@ discard block |
||
2418 | 2418 | if (\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_start)) == 0) { |
2419 | 2419 | return; |
2420 | 2420 | } |
2421 | - if (\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) == 0) { |
|
2421 | + if (\PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) == 0) { |
|
2422 | 2422 | return; |
2423 | 2423 | } |
2424 | 2424 | if (\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1) == 0) { |
2425 | 2425 | return; |
2426 | 2426 | } |
2427 | - if (\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) == 0) { |
|
2427 | + if (\PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) == 0) { |
|
2428 | 2428 | return; |
2429 | 2429 | } |
2430 | 2430 | |
2431 | 2431 | // Convert the pixel values to the percentage value expected by Excel |
2432 | - $x1 = $x1 / \PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_start)) * 1024; |
|
2433 | - $y1 = $y1 / \PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1) * 256; |
|
2434 | - $x2 = $width / \PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object |
|
2435 | - $y2 = $height / \PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object |
|
2432 | + $x1 = $x1 / \PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_start)) * 1024; |
|
2433 | + $y1 = $y1 / \PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_start + 1) * 256; |
|
2434 | + $x2 = $width / \PhpSpreadsheet\Shared\Excel5::sizeCol($this->phpSheet, \PhpSpreadsheet\Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object |
|
2435 | + $y2 = $height / \PhpSpreadsheet\Shared\Excel5::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object |
|
2436 | 2436 | |
2437 | 2437 | $this->writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2); |
2438 | 2438 | } |
@@ -2452,33 +2452,33 @@ discard block |
||
2452 | 2452 | */ |
2453 | 2453 | private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB) |
2454 | 2454 | { |
2455 | - $record = 0x005d; // Record identifier |
|
2456 | - $length = 0x003c; // Bytes to follow |
|
2457 | - |
|
2458 | - $cObj = 0x0001; // Count of objects in file (set to 1) |
|
2459 | - $OT = 0x0008; // Object type. 8 = Picture |
|
2460 | - $id = 0x0001; // Object ID |
|
2461 | - $grbit = 0x0614; // Option flags |
|
2462 | - |
|
2463 | - $cbMacro = 0x0000; // Length of FMLA structure |
|
2464 | - $Reserved1 = 0x0000; // Reserved |
|
2465 | - $Reserved2 = 0x0000; // Reserved |
|
2466 | - |
|
2467 | - $icvBack = 0x09; // Background colour |
|
2468 | - $icvFore = 0x09; // Foreground colour |
|
2469 | - $fls = 0x00; // Fill pattern |
|
2470 | - $fAuto = 0x00; // Automatic fill |
|
2471 | - $icv = 0x08; // Line colour |
|
2472 | - $lns = 0xff; // Line style |
|
2473 | - $lnw = 0x01; // Line weight |
|
2474 | - $fAutoB = 0x00; // Automatic border |
|
2475 | - $frs = 0x0000; // Frame style |
|
2476 | - $cf = 0x0009; // Image format, 9 = bitmap |
|
2477 | - $Reserved3 = 0x0000; // Reserved |
|
2478 | - $cbPictFmla = 0x0000; // Length of FMLA structure |
|
2479 | - $Reserved4 = 0x0000; // Reserved |
|
2480 | - $grbit2 = 0x0001; // Option flags |
|
2481 | - $Reserved5 = 0x0000; // Reserved |
|
2455 | + $record = 0x005d; // Record identifier |
|
2456 | + $length = 0x003c; // Bytes to follow |
|
2457 | + |
|
2458 | + $cObj = 0x0001; // Count of objects in file (set to 1) |
|
2459 | + $OT = 0x0008; // Object type. 8 = Picture |
|
2460 | + $id = 0x0001; // Object ID |
|
2461 | + $grbit = 0x0614; // Option flags |
|
2462 | + |
|
2463 | + $cbMacro = 0x0000; // Length of FMLA structure |
|
2464 | + $Reserved1 = 0x0000; // Reserved |
|
2465 | + $Reserved2 = 0x0000; // Reserved |
|
2466 | + |
|
2467 | + $icvBack = 0x09; // Background colour |
|
2468 | + $icvFore = 0x09; // Foreground colour |
|
2469 | + $fls = 0x00; // Fill pattern |
|
2470 | + $fAuto = 0x00; // Automatic fill |
|
2471 | + $icv = 0x08; // Line colour |
|
2472 | + $lns = 0xff; // Line style |
|
2473 | + $lnw = 0x01; // Line weight |
|
2474 | + $fAutoB = 0x00; // Automatic border |
|
2475 | + $frs = 0x0000; // Frame style |
|
2476 | + $cf = 0x0009; // Image format, 9 = bitmap |
|
2477 | + $Reserved3 = 0x0000; // Reserved |
|
2478 | + $cbPictFmla = 0x0000; // Length of FMLA structure |
|
2479 | + $Reserved4 = 0x0000; // Reserved |
|
2480 | + $grbit2 = 0x0001; // Option flags |
|
2481 | + $Reserved5 = 0x0000; // Reserved |
|
2482 | 2482 | |
2483 | 2483 | |
2484 | 2484 | $header = pack("vv", $record, $length); |
@@ -2529,16 +2529,16 @@ discard block |
||
2529 | 2529 | $height = imagesy($image); |
2530 | 2530 | |
2531 | 2531 | $data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18); |
2532 | - for ($j=$height; $j--;) { |
|
2533 | - for ($i=0; $i < $width; ++$i) { |
|
2532 | + for ($j = $height; $j--;) { |
|
2533 | + for ($i = 0; $i < $width; ++$i) { |
|
2534 | 2534 | $color = imagecolorsforindex($image, imagecolorat($image, $i, $j)); |
2535 | 2535 | foreach (array("red", "green", "blue") as $key) { |
2536 | 2536 | $color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127); |
2537 | 2537 | } |
2538 | 2538 | $data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]); |
2539 | 2539 | } |
2540 | - if (3*$width % 4) { |
|
2541 | - $data .= str_repeat("\x00", 4 - 3*$width % 4); |
|
2540 | + if (3 * $width % 4) { |
|
2541 | + $data .= str_repeat("\x00", 4 - 3 * $width % 4); |
|
2542 | 2542 | } |
2543 | 2543 | } |
2544 | 2544 | |
@@ -2582,7 +2582,7 @@ discard block |
||
2582 | 2582 | // Read and remove the bitmap size. This is more reliable than reading |
2583 | 2583 | // the data size at offset 0x22. |
2584 | 2584 | // |
2585 | - $size_array = unpack("Vsa", substr($data, 0, 4)); |
|
2585 | + $size_array = unpack("Vsa", substr($data, 0, 4)); |
|
2586 | 2586 | $size = $size_array['sa']; |
2587 | 2587 | $data = substr($data, 4); |
2588 | 2588 | $size -= 0x36; // Subtract size of bitmap header. |
@@ -2643,8 +2643,8 @@ discard block |
||
2643 | 2643 | return; |
2644 | 2644 | } |
2645 | 2645 | |
2646 | - $record = 0x00A0; // Record identifier |
|
2647 | - $length = 0x0004; // Bytes to follow |
|
2646 | + $record = 0x00A0; // Record identifier |
|
2647 | + $length = 0x0004; // Bytes to follow |
|
2648 | 2648 | |
2649 | 2649 | $header = pack("vv", $record, $length); |
2650 | 2650 | $data = pack("vv", $this->phpSheet->getSheetView()->getZoomScale(), 100); |
@@ -2689,10 +2689,10 @@ discard block |
||
2689 | 2689 | $nm = count($spOffsets) - 1; // number of shapes excluding first shape |
2690 | 2690 | for ($i = 1; $i <= $nm; ++$i) { |
2691 | 2691 | // MSODRAWING record |
2692 | - $record = 0x00EC; // Record identifier |
|
2692 | + $record = 0x00EC; // Record identifier |
|
2693 | 2693 | |
2694 | 2694 | // chunk of Escher stream for one shape |
2695 | - $dataChunk = substr($data, $spOffsets[$i -1], $spOffsets[$i] - $spOffsets[$i - 1]); |
|
2695 | + $dataChunk = substr($data, $spOffsets[$i - 1], $spOffsets[$i] - $spOffsets[$i - 1]); |
|
2696 | 2696 | |
2697 | 2697 | $length = strlen($dataChunk); |
2698 | 2698 | $header = pack("vv", $record, $length); |
@@ -2767,20 +2767,20 @@ discard block |
||
2767 | 2767 | // Write data validations? |
2768 | 2768 | if (!empty($dataValidationCollection)) { |
2769 | 2769 | // DATAVALIDATIONS record |
2770 | - $record = 0x01B2; // Record identifier |
|
2771 | - $length = 0x0012; // Bytes to follow |
|
2770 | + $record = 0x01B2; // Record identifier |
|
2771 | + $length = 0x0012; // Bytes to follow |
|
2772 | 2772 | |
2773 | - $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records |
|
2774 | - $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position |
|
2775 | - $verPos = 0x00000000; // Vertical position of prompt box, if fixed position |
|
2776 | - $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible |
|
2773 | + $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records |
|
2774 | + $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position |
|
2775 | + $verPos = 0x00000000; // Vertical position of prompt box, if fixed position |
|
2776 | + $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible |
|
2777 | 2777 | |
2778 | 2778 | $header = pack('vv', $record, $length); |
2779 | 2779 | $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection)); |
2780 | - $this->append($header.$data); |
|
2780 | + $this->append($header . $data); |
|
2781 | 2781 | |
2782 | 2782 | // DATAVALIDATION records |
2783 | - $record = 0x01BE; // Record identifier |
|
2783 | + $record = 0x01BE; // Record identifier |
|
2784 | 2784 | |
2785 | 2785 | foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) { |
2786 | 2786 | // initialize record data |
@@ -2980,8 +2980,8 @@ discard block |
||
2980 | 2980 | */ |
2981 | 2981 | private function writePageLayoutView() |
2982 | 2982 | { |
2983 | - $record = 0x088B; // Record identifier |
|
2984 | - $length = 0x0010; // Bytes to follow |
|
2983 | + $record = 0x088B; // Record identifier |
|
2984 | + $length = 0x0010; // Bytes to follow |
|
2985 | 2985 | |
2986 | 2986 | $rt = 0x088B; // 2 |
2987 | 2987 | $grbitFrt = 0x0000; // 2 |
@@ -2997,12 +2997,12 @@ discard block |
||
2997 | 2997 | $fRulerVisible = 0; |
2998 | 2998 | $fWhitespaceHidden = 0; |
2999 | 2999 | |
3000 | - $grbit = $fPageLayoutView; // 2 |
|
3001 | - $grbit |= $fRulerVisible << 1; |
|
3002 | - $grbit |= $fWhitespaceHidden << 3; |
|
3000 | + $grbit = $fPageLayoutView; // 2 |
|
3001 | + $grbit |= $fRulerVisible << 1; |
|
3002 | + $grbit |= $fWhitespaceHidden << 3; |
|
3003 | 3003 | |
3004 | - $header = pack("vv", $record, $length); |
|
3005 | - $data = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit); |
|
3004 | + $header = pack("vv", $record, $length); |
|
3005 | + $data = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit); |
|
3006 | 3006 | $this->append($header . $data); |
3007 | 3007 | } |
3008 | 3008 | |
@@ -3012,7 +3012,7 @@ discard block |
||
3012 | 3012 | */ |
3013 | 3013 | private function writeCFRule(\PhpSpreadsheet\Style\Conditional $conditional) |
3014 | 3014 | { |
3015 | - $record = 0x01B1; // Record identifier |
|
3015 | + $record = 0x01B1; // Record identifier |
|
3016 | 3016 | |
3017 | 3017 | // $type : Type of the CF |
3018 | 3018 | // $operatorType : Comparison operator |
@@ -3132,49 +3132,49 @@ discard block |
||
3132 | 3132 | } |
3133 | 3133 | // Alignment |
3134 | 3134 | $flags = 0; |
3135 | - $flags |= (1 == $bAlignHz ? 0x00000001 : 0); |
|
3136 | - $flags |= (1 == $bAlignVt ? 0x00000002 : 0); |
|
3137 | - $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0); |
|
3138 | - $flags |= (1 == $bTxRotation ? 0x00000008 : 0); |
|
3135 | + $flags |= (1 == $bAlignHz ? 0x00000001 : 0); |
|
3136 | + $flags |= (1 == $bAlignVt ? 0x00000002 : 0); |
|
3137 | + $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0); |
|
3138 | + $flags |= (1 == $bTxRotation ? 0x00000008 : 0); |
|
3139 | 3139 | // Justify last line flag |
3140 | - $flags |= (1 == 1 ? 0x00000010 : 0); |
|
3141 | - $flags |= (1 == $bIndent ? 0x00000020 : 0); |
|
3142 | - $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0); |
|
3140 | + $flags |= (1 == 1 ? 0x00000010 : 0); |
|
3141 | + $flags |= (1 == $bIndent ? 0x00000020 : 0); |
|
3142 | + $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0); |
|
3143 | 3143 | // Default |
3144 | - $flags |= (1 == 1 ? 0x00000080 : 0); |
|
3144 | + $flags |= (1 == 1 ? 0x00000080 : 0); |
|
3145 | 3145 | // Protection |
3146 | - $flags |= (1 == $bProtLocked ? 0x00000100 : 0); |
|
3147 | - $flags |= (1 == $bProtHidden ? 0x00000200 : 0); |
|
3146 | + $flags |= (1 == $bProtLocked ? 0x00000100 : 0); |
|
3147 | + $flags |= (1 == $bProtHidden ? 0x00000200 : 0); |
|
3148 | 3148 | // Border |
3149 | - $flags |= (1 == $bBorderLeft ? 0x00000400 : 0); |
|
3150 | - $flags |= (1 == $bBorderRight ? 0x00000800 : 0); |
|
3151 | - $flags |= (1 == $bBorderTop ? 0x00001000 : 0); |
|
3149 | + $flags |= (1 == $bBorderLeft ? 0x00000400 : 0); |
|
3150 | + $flags |= (1 == $bBorderRight ? 0x00000800 : 0); |
|
3151 | + $flags |= (1 == $bBorderTop ? 0x00001000 : 0); |
|
3152 | 3152 | $flags |= (1 == $bBorderBottom ? 0x00002000 : 0); |
3153 | - $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border |
|
3154 | - $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border |
|
3153 | + $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border |
|
3154 | + $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border |
|
3155 | 3155 | // Pattern |
3156 | - $flags |= (1 == $bFillStyle ? 0x00010000 : 0); |
|
3157 | - $flags |= (1 == $bFillColor ? 0x00020000 : 0); |
|
3158 | - $flags |= (1 == $bFillColorBg ? 0x00040000 : 0); |
|
3159 | - $flags |= (1 == 1 ? 0x00380000 : 0); |
|
3156 | + $flags |= (1 == $bFillStyle ? 0x00010000 : 0); |
|
3157 | + $flags |= (1 == $bFillColor ? 0x00020000 : 0); |
|
3158 | + $flags |= (1 == $bFillColorBg ? 0x00040000 : 0); |
|
3159 | + $flags |= (1 == 1 ? 0x00380000 : 0); |
|
3160 | 3160 | // Font |
3161 | - $flags |= (1 == $bFormatFont ? 0x04000000 : 0); |
|
3161 | + $flags |= (1 == $bFormatFont ? 0x04000000 : 0); |
|
3162 | 3162 | // Alignment: |
3163 | - $flags |= (1 == $bFormatAlign ? 0x08000000 : 0); |
|
3163 | + $flags |= (1 == $bFormatAlign ? 0x08000000 : 0); |
|
3164 | 3164 | // Border |
3165 | 3165 | $flags |= (1 == $bFormatBorder ? 0x10000000 : 0); |
3166 | 3166 | // Pattern |
3167 | - $flags |= (1 == $bFormatFill ? 0x20000000 : 0); |
|
3167 | + $flags |= (1 == $bFormatFill ? 0x20000000 : 0); |
|
3168 | 3168 | // Protection |
3169 | - $flags |= (1 == $bFormatProt ? 0x40000000 : 0); |
|
3169 | + $flags |= (1 == $bFormatProt ? 0x40000000 : 0); |
|
3170 | 3170 | // Text direction |
3171 | - $flags |= (1 == 0 ? 0x80000000 : 0); |
|
3171 | + $flags |= (1 == 0 ? 0x80000000 : 0); |
|
3172 | 3172 | |
3173 | 3173 | // Data Blocks |
3174 | 3174 | if ($bFormatFont == 1) { |
3175 | 3175 | // Font Name |
3176 | 3176 | if ($conditional->getStyle()->getFont()->getName() == null) { |
3177 | - $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); |
|
3177 | + $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); |
|
3178 | 3178 | $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); |
3179 | 3179 | } else { |
3180 | 3180 | $dataBlockFont = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName()); |
@@ -3413,11 +3413,11 @@ discard block |
||
3413 | 3413 | // Options flags for modified font attributes |
3414 | 3414 | $optionsFlags = 0; |
3415 | 3415 | $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0); |
3416 | - $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0); |
|
3417 | - $optionsFlags |= (1 == 1 ? 0x00000008 : 0); |
|
3418 | - $optionsFlags |= (1 == 1 ? 0x00000010 : 0); |
|
3419 | - $optionsFlags |= (1 == 0 ? 0x00000020 : 0); |
|
3420 | - $optionsFlags |= (1 == 1 ? 0x00000080 : 0); |
|
3416 | + $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0); |
|
3417 | + $optionsFlags |= (1 == 1 ? 0x00000008 : 0); |
|
3418 | + $optionsFlags |= (1 == 1 ? 0x00000010 : 0); |
|
3419 | + $optionsFlags |= (1 == 0 ? 0x00000020 : 0); |
|
3420 | + $optionsFlags |= (1 == 1 ? 0x00000080 : 0); |
|
3421 | 3421 | $dataBlockFont .= pack('V', $optionsFlags); |
3422 | 3422 | // Escapement type |
3423 | 3423 | $dataBlockFont .= pack('V', $fontEscapement); |
@@ -3788,10 +3788,10 @@ discard block |
||
3788 | 3788 | break; |
3789 | 3789 | case \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR: |
3790 | 3790 | $blockFillPatternStyle = 0x00; |
3791 | - break; // does not exist in BIFF8 |
|
3791 | + break; // does not exist in BIFF8 |
|
3792 | 3792 | case \PhpSpreadsheet\Style\Fill::FILL_GRADIENT_PATH: |
3793 | 3793 | $blockFillPatternStyle = 0x00; |
3794 | - break; // does not exist in BIFF8 |
|
3794 | + break; // does not exist in BIFF8 |
|
3795 | 3795 | default: |
3796 | 3796 | $blockFillPatternStyle = 0x00; |
3797 | 3797 | break; |
@@ -4179,7 +4179,7 @@ discard block |
||
4179 | 4179 | if (!is_null($operand2)) { |
4180 | 4180 | $data .= $operand2; |
4181 | 4181 | } |
4182 | - $header = pack('vv', $record, strlen($data)); |
|
4182 | + $header = pack('vv', $record, strlen($data)); |
|
4183 | 4183 | $this->append($header . $data); |
4184 | 4184 | } |
4185 | 4185 | |
@@ -4188,8 +4188,8 @@ discard block |
||
4188 | 4188 | */ |
4189 | 4189 | private function writeCFHeader() |
4190 | 4190 | { |
4191 | - $record = 0x01B0; // Record identifier |
|
4192 | - $length = 0x0016; // Bytes to follow |
|
4191 | + $record = 0x01B0; // Record identifier |
|
4192 | + $length = 0x0016; // Bytes to follow |
|
4193 | 4193 | |
4194 | 4194 | $numColumnMin = null; |
4195 | 4195 | $numColumnMax = null; |
@@ -4224,9 +4224,9 @@ discard block |
||
4224 | 4224 | } |
4225 | 4225 | } |
4226 | 4226 | $needRedraw = 1; |
4227 | - $cellRange = pack('vvvv', $numRowMin-1, $numRowMax-1, $numColumnMin-1, $numColumnMax-1); |
|
4227 | + $cellRange = pack('vvvv', $numRowMin - 1, $numRowMax - 1, $numColumnMin - 1, $numColumnMax - 1); |
|
4228 | 4228 | |
4229 | - $header = pack('vv', $record, $length); |
|
4229 | + $header = pack('vv', $record, $length); |
|
4230 | 4230 | $data = pack('vv', count($arrConditional), $needRedraw); |
4231 | 4231 | $data .= $cellRange; |
4232 | 4232 | $data .= pack('v', 0x0001); |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | // Set document properties |
52 | 52 | echo date('H:i:s') , " Set document properties" , EOL; |
53 | 53 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
54 | - ->setLastModifiedBy("Maarten Balliauw") |
|
55 | - ->setTitle("Office 2007 XLSX Test Document") |
|
56 | - ->setSubject("Office 2007 XLSX Test Document") |
|
57 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
58 | - ->setKeywords("office 2007 openxml php") |
|
59 | - ->setCategory("Test result file"); |
|
54 | + ->setLastModifiedBy("Maarten Balliauw") |
|
55 | + ->setTitle("Office 2007 XLSX Test Document") |
|
56 | + ->setSubject("Office 2007 XLSX Test Document") |
|
57 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
58 | + ->setKeywords("office 2007 openxml php") |
|
59 | + ->setCategory("Test result file"); |
|
60 | 60 | |
61 | 61 | // Set default font |
62 | 62 | echo date('H:i:s') , " Set default font" , EOL; |
@@ -71,88 +71,88 @@ discard block |
||
71 | 71 | // Add some data, resembling some different data types |
72 | 72 | echo date('H:i:s') , " Add some data" , EOL; |
73 | 73 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'String value:') |
74 | - ->setCellValue('B1', 'Mark Baker'); |
|
74 | + ->setCellValue('B1', 'Mark Baker'); |
|
75 | 75 | |
76 | 76 | $objPHPExcel->getActiveSheet()->setCellValue('A2', 'Numeric value #1:') |
77 | - ->setCellValue('B2', 12345); |
|
77 | + ->setCellValue('B2', 12345); |
|
78 | 78 | |
79 | 79 | $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Numeric value #2:') |
80 | - ->setCellValue('B3', -12.345); |
|
80 | + ->setCellValue('B3', -12.345); |
|
81 | 81 | |
82 | 82 | $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Numeric value #3:') |
83 | - ->setCellValue('B4', .12345); |
|
83 | + ->setCellValue('B4', .12345); |
|
84 | 84 | |
85 | 85 | $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Numeric value #4:') |
86 | - ->setCellValue('B5', '12345'); |
|
86 | + ->setCellValue('B5', '12345'); |
|
87 | 87 | |
88 | 88 | $objPHPExcel->getActiveSheet()->setCellValue('A6', 'Numeric value #5:') |
89 | - ->setCellValue('B6', '1.2345'); |
|
89 | + ->setCellValue('B6', '1.2345'); |
|
90 | 90 | |
91 | 91 | $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Numeric value #6:') |
92 | - ->setCellValue('B7', '.12345'); |
|
92 | + ->setCellValue('B7', '.12345'); |
|
93 | 93 | |
94 | 94 | $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Numeric value #7:') |
95 | - ->setCellValue('B8', '1.234e-5'); |
|
95 | + ->setCellValue('B8', '1.234e-5'); |
|
96 | 96 | |
97 | 97 | $objPHPExcel->getActiveSheet()->setCellValue('A9', 'Numeric value #8:') |
98 | - ->setCellValue('B9', '-1.234e+5'); |
|
98 | + ->setCellValue('B9', '-1.234e+5'); |
|
99 | 99 | |
100 | 100 | $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Boolean value:') |
101 | - ->setCellValue('B10', 'TRUE'); |
|
101 | + ->setCellValue('B10', 'TRUE'); |
|
102 | 102 | |
103 | 103 | $objPHPExcel->getActiveSheet()->setCellValue('A11', 'Percentage value #1:') |
104 | - ->setCellValue('B11', '10%'); |
|
104 | + ->setCellValue('B11', '10%'); |
|
105 | 105 | |
106 | 106 | $objPHPExcel->getActiveSheet()->setCellValue('A12', 'Percentage value #2:') |
107 | - ->setCellValue('B12', '12.5%'); |
|
107 | + ->setCellValue('B12', '12.5%'); |
|
108 | 108 | |
109 | 109 | $objPHPExcel->getActiveSheet()->setCellValue('A13', 'Fraction value #1:') |
110 | - ->setCellValue('B13', '-1/2'); |
|
110 | + ->setCellValue('B13', '-1/2'); |
|
111 | 111 | |
112 | 112 | $objPHPExcel->getActiveSheet()->setCellValue('A14', 'Fraction value #2:') |
113 | - ->setCellValue('B14', '3 1/2'); |
|
113 | + ->setCellValue('B14', '3 1/2'); |
|
114 | 114 | |
115 | 115 | $objPHPExcel->getActiveSheet()->setCellValue('A15', 'Fraction value #3:') |
116 | - ->setCellValue('B15', '-12 3/4'); |
|
116 | + ->setCellValue('B15', '-12 3/4'); |
|
117 | 117 | |
118 | 118 | $objPHPExcel->getActiveSheet()->setCellValue('A16', 'Fraction value #4:') |
119 | - ->setCellValue('B16', '13/4'); |
|
119 | + ->setCellValue('B16', '13/4'); |
|
120 | 120 | |
121 | 121 | $objPHPExcel->getActiveSheet()->setCellValue('A17', 'Currency value #1:') |
122 | - ->setCellValue('B17', '$12345'); |
|
122 | + ->setCellValue('B17', '$12345'); |
|
123 | 123 | |
124 | 124 | $objPHPExcel->getActiveSheet()->setCellValue('A18', 'Currency value #2:') |
125 | - ->setCellValue('B18', '$12345.67'); |
|
125 | + ->setCellValue('B18', '$12345.67'); |
|
126 | 126 | |
127 | 127 | $objPHPExcel->getActiveSheet()->setCellValue('A19', 'Currency value #3:') |
128 | - ->setCellValue('B19', '$12,345.67'); |
|
128 | + ->setCellValue('B19', '$12,345.67'); |
|
129 | 129 | |
130 | 130 | $objPHPExcel->getActiveSheet()->setCellValue('A20', 'Date value #1:') |
131 | - ->setCellValue('B20', '21 December 1983'); |
|
131 | + ->setCellValue('B20', '21 December 1983'); |
|
132 | 132 | |
133 | 133 | $objPHPExcel->getActiveSheet()->setCellValue('A21', 'Date value #2:') |
134 | - ->setCellValue('B21', '19-Dec-1960'); |
|
134 | + ->setCellValue('B21', '19-Dec-1960'); |
|
135 | 135 | |
136 | 136 | $objPHPExcel->getActiveSheet()->setCellValue('A22', 'Date value #3:') |
137 | - ->setCellValue('B22', '07/12/1982'); |
|
137 | + ->setCellValue('B22', '07/12/1982'); |
|
138 | 138 | |
139 | 139 | $objPHPExcel->getActiveSheet()->setCellValue('A23', 'Date value #4:') |
140 | - ->setCellValue('B23', '24-11-1950'); |
|
140 | + ->setCellValue('B23', '24-11-1950'); |
|
141 | 141 | |
142 | 142 | $objPHPExcel->getActiveSheet()->setCellValue('A24', 'Date value #5:') |
143 | - ->setCellValue('B24', '17-Mar'); |
|
143 | + ->setCellValue('B24', '17-Mar'); |
|
144 | 144 | |
145 | 145 | $objPHPExcel->getActiveSheet()->setCellValue('A25', 'Time value #1:') |
146 | - ->setCellValue('B25', '01:30'); |
|
146 | + ->setCellValue('B25', '01:30'); |
|
147 | 147 | |
148 | 148 | $objPHPExcel->getActiveSheet()->setCellValue('A26', 'Time value #2:') |
149 | - ->setCellValue('B26', '01:30:15'); |
|
149 | + ->setCellValue('B26', '01:30:15'); |
|
150 | 150 | |
151 | 151 | $objPHPExcel->getActiveSheet()->setCellValue('A27', 'Date/Time value:') |
152 | - ->setCellValue('B27', '19-Dec-1960 01:30'); |
|
152 | + ->setCellValue('B27', '19-Dec-1960 01:30'); |
|
153 | 153 | |
154 | 154 | $objPHPExcel->getActiveSheet()->setCellValue('A28', 'Formula:') |
155 | - ->setCellValue('B28', '=SUM(B2:B9)'); |
|
155 | + ->setCellValue('B28', '=SUM(B2:B9)'); |
|
156 | 156 | |
157 | 157 | // Rename worksheet |
158 | 158 | echo date('H:i:s') , " Rename worksheet" , EOL; |
@@ -30,26 +30,26 @@ discard block |
||
30 | 30 | ini_set('display_errors', TRUE); |
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | |
33 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | 34 | |
35 | 35 | /** PHPExcel */ |
36 | 36 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
37 | 37 | |
38 | 38 | |
39 | 39 | // Set timezone |
40 | -echo date('H:i:s') , " Set timezone" , EOL; |
|
40 | +echo date('H:i:s'), " Set timezone", EOL; |
|
41 | 41 | date_default_timezone_set('UTC'); |
42 | 42 | |
43 | 43 | // Set value binder |
44 | -echo date('H:i:s') , " Set value binder" , EOL; |
|
45 | -\PHPExcel\Cell::setValueBinder( new \PHPExcel\Cell\AdvancedValueBinder() ); |
|
44 | +echo date('H:i:s'), " Set value binder", EOL; |
|
45 | +\PHPExcel\Cell::setValueBinder(new \PHPExcel\Cell\AdvancedValueBinder()); |
|
46 | 46 | |
47 | 47 | // Create new PHPExcel object |
48 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
48 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
49 | 49 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
50 | 50 | |
51 | 51 | // Set document properties |
52 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
52 | +echo date('H:i:s'), " Set document properties", EOL; |
|
53 | 53 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
54 | 54 | ->setLastModifiedBy("Maarten Balliauw") |
55 | 55 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | ->setCategory("Test result file"); |
60 | 60 | |
61 | 61 | // Set default font |
62 | -echo date('H:i:s') , " Set default font" , EOL; |
|
62 | +echo date('H:i:s'), " Set default font", EOL; |
|
63 | 63 | $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setName('Arial'); |
64 | 64 | $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(10); |
65 | 65 | |
66 | 66 | // Set column widths |
67 | -echo date('H:i:s') , " Set column widths" , EOL; |
|
67 | +echo date('H:i:s'), " Set column widths", EOL; |
|
68 | 68 | $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true); |
69 | 69 | $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(14); |
70 | 70 | |
71 | 71 | // Add some data, resembling some different data types |
72 | -echo date('H:i:s') , " Add some data" , EOL; |
|
72 | +echo date('H:i:s'), " Add some data", EOL; |
|
73 | 73 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'String value:') |
74 | 74 | ->setCellValue('B1', 'Mark Baker'); |
75 | 75 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ->setCellValue('B28', '=SUM(B2:B9)'); |
156 | 156 | |
157 | 157 | // Rename worksheet |
158 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
158 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
159 | 159 | $objPHPExcel->getActiveSheet()->setTitle('Advanced value binder'); |
160 | 160 | |
161 | 161 | |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | |
165 | 165 | |
166 | 166 | // Save Excel 2007 file |
167 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
167 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
168 | 168 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
169 | 169 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
170 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
170 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
171 | 171 | // Save Excel5 file |
172 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
172 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
173 | 173 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
174 | 174 | $objWriter->save(str_replace('.php', '.xls', __FILE__)); |
175 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
175 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
176 | 176 | |
177 | 177 | |
178 | 178 | // Echo memory peak usage |
179 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
179 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
180 | 180 | |
181 | 181 | // Echo done |
182 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
183 | -echo 'File has been created in ' , getcwd() , EOL; |
|
182 | +echo date('H:i:s'), " Done writing file", EOL; |
|
183 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php'; |
35 | 35 | |
36 | 36 | |
37 | -echo date('H:i:s') , " Load from XML file" , PHP_EOL; |
|
37 | +echo date('H:i:s'), " Load from XML file", PHP_EOL; |
|
38 | 38 | $inputFileName = "XMLTest.xml"; |
39 | 39 | |
40 | 40 | /** Identify the type of $inputFileName **/ |
41 | 41 | $inputFileType = \PHPExcel\IOFactory::identify($inputFileName); |
42 | -echo 'Loading ' , $inputFileName , ' using ' , $inputFileType , " Reader" , PHP_EOL; |
|
42 | +echo 'Loading ', $inputFileName, ' using ', $inputFileType, " Reader", PHP_EOL; |
|
43 | 43 | |
44 | 44 | /** Create a new Reader of the type that has been identified **/ |
45 | 45 | $objReader = \PHPExcel\IOFactory::createReader($inputFileType); |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | $objPHPExcel = $objReader->load($inputFileName); |
48 | 48 | |
49 | 49 | |
50 | -echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL; |
|
50 | +echo date('H:i:s'), " Write to Excel2007 format", PHP_EOL; |
|
51 | 51 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
52 | 52 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
53 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL; |
|
53 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', __FILE__), PHP_EOL; |
|
54 | 54 | |
55 | 55 | |
56 | 56 | // Echo memory peak usage |
57 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL; |
|
57 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", PHP_EOL; |
|
58 | 58 | |
59 | 59 | // Echo done |
60 | -echo date('H:i:s') , " Done writing file" , PHP_EOL; |
|
60 | +echo date('H:i:s'), " Done writing file", PHP_EOL; |
@@ -62,14 +62,14 @@ |
||
62 | 62 | echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL; |
63 | 63 | |
64 | 64 | if (!\PHPExcel\Settings::setPdfRenderer( |
65 | - $rendererName, |
|
66 | - $rendererLibraryPath |
|
67 | - )) { |
|
68 | - die( |
|
69 | - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
70 | - EOL . |
|
71 | - 'at the top of this script as appropriate for your directory structure' |
|
72 | - ); |
|
65 | + $rendererName, |
|
66 | + $rendererLibraryPath |
|
67 | + )) { |
|
68 | + die( |
|
69 | + 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
70 | + EOL . |
|
71 | + 'at the top of this script as appropriate for your directory structure' |
|
72 | + ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
35 | 35 | |
36 | 36 | date_default_timezone_set('Europe/London'); |
37 | 37 | |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | $rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary; |
53 | 53 | |
54 | 54 | |
55 | -echo date('H:i:s') , " Hide grid lines" , EOL; |
|
55 | +echo date('H:i:s'), " Hide grid lines", EOL; |
|
56 | 56 | $objPHPExcel->getActiveSheet()->setShowGridLines(false); |
57 | 57 | |
58 | -echo date('H:i:s') , " Set orientation to landscape" , EOL; |
|
58 | +echo date('H:i:s'), " Set orientation to landscape", EOL; |
|
59 | 59 | $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); |
60 | 60 | |
61 | 61 | |
62 | -echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL; |
|
62 | +echo date('H:i:s'), " Write to PDF format using {$rendererName}", EOL; |
|
63 | 63 | |
64 | 64 | if (!\PHPExcel\Settings::setPdfRenderer( |
65 | 65 | $rendererName, |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | |
78 | 78 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); |
79 | 79 | $objWriter->setSheetIndex(0); |
80 | -$objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__)); |
|
80 | +$objWriter->save(str_replace('.php', '_' . $rendererName . '.pdf', __FILE__)); |
|
81 | 81 | $callEndTime = microtime(true); |
82 | 82 | $callTime = $callEndTime - $callStartTime; |
83 | -echo date('H:i:s') , " File written to " , str_replace('.php', '_'.$rendererName.'.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
84 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
83 | +echo date('H:i:s'), " File written to ", str_replace('.php', '_' . $rendererName . '.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
84 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
85 | 85 | // Echo memory usage |
86 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
86 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
87 | 87 | |
88 | 88 | |
89 | 89 | // Echo memory peak usage |
90 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
90 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
91 | 91 | |
92 | 92 | // Echo done |
93 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
94 | -echo 'File has been created in ' , getcwd() , EOL; |
|
93 | +echo date('H:i:s'), " Done writing files", EOL; |
|
94 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | // Set document properties |
45 | 45 | echo date('H:i:s').' Set document properties'.EOL; |
46 | 46 | $objPHPExcel->getProperties()->setCreator('Maarten Balliauw') |
47 | - ->setLastModifiedBy('Maarten Balliauw') |
|
48 | - ->setTitle('PHPExcel Test Document') |
|
49 | - ->setSubject('PHPExcel Test Document') |
|
50 | - ->setDescription('Test document for PHPExcel, generated using PHP classes.') |
|
51 | - ->setKeywords('office PHPExcel php') |
|
52 | - ->setCategory('Test result file'); |
|
47 | + ->setLastModifiedBy('Maarten Balliauw') |
|
48 | + ->setTitle('PHPExcel Test Document') |
|
49 | + ->setSubject('PHPExcel Test Document') |
|
50 | + ->setDescription('Test document for PHPExcel, generated using PHP classes.') |
|
51 | + ->setKeywords('office PHPExcel php') |
|
52 | + ->setCategory('Test result file'); |
|
53 | 53 | |
54 | 54 | // Create the worksheet |
55 | 55 | echo date('H:i:s').' Add data'.EOL; |
56 | 56 | $objPHPExcel->setActiveSheetIndex(0); |
57 | 57 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') |
58 | - ->setCellValue('B1', 'Financial Period') |
|
59 | - ->setCellValue('C1', 'Country') |
|
60 | - ->setCellValue('D1', 'Date') |
|
61 | - ->setCellValue('E1', 'Sales Value') |
|
62 | - ->setCellValue('F1', 'Expenditure') |
|
63 | - ; |
|
58 | + ->setCellValue('B1', 'Financial Period') |
|
59 | + ->setCellValue('C1', 'Country') |
|
60 | + ->setCellValue('D1', 'Date') |
|
61 | + ->setCellValue('E1', 'Sales Value') |
|
62 | + ->setCellValue('F1', 'Expenditure') |
|
63 | + ; |
|
64 | 64 | $startYear = $endYear = $currentYear = date('Y'); |
65 | 65 | $startYear--; |
66 | 66 | $endYear++; |
@@ -68,44 +68,44 @@ discard block |
||
68 | 68 | $years = range($startYear,$endYear); |
69 | 69 | $periods = range(1,12); |
70 | 70 | $countries = array( 'United States', 'UK', 'France', 'Germany', |
71 | - 'Italy', 'Spain', 'Portugal', 'Japan' |
|
72 | - ); |
|
71 | + 'Italy', 'Spain', 'Portugal', 'Japan' |
|
72 | + ); |
|
73 | 73 | |
74 | 74 | $row = 2; |
75 | 75 | foreach($years as $year) { |
76 | - foreach($periods as $period) { |
|
77 | - foreach($countries as $country) { |
|
78 | - $endDays = date('t',mktime(0,0,0,$period,1,$year)); |
|
79 | - for($i = 1; $i <= $endDays; ++$i) { |
|
80 | - $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( |
|
81 | - $year, |
|
82 | - $period, |
|
83 | - $i |
|
84 | - ); |
|
85 | - $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); |
|
86 | - $salesValue = $invoiceValue = NULL; |
|
87 | - $incomeOrExpenditure = rand(-1,1); |
|
88 | - if ($incomeOrExpenditure == -1) { |
|
89 | - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
90 | - $income = NULL; |
|
91 | - } elseif ($incomeOrExpenditure == 1) { |
|
92 | - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
93 | - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
94 | - } else { |
|
95 | - $expenditure = NULL; |
|
96 | - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
97 | - } |
|
98 | - $dataArray = array( $year, |
|
99 | - $period, |
|
100 | - $country, |
|
101 | - $eDate, |
|
102 | - $income, |
|
103 | - $expenditure, |
|
104 | - ); |
|
105 | - $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); |
|
106 | - } |
|
107 | - } |
|
108 | - } |
|
76 | + foreach($periods as $period) { |
|
77 | + foreach($countries as $country) { |
|
78 | + $endDays = date('t',mktime(0,0,0,$period,1,$year)); |
|
79 | + for($i = 1; $i <= $endDays; ++$i) { |
|
80 | + $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( |
|
81 | + $year, |
|
82 | + $period, |
|
83 | + $i |
|
84 | + ); |
|
85 | + $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); |
|
86 | + $salesValue = $invoiceValue = NULL; |
|
87 | + $incomeOrExpenditure = rand(-1,1); |
|
88 | + if ($incomeOrExpenditure == -1) { |
|
89 | + $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
90 | + $income = NULL; |
|
91 | + } elseif ($incomeOrExpenditure == 1) { |
|
92 | + $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
93 | + $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
94 | + } else { |
|
95 | + $expenditure = NULL; |
|
96 | + $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
97 | + } |
|
98 | + $dataArray = array( $year, |
|
99 | + $period, |
|
100 | + $country, |
|
101 | + $eDate, |
|
102 | + $income, |
|
103 | + $expenditure, |
|
104 | + ); |
|
105 | + $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); |
|
106 | + } |
|
107 | + } |
|
108 | + } |
|
109 | 109 | } |
110 | 110 | $row--; |
111 | 111 | |
@@ -138,45 +138,45 @@ discard block |
||
138 | 138 | $autoFilter->getColumn('C') |
139 | 139 | ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) |
140 | 140 | ->createRule() |
141 | - ->setRule( |
|
142 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
143 | - 'u*' |
|
144 | - ) |
|
145 | - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
141 | + ->setRule( |
|
142 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
143 | + 'u*' |
|
144 | + ) |
|
145 | + ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
146 | 146 | $autoFilter->getColumn('C') |
147 | 147 | ->createRule() |
148 | - ->setRule( |
|
149 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
150 | - 'japan' |
|
151 | - ) |
|
152 | - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
148 | + ->setRule( |
|
149 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
150 | + 'japan' |
|
151 | + ) |
|
152 | + ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
153 | 153 | // Filter the Date column on a filter value of the first day of every period of the current year |
154 | 154 | // We us a dateGroup ruletype for this, although it is still a standard filter |
155 | 155 | foreach($periods as $period) { |
156 | - $endDate = date('t',mktime(0,0,0,$period,1,$currentYear)); |
|
157 | - |
|
158 | - $autoFilter->getColumn('D') |
|
159 | - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) |
|
160 | - ->createRule() |
|
161 | - ->setRule( |
|
162 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
163 | - array( |
|
164 | - 'year' => $currentYear, |
|
165 | - 'month' => $period, |
|
166 | - 'day' => $endDate |
|
167 | - ) |
|
168 | - ) |
|
169 | - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP); |
|
156 | + $endDate = date('t',mktime(0,0,0,$period,1,$currentYear)); |
|
157 | + |
|
158 | + $autoFilter->getColumn('D') |
|
159 | + ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) |
|
160 | + ->createRule() |
|
161 | + ->setRule( |
|
162 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
163 | + array( |
|
164 | + 'year' => $currentYear, |
|
165 | + 'month' => $period, |
|
166 | + 'day' => $endDate |
|
167 | + ) |
|
168 | + ) |
|
169 | + ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP); |
|
170 | 170 | } |
171 | 171 | // Display only sales values that are blank |
172 | 172 | // Standard filter, operator equals, and value of NULL |
173 | 173 | $autoFilter->getColumn('E') |
174 | 174 | ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) |
175 | 175 | ->createRule() |
176 | - ->setRule( |
|
177 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
178 | - '' |
|
179 | - ); |
|
176 | + ->setRule( |
|
177 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
178 | + '' |
|
179 | + ); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | // Set active sheet index to the first sheet, so Excel opens this as the first sheet |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | date_default_timezone_set('Europe/London'); |
33 | 33 | |
34 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
35 | 35 | |
36 | 36 | /** Include PHPExcel */ |
37 | 37 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
38 | 38 | |
39 | 39 | |
40 | 40 | // Create new PHPExcel object |
41 | -echo date('H:i:s').' Create new PHPExcel object'.EOL; |
|
41 | +echo date('H:i:s') . ' Create new PHPExcel object' . EOL; |
|
42 | 42 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
43 | 43 | |
44 | 44 | // Set document properties |
45 | -echo date('H:i:s').' Set document properties'.EOL; |
|
45 | +echo date('H:i:s') . ' Set document properties' . EOL; |
|
46 | 46 | $objPHPExcel->getProperties()->setCreator('Maarten Balliauw') |
47 | 47 | ->setLastModifiedBy('Maarten Balliauw') |
48 | 48 | ->setTitle('PHPExcel Test Document') |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ->setCategory('Test result file'); |
53 | 53 | |
54 | 54 | // Create the worksheet |
55 | -echo date('H:i:s').' Add data'.EOL; |
|
55 | +echo date('H:i:s') . ' Add data' . EOL; |
|
56 | 56 | $objPHPExcel->setActiveSheetIndex(0); |
57 | 57 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') |
58 | 58 | ->setCellValue('B1', 'Financial Period') |
@@ -65,44 +65,44 @@ discard block |
||
65 | 65 | $startYear--; |
66 | 66 | $endYear++; |
67 | 67 | |
68 | -$years = range($startYear,$endYear); |
|
69 | -$periods = range(1,12); |
|
70 | -$countries = array( 'United States', 'UK', 'France', 'Germany', |
|
71 | - 'Italy', 'Spain', 'Portugal', 'Japan' |
|
68 | +$years = range($startYear, $endYear); |
|
69 | +$periods = range(1, 12); |
|
70 | +$countries = array('United States', 'UK', 'France', 'Germany', |
|
71 | + 'Italy', 'Spain', 'Portugal', 'Japan' |
|
72 | 72 | ); |
73 | 73 | |
74 | 74 | $row = 2; |
75 | -foreach($years as $year) { |
|
76 | - foreach($periods as $period) { |
|
77 | - foreach($countries as $country) { |
|
78 | - $endDays = date('t',mktime(0,0,0,$period,1,$year)); |
|
79 | - for($i = 1; $i <= $endDays; ++$i) { |
|
75 | +foreach ($years as $year) { |
|
76 | + foreach ($periods as $period) { |
|
77 | + foreach ($countries as $country) { |
|
78 | + $endDays = date('t', mktime(0, 0, 0, $period, 1, $year)); |
|
79 | + for ($i = 1; $i <= $endDays; ++$i) { |
|
80 | 80 | $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( |
81 | 81 | $year, |
82 | 82 | $period, |
83 | 83 | $i |
84 | 84 | ); |
85 | - $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); |
|
85 | + $value = rand(500, 1000) * (1 + rand(-0.25, +0.25)); |
|
86 | 86 | $salesValue = $invoiceValue = NULL; |
87 | - $incomeOrExpenditure = rand(-1,1); |
|
87 | + $incomeOrExpenditure = rand(-1, 1); |
|
88 | 88 | if ($incomeOrExpenditure == -1) { |
89 | - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
89 | + $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); |
|
90 | 90 | $income = NULL; |
91 | 91 | } elseif ($incomeOrExpenditure == 1) { |
92 | - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
93 | - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
92 | + $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); |
|
93 | + $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); ; |
|
94 | 94 | } else { |
95 | 95 | $expenditure = NULL; |
96 | - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
96 | + $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); ; |
|
97 | 97 | } |
98 | - $dataArray = array( $year, |
|
98 | + $dataArray = array($year, |
|
99 | 99 | $period, |
100 | 100 | $country, |
101 | 101 | $eDate, |
102 | 102 | $income, |
103 | 103 | $expenditure, |
104 | 104 | ); |
105 | - $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); |
|
105 | + $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A' . $row++); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -111,20 +111,20 @@ discard block |
||
111 | 111 | |
112 | 112 | |
113 | 113 | // Set styling |
114 | -echo date('H:i:s').' Set styling'.EOL; |
|
114 | +echo date('H:i:s') . ' Set styling' . EOL; |
|
115 | 115 | $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); |
116 | 116 | $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE); |
117 | 117 | $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); |
118 | 118 | $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); |
119 | -$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2); |
|
120 | -$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); |
|
119 | +$objPHPExcel->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2); |
|
120 | +$objPHPExcel->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); |
|
121 | 121 | $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14); |
122 | 122 | $objPHPExcel->getActiveSheet()->freezePane('A2'); |
123 | 123 | |
124 | 124 | |
125 | 125 | |
126 | 126 | // Set autofilter range |
127 | -echo date('H:i:s').' Set autofilter range'.EOL; |
|
127 | +echo date('H:i:s') . ' Set autofilter range' . EOL; |
|
128 | 128 | // Always include the complete filter range! |
129 | 129 | // Excel does support setting only the caption |
130 | 130 | // row, but that's not a best practise... |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | // Set active filters |
134 | 134 | $autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter(); |
135 | -echo date('H:i:s').' Set active filters'.EOL; |
|
135 | +echo date('H:i:s') . ' Set active filters' . EOL; |
|
136 | 136 | // Filter the Country column on a filter value of countries beginning with the letter U (or Japan) |
137 | 137 | // We use * as a wildcard, so specify as U* and using a wildcard requires customFilter |
138 | 138 | $autoFilter->getColumn('C') |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
153 | 153 | // Filter the Date column on a filter value of the first day of every period of the current year |
154 | 154 | // We us a dateGroup ruletype for this, although it is still a standard filter |
155 | -foreach($periods as $period) { |
|
156 | - $endDate = date('t',mktime(0,0,0,$period,1,$currentYear)); |
|
155 | +foreach ($periods as $period) { |
|
156 | + $endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear)); |
|
157 | 157 | |
158 | 158 | $autoFilter->getColumn('D') |
159 | 159 | ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | |
186 | 186 | // Save Excel 2007 file |
187 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
187 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
188 | 188 | $callStartTime = microtime(true); |
189 | 189 | |
190 | 190 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | $callEndTime = microtime(true); |
193 | 193 | $callTime = $callEndTime - $callStartTime; |
194 | 194 | |
195 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
196 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
195 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
196 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
197 | 197 | // Echo memory usage |
198 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
198 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
199 | 199 | |
200 | 200 | |
201 | 201 | // Save Excel 95 file |
202 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
202 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
203 | 203 | $callStartTime = microtime(true); |
204 | 204 | |
205 | 205 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | $callEndTime = microtime(true); |
208 | 208 | $callTime = $callEndTime - $callStartTime; |
209 | 209 | |
210 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
211 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
210 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
211 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
212 | 212 | // Echo memory usage |
213 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
213 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
214 | 214 | |
215 | 215 | |
216 | 216 | // Echo memory peak usage |
217 | -echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL; |
|
217 | +echo date('H:i:s') . ' Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB' . EOL; |
|
218 | 218 | |
219 | 219 | // Echo done |
220 | -echo date('H:i:s').' Done writing files'.EOL; |
|
221 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
220 | +echo date('H:i:s') . ' Done writing files' . EOL; |
|
221 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ini_set('display_errors', TRUE); |
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | |
33 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | 34 | |
35 | 35 | date_default_timezone_set('Europe/London'); |
36 | 36 | |
@@ -39,26 +39,26 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | // Read from Excel5 (.xls) template |
42 | -echo date('H:i:s') , " Load Excel2007 template file" , EOL; |
|
42 | +echo date('H:i:s'), " Load Excel2007 template file", EOL; |
|
43 | 43 | $objReader = \PHPExcel\IOFactory::createReader('Excel5'); |
44 | 44 | $objPHPExcel = $objReader->load("templates/27template.xls"); |
45 | 45 | |
46 | 46 | // Export to Excel2007 (.xlsx) |
47 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
47 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
48 | 48 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
49 | 49 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
50 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
50 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
51 | 51 | |
52 | 52 | // Export to Excel5 (.xls) |
53 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
53 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
54 | 54 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
55 | 55 | $objWriter->save(str_replace('.php', '.xls', __FILE__)); |
56 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
56 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | // Echo memory peak usage |
60 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
60 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
61 | 61 | |
62 | 62 | // Echo done |
63 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
64 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
63 | +echo date('H:i:s'), " Done writing files", EOL; |
|
64 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | // Set document properties |
46 | 46 | echo date('H:i:s') , " Set document properties" , EOL; |
47 | 47 | $objPHPExcel->getProperties()->setCreator("Mark Baker") |
48 | - ->setLastModifiedBy("Mark Baker") |
|
49 | - ->setTitle("Office 2007 XLSX Test Document") |
|
50 | - ->setSubject("Office 2007 XLSX Test Document") |
|
51 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | - ->setKeywords("office 2007 openxml php") |
|
53 | - ->setCategory("Test result file"); |
|
48 | + ->setLastModifiedBy("Mark Baker") |
|
49 | + ->setTitle("Office 2007 XLSX Test Document") |
|
50 | + ->setSubject("Office 2007 XLSX Test Document") |
|
51 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | + ->setKeywords("office 2007 openxml php") |
|
53 | + ->setCategory("Test result file"); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | // Add some data |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | echo date('H:i:s') , " Set sheet security" , EOL; |
75 | 75 | $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); |
76 | 76 | $objPHPExcel->getActiveSheet() |
77 | - ->getStyle('A2:B2') |
|
78 | - ->getProtection()->setLocked( |
|
79 | - \PHPExcel\Style\Protection::PROTECTION_UNPROTECTED |
|
80 | - ); |
|
77 | + ->getStyle('A2:B2') |
|
78 | + ->getProtection()->setLocked( |
|
79 | + \PHPExcel\Style\Protection::PROTECTION_UNPROTECTED |
|
80 | + ); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | // Set active sheet index to the first sheet, so Excel opens this as the first sheet |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ini_set('display_errors', TRUE); |
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | |
33 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | 34 | |
35 | 35 | date_default_timezone_set('Europe/London'); |
36 | 36 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | // Create new PHPExcel object |
42 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
42 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
43 | 43 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
44 | 44 | |
45 | 45 | // Set document properties |
46 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
46 | +echo date('H:i:s'), " Set document properties", EOL; |
|
47 | 47 | $objPHPExcel->getProperties()->setCreator("Mark Baker") |
48 | 48 | ->setLastModifiedBy("Mark Baker") |
49 | 49 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | |
56 | 56 | // Add some data |
57 | -echo date('H:i:s') , " Add some data" , EOL; |
|
57 | +echo date('H:i:s'), " Add some data", EOL; |
|
58 | 58 | $objPHPExcel->setActiveSheetIndex(0); |
59 | 59 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Crouching'); |
60 | 60 | $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Tiger'); |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | $objPHPExcel->getActiveSheet()->setCellValue('B2', 'Dragon'); |
63 | 63 | |
64 | 64 | // Rename worksheet |
65 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
65 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
66 | 66 | $objPHPExcel->getActiveSheet()->setTitle('Simple'); |
67 | 67 | |
68 | 68 | |
69 | 69 | // Set document security |
70 | -echo date('H:i:s') , " Set cell protection" , EOL; |
|
70 | +echo date('H:i:s'), " Set cell protection", EOL; |
|
71 | 71 | |
72 | 72 | |
73 | 73 | // Set sheet security |
74 | -echo date('H:i:s') , " Set sheet security" , EOL; |
|
74 | +echo date('H:i:s'), " Set sheet security", EOL; |
|
75 | 75 | $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); |
76 | 76 | $objPHPExcel->getActiveSheet() |
77 | 77 | ->getStyle('A2:B2') |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | // Save Excel 2007 file |
88 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
88 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
89 | 89 | $callStartTime = microtime(true); |
90 | 90 | |
91 | 91 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | $callEndTime = microtime(true); |
94 | 94 | $callTime = $callEndTime - $callStartTime; |
95 | 95 | |
96 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
97 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
96 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
97 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
98 | 98 | // Echo memory usage |
99 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
99 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
100 | 100 | |
101 | 101 | |
102 | 102 | // Echo memory peak usage |
103 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
103 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
104 | 104 | |
105 | 105 | // Echo done |
106 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
107 | -echo 'File has been created in ' , getcwd() , EOL; |
|
106 | +echo date('H:i:s'), " Done writing file", EOL; |
|
107 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ini_set('display_errors', TRUE); |
31 | 31 | ini_set('display_startup_errors', TRUE); |
32 | 32 | |
33 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
34 | 34 | |
35 | 35 | date_default_timezone_set('Europe/London'); |
36 | 36 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | // Save Excel 95 file |
44 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
44 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
45 | 45 | $callStartTime = microtime(true); |
46 | 46 | |
47 | 47 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | $callEndTime = microtime(true); |
50 | 50 | $callTime = $callEndTime - $callStartTime; |
51 | 51 | |
52 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
53 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
52 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
53 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
54 | 54 | // Echo memory usage |
55 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
55 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
56 | 56 | |
57 | 57 | |
58 | 58 | // Echo memory peak usage |
59 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
59 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
60 | 60 | |
61 | 61 | // Echo done |
62 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
63 | -echo 'File has been created in ' , getcwd() , EOL; |
|
62 | +echo date('H:i:s'), " Done writing file", EOL; |
|
63 | +echo 'File has been created in ', getcwd(), EOL; |