@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // $inputFileType = 'Gnumeric'; |
34 | 34 | $inputFileName = './sampleData/example1.xls'; |
35 | 35 | |
36 | -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
36 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
37 | 37 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
38 | 38 | echo 'Turning Formatting off for Load<br />'; |
39 | 39 | $objReader->setReadDataOnly(true); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | echo '<hr />'; |
44 | 44 | |
45 | -$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); |
|
45 | +$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); |
|
46 | 46 | var_dump($sheetData); |
47 | 47 | |
48 | 48 |
@@ -32,21 +32,21 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), |
|
36 | - array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | - array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | - array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | - array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | - array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | - array( 'Apple', 8, 9, 6, 45.00 ), |
|
35 | +$database = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit'), |
|
36 | + array('Apple', 18, 20, 14, 105.00), |
|
37 | + array('Pear', 12, 12, 10, 96.00), |
|
38 | + array('Cherry', 13, 14, 9, 105.00), |
|
39 | + array('Apple', 14, 15, 10, 75.00), |
|
40 | + array('Pear', 9, 8, 8, 76.80), |
|
41 | + array('Apple', 8, 9, 6, 45.00), |
|
42 | 42 | ); |
43 | -$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), |
|
44 | - array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | - array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
43 | +$criteria = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'), |
|
44 | + array('="=Apple"', '>10', NULL, NULL, NULL, '<16'), |
|
45 | + array('="=Pear"', NULL, NULL, NULL, NULL, NULL) |
|
46 | 46 | ); |
47 | 47 | |
48 | -$worksheet->fromArray( $criteria, NULL, 'A1' ); |
|
49 | -$worksheet->fromArray( $database, NULL, 'A4' ); |
|
48 | +$worksheet->fromArray($criteria, NULL, 'A1'); |
|
49 | +$worksheet->fromArray($database, NULL, 'A4'); |
|
50 | 50 | |
51 | 51 | $worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall'); |
52 | 52 | $worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | echo '<h4>Database</h4>'; |
59 | 59 | |
60 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
60 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
61 | 61 | var_dump($databaseData); |
62 | 62 | |
63 | 63 | |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | echo 'ALL' . '<br /><br />'; |
71 | 71 | |
72 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
73 | -echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
72 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
73 | +echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
74 | 74 | |
75 | 75 | echo '<h4>Criteria</h4>'; |
76 | 76 | |
77 | -$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); |
|
77 | +$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); |
|
78 | 78 | var_dump($criteriaData); |
79 | 79 | |
80 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
80 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
81 | 81 | echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
82 | 82 | |
83 | 83 |
@@ -32,21 +32,21 @@ discard block |
||
32 | 32 | $worksheet = $objPHPExcel->getActiveSheet(); |
33 | 33 | |
34 | 34 | // Add some data |
35 | -$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), |
|
36 | - array( 'Apple', 18, 20, 14, 105.00 ), |
|
37 | - array( 'Pear', 12, 12, 10, 96.00 ), |
|
38 | - array( 'Cherry', 13, 14, 9, 105.00 ), |
|
39 | - array( 'Apple', 14, 15, 10, 75.00 ), |
|
40 | - array( 'Pear', 9, 8, 8, 76.80 ), |
|
41 | - array( 'Apple', 8, 9, 6, 45.00 ), |
|
35 | +$database = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit'), |
|
36 | + array('Apple', 18, 20, 14, 105.00), |
|
37 | + array('Pear', 12, 12, 10, 96.00), |
|
38 | + array('Cherry', 13, 14, 9, 105.00), |
|
39 | + array('Apple', 14, 15, 10, 75.00), |
|
40 | + array('Pear', 9, 8, 8, 76.80), |
|
41 | + array('Apple', 8, 9, 6, 45.00), |
|
42 | 42 | ); |
43 | -$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), |
|
44 | - array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | - array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
43 | +$criteria = array(array('Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'), |
|
44 | + array('="=Apple"', '>10', NULL, NULL, NULL, '<16'), |
|
45 | + array('="=Pear"', NULL, NULL, NULL, NULL, NULL) |
|
46 | 46 | ); |
47 | 47 | |
48 | -$worksheet->fromArray( $criteria, NULL, 'A1' ); |
|
49 | -$worksheet->fromArray( $database, NULL, 'A4' ); |
|
48 | +$worksheet->fromArray($criteria, NULL, 'A1'); |
|
49 | +$worksheet->fromArray($database, NULL, 'A4'); |
|
50 | 50 | |
51 | 51 | $worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall'); |
52 | 52 | $worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | echo '<h4>Database</h4>'; |
59 | 59 | |
60 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
60 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
61 | 61 | var_dump($databaseData); |
62 | 62 | |
63 | 63 | |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | echo 'ALL' . '<br /><br />'; |
71 | 71 | |
72 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
73 | -echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
72 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
73 | +echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
74 | 74 | |
75 | 75 | echo '<h4>Criteria</h4>'; |
76 | 76 | |
77 | -$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); |
|
77 | +$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); |
|
78 | 78 | var_dump($criteriaData); |
79 | 79 | |
80 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
80 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
81 | 81 | echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
82 | 82 | |
83 | 83 |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | */ |
748 | 748 | public static function parseComplex($complexNumber) |
749 | 749 | { |
750 | - $workString = (string)$complexNumber; |
|
750 | + $workString = (string) $complexNumber; |
|
751 | 751 | |
752 | 752 | $realNumber = $imaginary = 0; |
753 | 753 | // Extract the suffix, if there is one |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | { |
829 | 829 | if (!is_null($places)) { |
830 | 830 | if (is_numeric($places)) { |
831 | - $places = (int)$places; |
|
831 | + $places = (int) $places; |
|
832 | 832 | } else { |
833 | 833 | return Functions::VALUE(); |
834 | 834 | } |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | |
1154 | 1154 | if (is_bool($x)) { |
1155 | 1155 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1156 | - $x = (int)$x; |
|
1156 | + $x = (int) $x; |
|
1157 | 1157 | } else { |
1158 | 1158 | return Functions::VALUE(); |
1159 | 1159 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1162 | 1162 | $x = floor($x); |
1163 | 1163 | } |
1164 | - $x = (string)$x; |
|
1164 | + $x = (string) $x; |
|
1165 | 1165 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1166 | 1166 | return Functions::NAN(); |
1167 | 1167 | } |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | // Argument X |
1209 | 1209 | if (is_bool($x)) { |
1210 | 1210 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1211 | - $x = (int)$x; |
|
1211 | + $x = (int) $x; |
|
1212 | 1212 | } else { |
1213 | 1213 | return Functions::VALUE(); |
1214 | 1214 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1217 | 1217 | $x = floor($x); |
1218 | 1218 | } |
1219 | - $x = (string)$x; |
|
1219 | + $x = (string) $x; |
|
1220 | 1220 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1221 | 1221 | return Functions::NAN(); |
1222 | 1222 | } |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | // Two's Complement |
1227 | 1227 | return str_repeat('F', 8) . substr(strtoupper(dechex(bindec(substr($x, -9)))), -2); |
1228 | 1228 | } |
1229 | - $hexVal = (string)strtoupper(dechex(bindec($x))); |
|
1229 | + $hexVal = (string) strtoupper(dechex(bindec($x))); |
|
1230 | 1230 | |
1231 | 1231 | return self::nbrConversionFormat($hexVal, $places); |
1232 | 1232 | } |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | if (is_bool($x)) { |
1265 | 1265 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1266 | - $x = (int)$x; |
|
1266 | + $x = (int) $x; |
|
1267 | 1267 | } else { |
1268 | 1268 | return Functions::VALUE(); |
1269 | 1269 | } |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1272 | 1272 | $x = floor($x); |
1273 | 1273 | } |
1274 | - $x = (string)$x; |
|
1274 | + $x = (string) $x; |
|
1275 | 1275 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1276 | 1276 | return Functions::NAN(); |
1277 | 1277 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | // Two's Complement |
1282 | 1282 | return str_repeat('7', 7) . substr(strtoupper(decoct(bindec(substr($x, -9)))), -3); |
1283 | 1283 | } |
1284 | - $octVal = (string)decoct(bindec($x)); |
|
1284 | + $octVal = (string) decoct(bindec($x)); |
|
1285 | 1285 | |
1286 | 1286 | return self::nbrConversionFormat($octVal, $places); |
1287 | 1287 | } |
@@ -1322,17 +1322,17 @@ discard block |
||
1322 | 1322 | |
1323 | 1323 | if (is_bool($x)) { |
1324 | 1324 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1325 | - $x = (int)$x; |
|
1325 | + $x = (int) $x; |
|
1326 | 1326 | } else { |
1327 | 1327 | return Functions::VALUE(); |
1328 | 1328 | } |
1329 | 1329 | } |
1330 | - $x = (string)$x; |
|
1330 | + $x = (string) $x; |
|
1331 | 1331 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1332 | 1332 | return Functions::VALUE(); |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - $x = (string)floor($x); |
|
1335 | + $x = (string) floor($x); |
|
1336 | 1336 | if ($x < -512 || $x > 511) { |
1337 | 1337 | return Functions::NAN(); |
1338 | 1338 | } |
@@ -1383,16 +1383,16 @@ discard block |
||
1383 | 1383 | |
1384 | 1384 | if (is_bool($x)) { |
1385 | 1385 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1386 | - $x = (int)$x; |
|
1386 | + $x = (int) $x; |
|
1387 | 1387 | } else { |
1388 | 1388 | return Functions::VALUE(); |
1389 | 1389 | } |
1390 | 1390 | } |
1391 | - $x = (string)$x; |
|
1391 | + $x = (string) $x; |
|
1392 | 1392 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1393 | 1393 | return Functions::VALUE(); |
1394 | 1394 | } |
1395 | - $x = (string)floor($x); |
|
1395 | + $x = (string) floor($x); |
|
1396 | 1396 | $r = strtoupper(dechex($x)); |
1397 | 1397 | if (strlen($r) == 8) { |
1398 | 1398 | // Two's Complement |
@@ -1439,16 +1439,16 @@ discard block |
||
1439 | 1439 | |
1440 | 1440 | if (is_bool($x)) { |
1441 | 1441 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1442 | - $x = (int)$x; |
|
1442 | + $x = (int) $x; |
|
1443 | 1443 | } else { |
1444 | 1444 | return Functions::VALUE(); |
1445 | 1445 | } |
1446 | 1446 | } |
1447 | - $x = (string)$x; |
|
1447 | + $x = (string) $x; |
|
1448 | 1448 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1449 | 1449 | return Functions::VALUE(); |
1450 | 1450 | } |
1451 | - $x = (string)floor($x); |
|
1451 | + $x = (string) floor($x); |
|
1452 | 1452 | $r = decoct($x); |
1453 | 1453 | if (strlen($r) == 11) { |
1454 | 1454 | // Two's Complement |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | if (is_bool($x)) { |
1496 | 1496 | return Functions::VALUE(); |
1497 | 1497 | } |
1498 | - $x = (string)$x; |
|
1498 | + $x = (string) $x; |
|
1499 | 1499 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1500 | 1500 | return Functions::NAN(); |
1501 | 1501 | } |
@@ -1530,12 +1530,12 @@ discard block |
||
1530 | 1530 | if (is_bool($x)) { |
1531 | 1531 | return Functions::VALUE(); |
1532 | 1532 | } |
1533 | - $x = (string)$x; |
|
1533 | + $x = (string) $x; |
|
1534 | 1534 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1535 | 1535 | return Functions::NAN(); |
1536 | 1536 | } |
1537 | 1537 | |
1538 | - if (strlen($x)> 10) { |
|
1538 | + if (strlen($x) > 10) { |
|
1539 | 1539 | return Functions::NAN(); |
1540 | 1540 | } |
1541 | 1541 | |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | if (is_bool($x)) { |
1594 | 1594 | return Functions::VALUE(); |
1595 | 1595 | } |
1596 | - $x = (string)$x; |
|
1596 | + $x = (string) $x; |
|
1597 | 1597 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1598 | 1598 | return Functions::NAN(); |
1599 | 1599 | } |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | if (is_bool($x)) { |
1649 | 1649 | return Functions::VALUE(); |
1650 | 1650 | } |
1651 | - $x = (string)$x; |
|
1651 | + $x = (string) $x; |
|
1652 | 1652 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1653 | 1653 | return Functions::NAN(); |
1654 | 1654 | } |
@@ -1683,13 +1683,13 @@ discard block |
||
1683 | 1683 | if (is_bool($x)) { |
1684 | 1684 | return Functions::VALUE(); |
1685 | 1685 | } |
1686 | - $x = (string)$x; |
|
1686 | + $x = (string) $x; |
|
1687 | 1687 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1688 | 1688 | return Functions::NAN(); |
1689 | 1689 | } |
1690 | 1690 | $binX = ''; |
1691 | 1691 | foreach (str_split($x) as $char) { |
1692 | - $binX .= str_pad(decbin((int)$char), 3, '0', STR_PAD_LEFT); |
|
1692 | + $binX .= str_pad(decbin((int) $char), 3, '0', STR_PAD_LEFT); |
|
1693 | 1693 | } |
1694 | 1694 | if (strlen($binX) == 30 && $binX[0] == '1') { |
1695 | 1695 | for ($i = 0; $i < 30; $i++) { |
@@ -1737,7 +1737,7 @@ discard block |
||
1737 | 1737 | if (is_bool($x)) { |
1738 | 1738 | return Functions::VALUE(); |
1739 | 1739 | } |
1740 | - $x = (string)$x; |
|
1740 | + $x = (string) $x; |
|
1741 | 1741 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1742 | 1742 | return Functions::NAN(); |
1743 | 1743 | } |
@@ -1772,32 +1772,32 @@ discard block |
||
1772 | 1772 | if (((is_numeric($realNumber)) && (is_numeric($imaginary))) && |
1773 | 1773 | (($suffix == 'i') || ($suffix == 'j') || ($suffix == '')) |
1774 | 1774 | ) { |
1775 | - $realNumber = (float)$realNumber; |
|
1776 | - $imaginary = (float)$imaginary; |
|
1775 | + $realNumber = (float) $realNumber; |
|
1776 | + $imaginary = (float) $imaginary; |
|
1777 | 1777 | |
1778 | 1778 | if ($suffix == '') { |
1779 | 1779 | $suffix = 'i'; |
1780 | 1780 | } |
1781 | 1781 | if ($realNumber == 0.0) { |
1782 | 1782 | if ($imaginary == 0.0) { |
1783 | - return (string)'0'; |
|
1783 | + return (string) '0'; |
|
1784 | 1784 | } elseif ($imaginary == 1.0) { |
1785 | - return (string)$suffix; |
|
1785 | + return (string) $suffix; |
|
1786 | 1786 | } elseif ($imaginary == -1.0) { |
1787 | - return (string)'-' . $suffix; |
|
1787 | + return (string) '-' . $suffix; |
|
1788 | 1788 | } |
1789 | - return (string)$imaginary . $suffix; |
|
1789 | + return (string) $imaginary . $suffix; |
|
1790 | 1790 | } elseif ($imaginary == 0.0) { |
1791 | - return (string)$realNumber; |
|
1791 | + return (string) $realNumber; |
|
1792 | 1792 | } elseif ($imaginary == 1.0) { |
1793 | - return (string)$realNumber . '+' . $suffix; |
|
1793 | + return (string) $realNumber . '+' . $suffix; |
|
1794 | 1794 | } elseif ($imaginary == -1.0) { |
1795 | - return (string)$realNumber . '-' . $suffix; |
|
1795 | + return (string) $realNumber . '-' . $suffix; |
|
1796 | 1796 | } |
1797 | 1797 | if ($imaginary > 0) { |
1798 | - $imaginary = (string)'+' . $imaginary; |
|
1798 | + $imaginary = (string) '+' . $imaginary; |
|
1799 | 1799 | } |
1800 | - return (string)$realNumber . $imaginary . $suffix; |
|
1800 | + return (string) $realNumber . $imaginary . $suffix; |
|
1801 | 1801 | } |
1802 | 1802 | |
1803 | 1803 | return Functions::VALUE(); |
@@ -2362,7 +2362,7 @@ discard block |
||
2362 | 2362 | $a = Functions::flattenSingleValue($a); |
2363 | 2363 | $b = Functions::flattenSingleValue($b); |
2364 | 2364 | |
2365 | - return (int)($a == $b); |
|
2365 | + return (int) ($a == $b); |
|
2366 | 2366 | } |
2367 | 2367 | |
2368 | 2368 | |
@@ -2386,7 +2386,7 @@ discard block |
||
2386 | 2386 | $number = Functions::flattenSingleValue($number); |
2387 | 2387 | $step = Functions::flattenSingleValue($step); |
2388 | 2388 | |
2389 | - return (int)($number >= $step); |
|
2389 | + return (int) ($number >= $step); |
|
2390 | 2390 | } |
2391 | 2391 | |
2392 | 2392 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $fileHandle = parent::prepareForSave($pFilename); |
59 | 59 | |
60 | 60 | // Default PDF paper size |
61 | - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
61 | + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
62 | 62 | |
63 | 63 | // Check for paper size and page orientation |
64 | 64 | if (is_null($this->getSheetIndex())) { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $fileHandle = parent::prepareForSave($pFilename); |
59 | 59 | |
60 | 60 | // Default PDF paper size |
61 | - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
61 | + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|
62 | 62 | |
63 | 63 | // Check for paper size and page orientation |
64 | 64 | if (is_null($this->getSheetIndex())) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ini_set('display_errors', TRUE); |
30 | 30 | ini_set('display_startup_errors', TRUE); |
31 | 31 | |
32 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
32 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
33 | 33 | |
34 | 34 | date_default_timezone_set('Europe/London'); |
35 | 35 | |
@@ -41,19 +41,19 @@ discard block |
||
41 | 41 | exit("Please run 05featuredemo.php first." . EOL); |
42 | 42 | } |
43 | 43 | |
44 | -echo date('H:i:s') , " Load from Excel2007 file" , EOL; |
|
44 | +echo date('H:i:s'), " Load from Excel2007 file", EOL; |
|
45 | 45 | $callStartTime = microtime(true); |
46 | 46 | |
47 | 47 | $objPHPExcel = \PHPExcel\IOFactory::load("05featuredemo.xlsx"); |
48 | 48 | |
49 | 49 | $callEndTime = microtime(true); |
50 | 50 | $callTime = $callEndTime - $callStartTime; |
51 | -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
51 | +echo 'Call time to read Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
52 | 52 | // Echo memory usage |
53 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
53 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
54 | 54 | |
55 | 55 | |
56 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
56 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
57 | 57 | $callStartTime = microtime(true); |
58 | 58 | |
59 | 59 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | $callEndTime = microtime(true); |
63 | 63 | $callTime = $callEndTime - $callStartTime; |
64 | 64 | |
65 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
66 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
65 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
66 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
67 | 67 | // Echo memory usage |
68 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
68 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
69 | 69 | |
70 | 70 | |
71 | 71 | // Echo memory peak usage |
72 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
72 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
73 | 73 | |
74 | 74 | // Echo done |
75 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
76 | -echo 'File has been created in ' , getcwd() , EOL; |
|
75 | +echo date('H:i:s'), " Done writing file", EOL; |
|
76 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | ini_set('display_startup_errors', TRUE); |
7 | 7 | date_default_timezone_set('Europe/London'); |
8 | 8 | |
9 | -define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
9 | +define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); |
|
10 | 10 | |
11 | 11 | date_default_timezone_set('Europe/London'); |
12 | 12 | |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $objWorksheet = $objPHPExcel->getActiveSheet(); |
45 | 45 | $objWorksheet->fromArray( |
46 | 46 | array( |
47 | - array('', 2010, 2011, 2012), |
|
48 | - array('Q1', 12, 15, 21), |
|
49 | - array('Q2', 56, 73, 86), |
|
50 | - array('Q3', 52, 61, 69), |
|
51 | - array('Q4', 30, 32, 0), |
|
47 | + array('', 2010, 2011, 2012), |
|
48 | + array('Q1', 12, 15, 21), |
|
49 | + array('Q2', 56, 73, 86), |
|
50 | + array('Q3', 52, 61, 69), |
|
51 | + array('Q4', 30, 32, 0), |
|
52 | 52 | ) |
53 | 53 | ); |
54 | 54 | |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | // Data values |
61 | 61 | // Data Marker |
62 | 62 | $dataSeriesLabels = array( |
63 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
64 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
65 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
63 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010 |
|
64 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011 |
|
65 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012 |
|
66 | 66 | ); |
67 | 67 | // Set the X-Axis Labels |
68 | 68 | $xAxisTickValues = array( |
69 | - new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
69 | + new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4 |
|
70 | 70 | ); |
71 | 71 | // Set the Data values for each data series we want to plot |
72 | 72 | // Datatype |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | |
84 | 84 | // Build the dataseries |
85 | 85 | $series = new \PHPExcel\Chart\DataSeries( |
86 | - \PHPExcel\Chart\DataSeries::TYPE_SCATTERCHART, // plotType |
|
87 | - NULL, // plotGrouping (Scatter charts don't have any grouping) |
|
88 | - range(0, count($dataSeriesValues)-1), // plotOrder |
|
89 | - $dataSeriesLabels, // plotLabel |
|
90 | - $xAxisTickValues, // plotCategory |
|
91 | - $dataSeriesValues, // plotValues |
|
92 | - NULL, // plotDirection |
|
93 | - NULL, // smooth line |
|
86 | + \PHPExcel\Chart\DataSeries::TYPE_SCATTERCHART, // plotType |
|
87 | + NULL, // plotGrouping (Scatter charts don't have any grouping) |
|
88 | + range(0, count($dataSeriesValues) - 1), // plotOrder |
|
89 | + $dataSeriesLabels, // plotLabel |
|
90 | + $xAxisTickValues, // plotCategory |
|
91 | + $dataSeriesValues, // plotValues |
|
92 | + NULL, // plotDirection |
|
93 | + NULL, // smooth line |
|
94 | 94 | \PHPExcel\Chart\DataSeries::STYLE_LINEMARKER // plotStyle |
95 | 95 | ); |
96 | 96 | |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | |
106 | 106 | // Create the chart |
107 | 107 | $chart = new \PHPExcel\Chart( |
108 | - 'chart1', // name |
|
109 | - $title, // title |
|
110 | - $legend, // legend |
|
111 | - $plotArea, // plotArea |
|
112 | - true, // plotVisibleOnly |
|
113 | - 0, // displayBlanksAs |
|
114 | - NULL, // xAxisLabel |
|
108 | + 'chart1', // name |
|
109 | + $title, // title |
|
110 | + $legend, // legend |
|
111 | + $plotArea, // plotArea |
|
112 | + true, // plotVisibleOnly |
|
113 | + 0, // displayBlanksAs |
|
114 | + NULL, // xAxisLabel |
|
115 | 115 | $yAxisLabel // yAxisLabel |
116 | 116 | ); |
117 | 117 | |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | // Save Excel 2007 file |
127 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
127 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
128 | 128 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
129 | 129 | $objWriter->setIncludeCharts(TRUE); |
130 | 130 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
131 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
131 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
132 | 132 | |
133 | 133 | |
134 | 134 | // Echo memory peak usage |
135 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
135 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
136 | 136 | |
137 | 137 | // Echo done |
138 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
139 | -echo 'File has been created in ' , getcwd() , EOL; |
|
138 | +echo date('H:i:s'), " Done writing file", EOL; |
|
139 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -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 | |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | // Create new PHPExcel object |
43 | -echo date('H:i:s') , " Create new PHPExcel object" , EOL; |
|
43 | +echo date('H:i:s'), " Create new PHPExcel object", EOL; |
|
44 | 44 | $objPHPExcel = new \PHPExcel\Spreadsheet(); |
45 | 45 | |
46 | 46 | // Set document properties |
47 | -echo date('H:i:s') , " Set document properties" , EOL; |
|
47 | +echo date('H:i:s'), " Set document properties", EOL; |
|
48 | 48 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
49 | 49 | ->setLastModifiedBy("Maarten Balliauw") |
50 | 50 | ->setTitle("Office 2007 XLSX Test Document") |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | // Add some data |
58 | -echo date('H:i:s') , " Add some data" , EOL; |
|
58 | +echo date('H:i:s'), " Add some data", EOL; |
|
59 | 59 | $objPHPExcel->setActiveSheetIndex(0); |
60 | 60 | |
61 | 61 | $sharedStyle1 = new \PHPExcel\Style(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $objPHPExcel->getActiveSheet()->duplicateStyle($sharedStyle2, "C5:R95"); |
88 | 88 | |
89 | 89 | // Save Excel 2007 file |
90 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
90 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
91 | 91 | $callStartTime = microtime(true); |
92 | 92 | |
93 | 93 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | $callEndTime = microtime(true); |
96 | 96 | $callTime = $callEndTime - $callStartTime; |
97 | 97 | |
98 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
99 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
98 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
99 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
100 | 100 | // Echo memory usage |
101 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
101 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
102 | 102 | |
103 | 103 | |
104 | 104 | // Save Excel 95 file |
105 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
105 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
106 | 106 | $callStartTime = microtime(true); |
107 | 107 | |
108 | 108 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | $callEndTime = microtime(true); |
111 | 111 | $callTime = $callEndTime - $callStartTime; |
112 | 112 | |
113 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
114 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
113 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
114 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
115 | 115 | // Echo memory usage |
116 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
116 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
117 | 117 | |
118 | 118 | |
119 | 119 | // Echo memory peak usage |
120 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
120 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
121 | 121 | |
122 | 122 | // Echo done |
123 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
124 | -echo 'File has been created in ' , getcwd() , EOL; |
|
123 | +echo date('H:i:s'), " Done writing file", EOL; |
|
124 | +echo 'File has been created in ', getcwd(), EOL; |