@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
39 | 39 | |
40 | 40 | if (!file_exists("05featuredemo.xlsx")) { |
41 | - exit("Please run 05featuredemo.php first." . EOL); |
|
41 | + exit("Please run 05featuredemo.php first." . EOL); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | echo date('H:i:s') , " Load from Excel2007 file" , EOL; |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | |
48 | 48 | echo date('H:i:s') , " Iterate worksheets" , EOL; |
49 | 49 | foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { |
50 | - echo 'Worksheet - ' , $worksheet->getTitle() , EOL; |
|
50 | + echo 'Worksheet - ' , $worksheet->getTitle() , EOL; |
|
51 | 51 | |
52 | - foreach ($worksheet->getRowIterator() as $row) { |
|
53 | - echo ' Row number - ' , $row->getRowIndex() , EOL; |
|
52 | + foreach ($worksheet->getRowIterator() as $row) { |
|
53 | + echo ' Row number - ' , $row->getRowIndex() , EOL; |
|
54 | 54 | |
55 | - $cellIterator = $row->getCellIterator(); |
|
56 | - $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set |
|
57 | - foreach ($cellIterator as $cell) { |
|
58 | - if (!is_null($cell)) { |
|
59 | - echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL; |
|
60 | - } |
|
61 | - } |
|
62 | - } |
|
55 | + $cellIterator = $row->getCellIterator(); |
|
56 | + $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set |
|
57 | + foreach ($cellIterator as $cell) { |
|
58 | + if (!is_null($cell)) { |
|
59 | + echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL; |
|
60 | + } |
|
61 | + } |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | |
65 | 65 |
@@ -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,22 +41,22 @@ 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 | $objReader = \PHPExcel\IOFactory::createReader('Excel2007'); |
46 | 46 | $objPHPExcel = $objReader->load("05featuredemo.xlsx"); |
47 | 47 | |
48 | -echo date('H:i:s') , " Iterate worksheets" , EOL; |
|
48 | +echo date('H:i:s'), " Iterate worksheets", EOL; |
|
49 | 49 | foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { |
50 | - echo 'Worksheet - ' , $worksheet->getTitle() , EOL; |
|
50 | + echo 'Worksheet - ', $worksheet->getTitle(), EOL; |
|
51 | 51 | |
52 | 52 | foreach ($worksheet->getRowIterator() as $row) { |
53 | - echo ' Row number - ' , $row->getRowIndex() , EOL; |
|
53 | + echo ' Row number - ', $row->getRowIndex(), EOL; |
|
54 | 54 | |
55 | 55 | $cellIterator = $row->getCellIterator(); |
56 | 56 | $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set |
57 | 57 | foreach ($cellIterator as $cell) { |
58 | 58 | if (!is_null($cell)) { |
59 | - echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL; |
|
59 | + echo ' Cell - ', $cell->getCoordinate(), ' - ', $cell->getCalculatedValue(), EOL; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
@@ -64,4 +64,4 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | // Echo memory peak usage |
67 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
67 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
@@ -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 | |
@@ -37,38 +37,38 @@ discard block |
||
37 | 37 | require_once dirname(__FILE__) . '/../src/Bootstrap.php'; |
38 | 38 | |
39 | 39 | |
40 | -echo date('H:i:s') , " Load MergeBook1 from Excel2007 file" , EOL; |
|
40 | +echo date('H:i:s'), " Load MergeBook1 from Excel2007 file", EOL; |
|
41 | 41 | $callStartTime = microtime(true); |
42 | 42 | |
43 | 43 | $objPHPExcel1 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook1.xlsx"); |
44 | 44 | |
45 | 45 | $callEndTime = microtime(true); |
46 | 46 | $callTime = $callEndTime - $callStartTime; |
47 | -echo 'Call time to read Mergebook1 was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
47 | +echo 'Call time to read Mergebook1 was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
48 | 48 | // Echo memory usage |
49 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
49 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
50 | 50 | |
51 | 51 | |
52 | -echo date('H:i:s') , " Load MergeBook2 from Excel2007 file" , EOL; |
|
52 | +echo date('H:i:s'), " Load MergeBook2 from Excel2007 file", EOL; |
|
53 | 53 | $callStartTime = microtime(true); |
54 | 54 | |
55 | 55 | $objPHPExcel2 = \PHPExcel\IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook2.xlsx"); |
56 | 56 | |
57 | 57 | $callEndTime = microtime(true); |
58 | 58 | $callTime = $callEndTime - $callStartTime; |
59 | -echo 'Call time to read Mergebook2 was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
59 | +echo 'Call time to read Mergebook2 was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
60 | 60 | // Echo memory usage |
61 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
61 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
62 | 62 | |
63 | 63 | |
64 | -foreach($objPHPExcel2->getSheetNames() as $sheetName) { |
|
64 | +foreach ($objPHPExcel2->getSheetNames() as $sheetName) { |
|
65 | 65 | $sheet = $objPHPExcel2->getSheetByName($sheetName); |
66 | 66 | $sheet->setTitle($sheet->getTitle() . ' copied'); |
67 | 67 | $objPHPExcel1->addExternalSheet($sheet); |
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
71 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
72 | 72 | $callStartTime = microtime(true); |
73 | 73 | |
74 | 74 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel1, 'Excel2007'); |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | $callEndTime = microtime(true); |
78 | 78 | $callTime = $callEndTime - $callStartTime; |
79 | 79 | |
80 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
81 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
80 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
81 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
82 | 82 | // Echo memory usage |
83 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
83 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
84 | 84 | |
85 | 85 | |
86 | 86 | // Echo memory peak usage |
87 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
87 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
88 | 88 | |
89 | 89 | // Echo done |
90 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
91 | -echo 'File has been created in ' , getcwd() , EOL; |
|
90 | +echo date('H:i:s'), " Done writing file", EOL; |
|
91 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -44,12 +44,12 @@ 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("Office 2007 XLSX Test Document") |
|
49 | - ->setSubject("Office 2007 XLSX Test Document") |
|
50 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
51 | - ->setKeywords("office 2007 openxml php") |
|
52 | - ->setCategory("Test result file"); |
|
47 | + ->setLastModifiedBy("Maarten Balliauw") |
|
48 | + ->setTitle("Office 2007 XLSX Test Document") |
|
49 | + ->setSubject("Office 2007 XLSX Test Document") |
|
50 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
51 | + ->setKeywords("office 2007 openxml php") |
|
52 | + ->setCategory("Test result file"); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | // Add some data, we will use some formulas here |
@@ -57,40 +57,40 @@ discard block |
||
57 | 57 | $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Sum:'); |
58 | 58 | |
59 | 59 | $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range #1') |
60 | - ->setCellValue('B2', 3) |
|
61 | - ->setCellValue('B3', 7) |
|
62 | - ->setCellValue('B4', 13) |
|
63 | - ->setCellValue('B5', '=SUM(B2:B4)'); |
|
60 | + ->setCellValue('B2', 3) |
|
61 | + ->setCellValue('B3', 7) |
|
62 | + ->setCellValue('B4', 13) |
|
63 | + ->setCellValue('B5', '=SUM(B2:B4)'); |
|
64 | 64 | echo date('H:i:s') , " Sum of Range #1 is " , |
65 | - $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue() , EOL; |
|
65 | + $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue() , EOL; |
|
66 | 66 | |
67 | 67 | $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range #2') |
68 | - ->setCellValue('C2', 5) |
|
69 | - ->setCellValue('C3', 11) |
|
70 | - ->setCellValue('C4', 17) |
|
71 | - ->setCellValue('C5', '=SUM(C2:C4)'); |
|
68 | + ->setCellValue('C2', 5) |
|
69 | + ->setCellValue('C3', 11) |
|
70 | + ->setCellValue('C4', 17) |
|
71 | + ->setCellValue('C5', '=SUM(C2:C4)'); |
|
72 | 72 | echo date('H:i:s') , " Sum of Range #2 is " , |
73 | - $objPHPExcel->getActiveSheet()->getCell('C5')->getCalculatedValue() , EOL; |
|
73 | + $objPHPExcel->getActiveSheet()->getCell('C5')->getCalculatedValue() , EOL; |
|
74 | 74 | |
75 | 75 | $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total of both ranges:'); |
76 | 76 | $objPHPExcel->getActiveSheet()->setCellValue('B7', '=SUM(B5:C5)'); |
77 | 77 | echo date('H:i:s') , " Sum of both Ranges is " , |
78 | - $objPHPExcel->getActiveSheet()->getCell('B7')->getCalculatedValue() , EOL; |
|
78 | + $objPHPExcel->getActiveSheet()->getCell('B7')->getCalculatedValue() , EOL; |
|
79 | 79 | |
80 | 80 | $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Minimum of both ranges:'); |
81 | 81 | $objPHPExcel->getActiveSheet()->setCellValue('B8', '=MIN(B2:C4)'); |
82 | 82 | echo date('H:i:s') , " Minimum value in either Range is " , |
83 | - $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue() , EOL; |
|
83 | + $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue() , EOL; |
|
84 | 84 | |
85 | 85 | $objPHPExcel->getActiveSheet()->setCellValue('A9', 'Maximum of both ranges:'); |
86 | 86 | $objPHPExcel->getActiveSheet()->setCellValue('B9', '=MAX(B2:C4)'); |
87 | 87 | echo date('H:i:s') , " Maximum value in either Range is " , |
88 | - $objPHPExcel->getActiveSheet()->getCell('B9')->getCalculatedValue() , EOL; |
|
88 | + $objPHPExcel->getActiveSheet()->getCell('B9')->getCalculatedValue() , EOL; |
|
89 | 89 | |
90 | 90 | $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Average of both ranges:'); |
91 | 91 | $objPHPExcel->getActiveSheet()->setCellValue('B10', '=AVERAGE(B2:C4)'); |
92 | 92 | echo date('H:i:s') , " Average value of both Ranges is " , |
93 | - $objPHPExcel->getActiveSheet()->getCell('B10')->getCalculatedValue() , EOL; |
|
93 | + $objPHPExcel->getActiveSheet()->getCell('B10')->getCalculatedValue() , EOL; |
|
94 | 94 | |
95 | 95 | |
96 | 96 | // Rename worksheet |
@@ -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("Office 2007 XLSX Test Document") |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | |
55 | 55 | // Add some data, we will use some formulas here |
56 | -echo date('H:i:s') , " Add some data" , EOL; |
|
56 | +echo date('H:i:s'), " Add some data", EOL; |
|
57 | 57 | $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Sum:'); |
58 | 58 | |
59 | 59 | $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range #1') |
@@ -61,40 +61,40 @@ discard block |
||
61 | 61 | ->setCellValue('B3', 7) |
62 | 62 | ->setCellValue('B4', 13) |
63 | 63 | ->setCellValue('B5', '=SUM(B2:B4)'); |
64 | -echo date('H:i:s') , " Sum of Range #1 is " , |
|
65 | - $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue() , EOL; |
|
64 | +echo date('H:i:s'), " Sum of Range #1 is ", |
|
65 | + $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue(), EOL; |
|
66 | 66 | |
67 | 67 | $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range #2') |
68 | 68 | ->setCellValue('C2', 5) |
69 | 69 | ->setCellValue('C3', 11) |
70 | 70 | ->setCellValue('C4', 17) |
71 | 71 | ->setCellValue('C5', '=SUM(C2:C4)'); |
72 | -echo date('H:i:s') , " Sum of Range #2 is " , |
|
73 | - $objPHPExcel->getActiveSheet()->getCell('C5')->getCalculatedValue() , EOL; |
|
72 | +echo date('H:i:s'), " Sum of Range #2 is ", |
|
73 | + $objPHPExcel->getActiveSheet()->getCell('C5')->getCalculatedValue(), EOL; |
|
74 | 74 | |
75 | 75 | $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total of both ranges:'); |
76 | 76 | $objPHPExcel->getActiveSheet()->setCellValue('B7', '=SUM(B5:C5)'); |
77 | -echo date('H:i:s') , " Sum of both Ranges is " , |
|
78 | - $objPHPExcel->getActiveSheet()->getCell('B7')->getCalculatedValue() , EOL; |
|
77 | +echo date('H:i:s'), " Sum of both Ranges is ", |
|
78 | + $objPHPExcel->getActiveSheet()->getCell('B7')->getCalculatedValue(), EOL; |
|
79 | 79 | |
80 | 80 | $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Minimum of both ranges:'); |
81 | 81 | $objPHPExcel->getActiveSheet()->setCellValue('B8', '=MIN(B2:C4)'); |
82 | -echo date('H:i:s') , " Minimum value in either Range is " , |
|
83 | - $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue() , EOL; |
|
82 | +echo date('H:i:s'), " Minimum value in either Range is ", |
|
83 | + $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue(), EOL; |
|
84 | 84 | |
85 | 85 | $objPHPExcel->getActiveSheet()->setCellValue('A9', 'Maximum of both ranges:'); |
86 | 86 | $objPHPExcel->getActiveSheet()->setCellValue('B9', '=MAX(B2:C4)'); |
87 | -echo date('H:i:s') , " Maximum value in either Range is " , |
|
88 | - $objPHPExcel->getActiveSheet()->getCell('B9')->getCalculatedValue() , EOL; |
|
87 | +echo date('H:i:s'), " Maximum value in either Range is ", |
|
88 | + $objPHPExcel->getActiveSheet()->getCell('B9')->getCalculatedValue(), EOL; |
|
89 | 89 | |
90 | 90 | $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Average of both ranges:'); |
91 | 91 | $objPHPExcel->getActiveSheet()->setCellValue('B10', '=AVERAGE(B2:C4)'); |
92 | -echo date('H:i:s') , " Average value of both Ranges is " , |
|
93 | - $objPHPExcel->getActiveSheet()->getCell('B10')->getCalculatedValue() , EOL; |
|
92 | +echo date('H:i:s'), " Average value of both Ranges is ", |
|
93 | + $objPHPExcel->getActiveSheet()->getCell('B10')->getCalculatedValue(), EOL; |
|
94 | 94 | |
95 | 95 | |
96 | 96 | // Rename worksheet |
97 | -echo date('H:i:s') , " Rename worksheet" , EOL; |
|
97 | +echo date('H:i:s'), " Rename worksheet", EOL; |
|
98 | 98 | $objPHPExcel->getActiveSheet()->setTitle('Formulas'); |
99 | 99 | |
100 | 100 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | // Save Excel 2007 file |
106 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
106 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
107 | 107 | $callStartTime = microtime(true); |
108 | 108 | |
109 | 109 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | $callEndTime = microtime(true); |
121 | 121 | $callTime = $callEndTime - $callStartTime; |
122 | 122 | |
123 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
124 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
123 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
124 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
125 | 125 | // Echo memory usage |
126 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
126 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
127 | 127 | |
128 | 128 | |
129 | 129 | // Save Excel 95 file |
130 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
130 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
131 | 131 | $callStartTime = microtime(true); |
132 | 132 | |
133 | 133 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | $callEndTime = microtime(true); |
136 | 136 | $callTime = $callEndTime - $callStartTime; |
137 | 137 | |
138 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
139 | -echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
138 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
139 | +echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL; |
|
140 | 140 | // Echo memory usage |
141 | -echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
141 | +echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL; |
|
142 | 142 | |
143 | 143 | |
144 | 144 | // Echo memory peak usage |
145 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
145 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
146 | 146 | |
147 | 147 | // Echo done |
148 | -echo date('H:i:s') , " Done writing files" , EOL; |
|
149 | -echo 'Files have been created in ' , getcwd() , EOL; |
|
148 | +echo date('H:i:s'), " Done writing files", EOL; |
|
149 | +echo 'Files have been created in ', getcwd(), EOL; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | |
58 | 58 | echo date('H:i:s') , " Adjust properties" , EOL; |
59 | 59 | $objPHPExcel->getProperties()->setTitle("Office 95 XLS Test Document") |
60 | - ->setSubject("Office 95 XLS Test Document") |
|
61 | - ->setDescription("Test XLS document, generated using PHPExcel") |
|
62 | - ->setKeywords("office 95 biff php"); |
|
60 | + ->setSubject("Office 95 XLS Test Document") |
|
61 | + ->setDescription("Test XLS document, generated using PHPExcel") |
|
62 | + ->setKeywords("office 95 biff php"); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | // Save Excel 95 file |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | echo 'Core Properties:' , EOL; |
85 | 85 | echo ' Created by - ' , $objPHPExcel->getProperties()->getCreator() , EOL; |
86 | 86 | echo ' Created on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getCreated()) , ' at ' , |
87 | - date('H:i:s',$objPHPExcel->getProperties()->getCreated()) , EOL; |
|
87 | + date('H:i:s',$objPHPExcel->getProperties()->getCreated()) , EOL; |
|
88 | 88 | echo ' Last Modified by - ' , $objPHPExcel->getProperties()->getLastModifiedBy() , EOL; |
89 | 89 | echo ' Last Modified on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getModified()) , ' at ' , |
90 | - date('H:i:s',$objPHPExcel->getProperties()->getModified()) , EOL; |
|
90 | + date('H:i:s',$objPHPExcel->getProperties()->getModified()) , EOL; |
|
91 | 91 | echo ' Title - ' , $objPHPExcel->getProperties()->getTitle() , EOL; |
92 | 92 | echo ' Subject - ' , $objPHPExcel->getProperties()->getSubject() , EOL; |
93 | 93 | echo ' Description - ' , $objPHPExcel->getProperties()->getDescription() , EOL; |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | echo 'Custom Properties:' , EOL; |
104 | 104 | $customProperties = $objPHPExcel->getProperties()->getCustomProperties(); |
105 | 105 | foreach($customProperties as $customProperty) { |
106 | - $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty); |
|
107 | - $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty); |
|
108 | - echo ' ' , $customProperty , ' - (' , $propertyType , ') - '; |
|
109 | - if ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE) { |
|
110 | - echo date('d-M-Y H:i:s',$propertyValue) , EOL; |
|
111 | - } elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) { |
|
112 | - echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL; |
|
113 | - } else { |
|
114 | - echo $propertyValue , EOL; |
|
115 | - } |
|
106 | + $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty); |
|
107 | + $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty); |
|
108 | + echo ' ' , $customProperty , ' - (' , $propertyType , ') - '; |
|
109 | + if ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE) { |
|
110 | + echo date('d-M-Y H:i:s',$propertyValue) , EOL; |
|
111 | + } elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) { |
|
112 | + echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL; |
|
113 | + } else { |
|
114 | + echo $propertyValue , EOL; |
|
115 | + } |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Echo memory peak usage |
@@ -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 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $inputFileName = 'templates/31docproperties.xls'; |
43 | 43 | |
44 | 44 | |
45 | -echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL; |
|
45 | +echo date('H:i:s'), " Load Tests from $inputFileType file", EOL; |
|
46 | 46 | $callStartTime = microtime(true); |
47 | 47 | |
48 | 48 | $objPHPExcelReader = \PHPExcel\IOFactory::createReader($inputFileType); |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | |
51 | 51 | $callEndTime = microtime(true); |
52 | 52 | $callTime = $callEndTime - $callStartTime; |
53 | -echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; |
|
53 | +echo 'Call time to read 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 | -echo date('H:i:s') , " Adjust properties" , EOL; |
|
58 | +echo date('H:i:s'), " Adjust properties", EOL; |
|
59 | 59 | $objPHPExcel->getProperties()->setTitle("Office 95 XLS Test Document") |
60 | 60 | ->setSubject("Office 95 XLS Test Document") |
61 | 61 | ->setDescription("Test XLS document, generated using PHPExcel") |
@@ -63,57 +63,57 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | // Save Excel 95 file |
66 | -echo date('H:i:s') , " Write to Excel5 format" , EOL; |
|
66 | +echo date('H:i:s'), " Write to Excel5 format", EOL; |
|
67 | 67 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5'); |
68 | 68 | $objWriter->save(str_replace('.php', '.xls', __FILE__)); |
69 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
69 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
70 | 70 | |
71 | 71 | |
72 | 72 | // Echo memory peak usage |
73 | -echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; |
|
73 | +echo date('H:i:s'), " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB", EOL; |
|
74 | 74 | |
75 | 75 | |
76 | 76 | echo EOL; |
77 | 77 | // Reread File |
78 | -echo date('H:i:s') , " Reread Excel5 file" , EOL; |
|
78 | +echo date('H:i:s'), " Reread Excel5 file", EOL; |
|
79 | 79 | $objPHPExcelRead = \PHPExcel\IOFactory::load(str_replace('.php', '.xls', __FILE__)); |
80 | 80 | |
81 | 81 | // Set properties |
82 | -echo date('H:i:s') , " Get properties" , EOL; |
|
82 | +echo date('H:i:s'), " Get properties", EOL; |
|
83 | 83 | |
84 | -echo 'Core Properties:' , EOL; |
|
85 | -echo ' Created by - ' , $objPHPExcel->getProperties()->getCreator() , EOL; |
|
86 | -echo ' Created on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getCreated()) , ' at ' , |
|
87 | - date('H:i:s',$objPHPExcel->getProperties()->getCreated()) , EOL; |
|
88 | -echo ' Last Modified by - ' , $objPHPExcel->getProperties()->getLastModifiedBy() , EOL; |
|
89 | -echo ' Last Modified on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getModified()) , ' at ' , |
|
90 | - date('H:i:s',$objPHPExcel->getProperties()->getModified()) , EOL; |
|
91 | -echo ' Title - ' , $objPHPExcel->getProperties()->getTitle() , EOL; |
|
92 | -echo ' Subject - ' , $objPHPExcel->getProperties()->getSubject() , EOL; |
|
93 | -echo ' Description - ' , $objPHPExcel->getProperties()->getDescription() , EOL; |
|
94 | -echo ' Keywords: - ' , $objPHPExcel->getProperties()->getKeywords() , EOL; |
|
84 | +echo 'Core Properties:', EOL; |
|
85 | +echo ' Created by - ', $objPHPExcel->getProperties()->getCreator(), EOL; |
|
86 | +echo ' Created on - ', date('d-M-Y', $objPHPExcel->getProperties()->getCreated()), ' at ', |
|
87 | + date('H:i:s', $objPHPExcel->getProperties()->getCreated()), EOL; |
|
88 | +echo ' Last Modified by - ', $objPHPExcel->getProperties()->getLastModifiedBy(), EOL; |
|
89 | +echo ' Last Modified on - ', date('d-M-Y', $objPHPExcel->getProperties()->getModified()), ' at ', |
|
90 | + date('H:i:s', $objPHPExcel->getProperties()->getModified()), EOL; |
|
91 | +echo ' Title - ', $objPHPExcel->getProperties()->getTitle(), EOL; |
|
92 | +echo ' Subject - ', $objPHPExcel->getProperties()->getSubject(), EOL; |
|
93 | +echo ' Description - ', $objPHPExcel->getProperties()->getDescription(), EOL; |
|
94 | +echo ' Keywords: - ', $objPHPExcel->getProperties()->getKeywords(), EOL; |
|
95 | 95 | |
96 | 96 | |
97 | -echo 'Extended (Application) Properties:' , EOL; |
|
98 | -echo ' Category - ' , $objPHPExcel->getProperties()->getCategory() , EOL; |
|
99 | -echo ' Company - ' , $objPHPExcel->getProperties()->getCompany() , EOL; |
|
100 | -echo ' Manager - ' , $objPHPExcel->getProperties()->getManager() , EOL; |
|
97 | +echo 'Extended (Application) Properties:', EOL; |
|
98 | +echo ' Category - ', $objPHPExcel->getProperties()->getCategory(), EOL; |
|
99 | +echo ' Company - ', $objPHPExcel->getProperties()->getCompany(), EOL; |
|
100 | +echo ' Manager - ', $objPHPExcel->getProperties()->getManager(), EOL; |
|
101 | 101 | |
102 | 102 | |
103 | -echo 'Custom Properties:' , EOL; |
|
103 | +echo 'Custom Properties:', EOL; |
|
104 | 104 | $customProperties = $objPHPExcel->getProperties()->getCustomProperties(); |
105 | -foreach($customProperties as $customProperty) { |
|
105 | +foreach ($customProperties as $customProperty) { |
|
106 | 106 | $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty); |
107 | 107 | $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty); |
108 | - echo ' ' , $customProperty , ' - (' , $propertyType , ') - '; |
|
108 | + echo ' ', $customProperty, ' - (', $propertyType, ') - '; |
|
109 | 109 | if ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_DATE) { |
110 | - echo date('d-M-Y H:i:s',$propertyValue) , EOL; |
|
110 | + echo date('d-M-Y H:i:s', $propertyValue), EOL; |
|
111 | 111 | } elseif ($propertyType == \PHPExcel\Document\Properties::PROPERTY_TYPE_BOOLEAN) { |
112 | - echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL; |
|
112 | + echo (($propertyValue) ? 'TRUE' : 'FALSE'), EOL; |
|
113 | 113 | } else { |
114 | - echo $propertyValue , EOL; |
|
114 | + echo $propertyValue, EOL; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | // Echo memory peak usage |
119 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL; |
|
119 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024) . " MB", EOL; |
@@ -39,19 +39,19 @@ |
||
39 | 39 | |
40 | 40 | // Check prerequisites |
41 | 41 | if (!file_exists("06largescale.xlsx")) { |
42 | - exit("Please run 06largescale.php first.\n"); |
|
42 | + exit("Please run 06largescale.php first.\n"); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | class MyReadFilter implements \PHPExcel\Reader\IReadFilter |
46 | 46 | { |
47 | - public function readCell($column, $row, $worksheetName = '') { |
|
48 | - // Read title row and rows 20 - 30 |
|
49 | - if ($row == 1 || ($row >= 20 && $row <= 30)) { |
|
50 | - return true; |
|
51 | - } |
|
47 | + public function readCell($column, $row, $worksheetName = '') { |
|
48 | + // Read title row and rows 20 - 30 |
|
49 | + if ($row == 1 || ($row >= 20 && $row <= 30)) { |
|
50 | + return true; |
|
51 | + } |
|
52 | 52 | |
53 | - return false; |
|
54 | - } |
|
53 | + return false; |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | |
57 | 57 |
@@ -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 | |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | |
58 | -echo date('H:i:s') , " Load from Excel2007 file" , EOL; |
|
58 | +echo date('H:i:s'), " Load from Excel2007 file", EOL; |
|
59 | 59 | $objReader = \PHPExcel\IOFactory::createReader('Excel2007'); |
60 | -$objReader->setReadFilter( new MyReadFilter() ); |
|
60 | +$objReader->setReadFilter(new MyReadFilter()); |
|
61 | 61 | $objPHPExcel = $objReader->load("06largescale.xlsx"); |
62 | 62 | |
63 | -echo date('H:i:s') , " Remove unnecessary rows" , EOL; |
|
63 | +echo date('H:i:s'), " Remove unnecessary rows", EOL; |
|
64 | 64 | $objPHPExcel->getActiveSheet()->removeRow(2, 18); |
65 | 65 | |
66 | -echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
|
66 | +echo date('H:i:s'), " Write to Excel2007 format", EOL; |
|
67 | 67 | $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
68 | 68 | $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
69 | -echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; |
|
69 | +echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; |
|
70 | 70 | |
71 | 71 | |
72 | 72 | // Echo memory peak usage |
73 | -echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; |
|
73 | +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; |
|
74 | 74 | |
75 | 75 | // Echo done |
76 | -echo date('H:i:s') , " Done writing file" , EOL; |
|
77 | -echo 'File has been created in ' , getcwd() , EOL; |
|
76 | +echo date('H:i:s'), " Done writing file", EOL; |
|
77 | +echo 'File has been created in ', getcwd(), EOL; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -spl_autoload_register(function ($class) { |
|
2 | +spl_autoload_register(function($class) { |
|
3 | 3 | include 'phar://PHPExcel/' . str_replace('_', '/', $class) . '.php'; |
4 | 4 | }); |
5 | 5 |
@@ -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 variance in the yield of Apple and Pear trees'); |
52 | 52 | $worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | echo '<h4>Database</h4>'; |
62 | 62 | |
63 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
63 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
64 | 64 | var_dump($databaseData); |
65 | 65 | |
66 | 66 | |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | // Test the formulae |
71 | 71 | echo '<h4>Criteria</h4>'; |
72 | 72 | |
73 | -$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); |
|
73 | +$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); |
|
74 | 74 | var_dump($criteriaData); |
75 | 75 | |
76 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
77 | -echo 'DVARP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
76 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
77 | +echo 'DVARP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
78 | 78 | |
79 | 79 | echo '<h4>Criteria</h4>'; |
80 | 80 | |
81 | -$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); |
|
81 | +$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); |
|
82 | 82 | var_dump($criteriaData); |
83 | 83 | |
84 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
84 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
85 | 85 | echo 'DVARP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
86 | 86 | |
87 | 87 |
@@ -33,17 +33,17 @@ |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 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 | - ); |
|
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 | + ); |
|
43 | 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 | - ); |
|
44 | + array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | + array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
46 | + ); |
|
47 | 47 | |
48 | 48 | $worksheet->fromArray( $criteria, NULL, 'A1' ); |
49 | 49 | $worksheet->fromArray( $database, NULL, 'A4' ); |
@@ -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 shortest tree in the orchard'); |
52 | 52 | $worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | echo '<h4>Database</h4>'; |
62 | 62 | |
63 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
63 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
64 | 64 | var_dump($databaseData); |
65 | 65 | |
66 | 66 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | |
73 | 73 | echo 'ALL' . '<br /><br />'; |
74 | 74 | |
75 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
76 | -echo 'DMIN() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
75 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
76 | +echo 'DMIN() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
77 | 77 | |
78 | 78 | echo '<h4>Criteria</h4>'; |
79 | 79 | |
80 | -$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true); |
|
80 | +$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); |
|
81 | 81 | var_dump($criteriaData); |
82 | 82 | |
83 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
83 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
84 | 84 | echo 'DMIN() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
85 | 85 | |
86 | 86 |
@@ -33,17 +33,17 @@ |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 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 | - ); |
|
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 | + ); |
|
43 | 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 | - ); |
|
44 | + array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | + array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
46 | + ); |
|
47 | 47 | |
48 | 48 | $worksheet->fromArray( $criteria, NULL, 'A1' ); |
49 | 49 | $worksheet->fromArray( $database, NULL, 'A4' ); |
@@ -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 estimated variance in the yield of Apple and Pear trees'); |
52 | 52 | $worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | echo '<h4>Database</h4>'; |
62 | 62 | |
63 | -$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true); |
|
63 | +$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); |
|
64 | 64 | var_dump($databaseData); |
65 | 65 | |
66 | 66 | |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | // Test the formulae |
71 | 71 | echo '<h4>Criteria</h4>'; |
72 | 72 | |
73 | -$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); |
|
73 | +$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); |
|
74 | 74 | var_dump($criteriaData); |
75 | 75 | |
76 | -echo $worksheet->getCell("A12")->getValue() .'<br />'; |
|
77 | -echo 'DVAR() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'<br /><br />'; |
|
76 | +echo $worksheet->getCell("A12")->getValue() . '<br />'; |
|
77 | +echo 'DVAR() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() . '<br /><br />'; |
|
78 | 78 | |
79 | 79 | echo '<h4>Criteria</h4>'; |
80 | 80 | |
81 | -$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true); |
|
81 | +$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); |
|
82 | 82 | var_dump($criteriaData); |
83 | 83 | |
84 | -echo $worksheet->getCell("A13")->getValue() .'<br />'; |
|
84 | +echo $worksheet->getCell("A13")->getValue() . '<br />'; |
|
85 | 85 | echo 'DVAR() Result is ' . $worksheet->getCell("B13")->getCalculatedValue(); |
86 | 86 | |
87 | 87 |
@@ -33,17 +33,17 @@ |
||
33 | 33 | |
34 | 34 | // Add some data |
35 | 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 | - ); |
|
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 | + ); |
|
43 | 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 | - ); |
|
44 | + array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), |
|
45 | + array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ) |
|
46 | + ); |
|
47 | 47 | |
48 | 48 | $worksheet->fromArray( $criteria, NULL, 'A1' ); |
49 | 49 | $worksheet->fromArray( $database, NULL, 'A4' ); |