Completed
Branch master (962a82)
by Adrien
09:13
created
Examples/01pharSimple.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
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 '../Build/PHPExcel.phar';
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")
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 
55 55
 // Add some data
56
-echo date('H:i:s') , " Add some data" , EOL;
56
+echo date('H:i:s'), " Add some data", EOL;
57 57
 $objPHPExcel->setActiveSheetIndex(0)
58 58
             ->setCellValue('A1', 'Hello')
59 59
             ->setCellValue('B2', 'world!')
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç');
67 67
 
68 68
 // Rename worksheet
69
-echo date('H:i:s') , " Rename worksheet" , EOL;
69
+echo date('H:i:s'), " Rename worksheet", EOL;
70 70
 $objPHPExcel->getActiveSheet()->setTitle('Simple');
71 71
 
72 72
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 // Save Excel 2007 file
78
-echo date('H:i:s') , " Write to Excel2007 format" , EOL;
78
+echo date('H:i:s'), " Write to Excel2007 format", EOL;
79 79
 $callStartTime = microtime(true);
80 80
 
81 81
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
 $callEndTime = microtime(true);
84 84
 $callTime = $callEndTime - $callStartTime;
85 85
 
86
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
87
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
86
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
87
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
88 88
 // Echo memory usage
89
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
89
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
90 90
 
91 91
 
92 92
 // Save Excel5 file
93
-echo date('H:i:s') , " Write to Excel5 format" , EOL;
93
+echo date('H:i:s'), " Write to Excel5 format", EOL;
94 94
 $callStartTime = microtime(true);
95 95
 
96 96
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 $callEndTime = microtime(true);
99 99
 $callTime = $callEndTime - $callStartTime;
100 100
 
101
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
102
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
101
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
102
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
103 103
 // Echo memory usage
104
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
104
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
105 105
 
106 106
 
107 107
 // Echo memory peak usage
108
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
108
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
109 109
 
110 110
 // Echo done
111
-echo date('H:i:s') , " Done writing files" , EOL;
112
-echo 'Files have been created in ' , getcwd() , EOL;
111
+echo date('H:i:s'), " Done writing files", EOL;
112
+echo 'Files have been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Examples/09pagebreaks.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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("Maarten Balliauw")
48 48
 							 ->setLastModifiedBy("Maarten Balliauw")
49 49
 							 ->setTitle("Office 2007 XLSX Test Document")
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 
56 56
 // Create a first sheet
57
-echo date('H:i:s') , " Add data and page breaks" , EOL;
57
+echo date('H:i:s'), " Add data and page breaks", EOL;
58 58
 $objPHPExcel->setActiveSheetIndex(0);
59 59
 $objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname")
60 60
                               ->setCellValue('B1', "Lastname")
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	// Add page breaks every 10 rows
75 75
 	if ($i % 10 == 0) {
76 76
 		// Add a page break
77
-		$objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, \PHPExcel\Worksheet::BREAK_ROW );
77
+		$objPHPExcel->getActiveSheet()->setBreak('A' . $i, \PHPExcel\Worksheet::BREAK_ROW);
78 78
 	}
79 79
 }
80 80
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 
99 99
 // Save Excel 2007 file
100
-echo date('H:i:s') , " Write to Excel2007 format" , EOL;
100
+echo date('H:i:s'), " Write to Excel2007 format", EOL;
101 101
 $callStartTime = microtime(true);
102 102
 
103 103
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 $callEndTime = microtime(true);
106 106
 $callTime = $callEndTime - $callStartTime;
107 107
 
108
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
109
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
108
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
109
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
110 110
 // Echo memory usage
111
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
111
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
112 112
 
113 113
 
114 114
 // Save Excel 95 file
115
-echo date('H:i:s') , " Write to Excel5 format" , EOL;
115
+echo date('H:i:s'), " Write to Excel5 format", EOL;
116 116
 $callStartTime = microtime(true);
117 117
 
118 118
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
 $callEndTime = microtime(true);
121 121
 $callTime = $callEndTime - $callStartTime;
122 122
 
123
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', 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', '.xls', 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
 // Echo memory peak usage
130
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
130
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
131 131
 
132 132
 // Echo done
133
-echo date('H:i:s') , " Done writing files" , EOL;
134
-echo 'Files have been created in ' , getcwd() , EOL;
133
+echo date('H:i:s'), " Done writing files", EOL;
134
+echo 'Files have been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Examples/02types-xls.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
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")
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 							 ->setCategory("Test result file");
53 53
 
54 54
 // Set default font
55
-echo date('H:i:s') , " Set default font" , EOL;
55
+echo date('H:i:s'), " Set default font", EOL;
56 56
 $objPHPExcel->getDefaultStyle()->getFont()->setName('Arial')
57 57
                                           ->setSize(10);
58 58
 
59 59
 // Add some data, resembling some different data types
60
-echo date('H:i:s') , " Add some data" , EOL;
60
+echo date('H:i:s'), " Add some data", EOL;
61 61
 $objPHPExcel->getActiveSheet()->setCellValue('A1', 'String')
62 62
                               ->setCellValue('B1', 'Simple')
63 63
                               ->setCellValue('C1', 'PHPExcel');
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 $dateTimeNow = time();
94 94
 $objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time')
95 95
                               ->setCellValue('B9', 'Date')
96
-                              ->setCellValue('C9', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
96
+                              ->setCellValue('C9', \PHPExcel\Shared\Date::PHPToExcel($dateTimeNow));
97 97
 $objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
98 98
 
99 99
 $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time')
100 100
                               ->setCellValue('B10', 'Time')
101
-                              ->setCellValue('C10', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
101
+                              ->setCellValue('C10', \PHPExcel\Shared\Date::PHPToExcel($dateTimeNow));
102 102
 $objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME4);
103 103
 
104 104
 $objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time')
105 105
                               ->setCellValue('B11', 'Date and Time')
106
-                              ->setCellValue('C11', \PHPExcel\Shared\Date::PHPToExcel( $dateTimeNow ));
106
+                              ->setCellValue('C11', \PHPExcel\Shared\Date::PHPToExcel($dateTimeNow));
107 107
 $objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_DATE_DATETIME);
108 108
 
109 109
 $objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 $objRichText2->createText("black text\n");
127 127
 
128 128
 $objRed = $objRichText2->createTextRun("red text");
129
-$objRed->getFont()->setColor(new \PHPExcel\Style\Color(\PHPExcel\Style\Color::COLOR_RED ));
129
+$objRed->getFont()->setColor(new \PHPExcel\Style\Color(\PHPExcel\Style\Color::COLOR_RED));
130 130
 
131 131
 $objPHPExcel->getActiveSheet()->getCell("C14")->setValue($objRichText2);
132 132
 $objPHPExcel->getActiveSheet()->getStyle("C14")->getAlignment()->setWrapText(true);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
137 137
 
138 138
 // Rename worksheet
139
-echo date('H:i:s') , " Rename worksheet" , EOL;
139
+echo date('H:i:s'), " Rename worksheet", EOL;
140 140
 $objPHPExcel->getActiveSheet()->setTitle('Datatypes');
141 141
 
142 142
 
@@ -145,39 +145,39 @@  discard block
 block discarded – undo
145 145
 
146 146
 
147 147
 // Save Excel 95 file
148
-echo date('H:i:s') , " Write to Excel5 format" , EOL;
148
+echo date('H:i:s'), " Write to Excel5 format", EOL;
149 149
 $callStartTime = microtime(true);
150 150
 
151 151
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
152 152
 $objWriter->save(str_replace('.php', '.xls', __FILE__));
153
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
153
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
154 154
 $callEndTime = microtime(true);
155 155
 $callTime = $callEndTime - $callStartTime;
156 156
 
157
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
158
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
157
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
158
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
159 159
 // Echo memory usage
160
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
160
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
161 161
 
162 162
 
163
-echo date('H:i:s') , " Reload workbook from saved file" , EOL;
163
+echo date('H:i:s'), " Reload workbook from saved file", EOL;
164 164
 $callStartTime = microtime(true);
165 165
 
166 166
 $objPHPExcel = \PHPExcel\IOFactory::load(str_replace('.php', '.xls', __FILE__));
167 167
 
168 168
 $callEndTime = microtime(true);
169 169
 $callTime = $callEndTime - $callStartTime;
170
-echo 'Call time to reload Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
170
+echo 'Call time to reload Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
171 171
 // Echo memory usage
172
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
172
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
173 173
 
174 174
 
175 175
 var_dump($objPHPExcel->getActiveSheet()->toArray());
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 testing file" , EOL;
183
-echo 'File has been created in ' , getcwd() , EOL;
182
+echo date('H:i:s'), " Done testing file", EOL;
183
+echo 'File has been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Examples/01simple.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
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()
47 47
     ->setCreator("Maarten Balliauw")
48 48
 	->setLastModifiedBy("Maarten Balliauw")
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
     ->setCellValue('A1', 'Hello')
60 60
     ->setCellValue('B2', 'world!')
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 
70 70
 $objPHPExcel->getActiveSheet()
71
-    ->setCellValue('A8',"Hello\nWorld");
71
+    ->setCellValue('A8', "Hello\nWorld");
72 72
 $objPHPExcel->getActiveSheet()
73 73
     ->getRowDimension(8)
74 74
     ->setRowHeight(-1);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
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()
99 99
     ->setTitle('Simple');
100 100
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 
106 106
 // Save Excel 2007 file
107
-echo date('H:i:s') , " Write to Excel2007 format" , EOL;
107
+echo date('H:i:s'), " Write to Excel2007 format", EOL;
108 108
 $callStartTime = microtime(true);
109 109
 
110 110
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 $callEndTime = microtime(true);
113 113
 $callTime = $callEndTime - $callStartTime;
114 114
 
115
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
116
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
115
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
116
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
117 117
 // Echo memory usage
118
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
118
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
119 119
 
120 120
 
121 121
 // Save Excel 95 file
122
-echo date('H:i:s') , " Write to Excel5 format" , EOL;
122
+echo date('H:i:s'), " Write to Excel5 format", EOL;
123 123
 $callStartTime = microtime(true);
124 124
 
125 125
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 $callEndTime = microtime(true);
128 128
 $callTime = $callEndTime - $callStartTime;
129 129
 
130
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
131
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
130
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
131
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
132 132
 // Echo memory usage
133
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
133
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
134 134
 
135 135
 
136 136
 // Echo memory peak usage
137
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
137
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
138 138
 
139 139
 // Echo done
140
-echo date('H:i:s') , " Done writing files" , EOL;
141
-echo 'Files have been created in ' , getcwd() , EOL;
140
+echo date('H:i:s'), " Done writing files", EOL;
141
+echo 'Files have been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Examples/33chartcreate-bar-stacked.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,9 +60,9 @@  discard block
 block discarded – undo
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
 //		Datatype
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 //		Data values
73 73
 //		Data Marker
74 74
 $xAxisTickValues = array(
75
-	new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4),	//	Q1 to Q4
75
+	new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), //	Q1 to Q4
76 76
 );
77 77
 //	Set the Data values for each data series we want to plot
78 78
 //		Datatype
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 
90 90
 //	Build the dataseries
91 91
 $series = new \PHPExcel\Chart\DataSeries(
92
-	\PHPExcel\Chart\DataSeries::TYPE_BARCHART,		// plotType
93
-	\PHPExcel\Chart\DataSeries::GROUPING_STACKED,	// plotGrouping
94
-	range(0, count($dataSeriesValues)-1),			// plotOrder
95
-	$dataSeriesLabels,								// plotLabel
96
-	$xAxisTickValues,								// plotCategory
92
+	\PHPExcel\Chart\DataSeries::TYPE_BARCHART, // plotType
93
+	\PHPExcel\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
94
+	range(0, count($dataSeriesValues) - 1), // plotOrder
95
+	$dataSeriesLabels, // plotLabel
96
+	$xAxisTickValues, // plotCategory
97 97
 	$dataSeriesValues								// plotValues
98 98
 );
99 99
 //	Set additional dataseries parameters
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 
112 112
 //	Create the chart
113 113
 $chart = new \PHPExcel\Chart(
114
-	'chart1',		// name
115
-	$title,			// title
116
-	$legend,		// legend
117
-	$plotArea,		// plotArea
118
-	true,			// plotVisibleOnly
119
-	0,				// displayBlanksAs
120
-	NULL,			// xAxisLabel
114
+	'chart1', // name
115
+	$title, // title
116
+	$legend, // legend
117
+	$plotArea, // plotArea
118
+	true, // plotVisibleOnly
119
+	0, // displayBlanksAs
120
+	NULL, // xAxisLabel
121 121
 	$yAxisLabel		// yAxisLabel
122 122
 );
123 123
 
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
 // Save Excel 2007 file
133
-echo date('H:i:s') , " Write to Excel2007 format" , EOL;
133
+echo date('H:i:s'), " Write to Excel2007 format", EOL;
134 134
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
135 135
 $objWriter->setIncludeCharts(TRUE);
136 136
 $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
137
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
137
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
138 138
 
139 139
 
140 140
 // Echo memory peak usage
141
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
141
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
142 142
 
143 143
 // Echo done
144
-echo date('H:i:s') , " Done writing file" , EOL;
145
-echo 'File has been created in ' , getcwd() , EOL;
144
+echo date('H:i:s'), " Done writing file", EOL;
145
+echo 'File has been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Examples/08conditionalformatting.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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("Maarten Balliauw")
48 48
 							 ->setLastModifiedBy("Maarten Balliauw")
49 49
 							 ->setTitle("Office 2007 XLSX Test Document")
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 
56 56
 // Create a first sheet, representing sales 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', 'Description')
60 60
                               ->setCellValue('B1', 'Amount');
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 
80 80
 
81 81
 // Set column widths
82
-echo date('H:i:s') , " Set column widths" , EOL;
82
+echo date('H:i:s'), " Set column widths", EOL;
83 83
 $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(30);
84 84
 $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
85 85
 
86 86
 
87 87
 // Add conditional formatting
88
-echo date('H:i:s') , " Add conditional formatting" , EOL;
88
+echo date('H:i:s'), " Add conditional formatting", EOL;
89 89
 $objConditional1 = new \PHPExcel\Style\Conditional();
90 90
 $objConditional1->setConditionType(\PHPExcel\Style\Conditional::CONDITION_CELLIS)
91 91
                 ->setOperatorType(\PHPExcel\Style\Conditional::OPERATOR_BETWEEN)
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 
121 121
 //	duplicate the conditional styles across a range of cells
122
-echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL;
122
+echo date('H:i:s'), " Duplicate the conditional formatting across a range of cells", EOL;
123 123
 $objPHPExcel->getActiveSheet()->duplicateConditionalStyle(
124 124
 				$objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles(),
125 125
 				'B3:B7'
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 
129 129
 // Set fonts
130
-echo date('H:i:s') , " Set fonts" , EOL;
130
+echo date('H:i:s'), " Set fonts", EOL;
131 131
 $objPHPExcel->getActiveSheet()->getStyle('A1:B1')->getFont()->setBold(true);
132 132
 //$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
133 133
 $objPHPExcel->getActiveSheet()->getStyle('A7:B7')->getFont()->setBold(true);
@@ -135,19 +135,19 @@  discard block
 block discarded – undo
135 135
 
136 136
 
137 137
 // Set header and footer. When no different headers for odd/even are used, odd header is assumed.
138
-echo date('H:i:s') , " Set header/footer" , EOL;
138
+echo date('H:i:s'), " Set header/footer", EOL;
139 139
 $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BPersonal cash register&RPrinted on &D');
140 140
 $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N');
141 141
 
142 142
 
143 143
 // Set page orientation and size
144
-echo date('H:i:s') , " Set page orientation and size" , EOL;
144
+echo date('H:i:s'), " Set page orientation and size", EOL;
145 145
 $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
146 146
 $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel\Worksheet\PageSetup::PAPERSIZE_A4);
147 147
 
148 148
 
149 149
 // Rename worksheet
150
-echo date('H:i:s') , " Rename worksheet" , EOL;
150
+echo date('H:i:s'), " Rename worksheet", EOL;
151 151
 $objPHPExcel->getActiveSheet()->setTitle('Invoice');
152 152
 
153 153
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 
158 158
 // Save Excel 2007 file
159
-echo date('H:i:s') , " Write to Excel2007 format" , EOL;
159
+echo date('H:i:s'), " Write to Excel2007 format", EOL;
160 160
 $callStartTime = microtime(true);
161 161
 
162 162
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 $callEndTime = microtime(true);
165 165
 $callTime = $callEndTime - $callStartTime;
166 166
 
167
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
168
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
167
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
168
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
169 169
 // Save Excel5 file
170
-echo date('H:i:s') , " Write to Excel5 format" , EOL;
170
+echo date('H:i:s'), " Write to Excel5 format", EOL;
171 171
 $callStartTime = microtime(true);
172 172
 
173 173
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
 $callEndTime = microtime(true);
176 176
 $callTime = $callEndTime - $callStartTime;
177 177
 
178
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
179
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
178
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
179
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
180 180
 // Echo memory usage
181
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
181
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
182 182
 
183 183
 
184 184
 // Echo memory peak usage
185
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
185
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
186 186
 
187 187
 // Echo done
188
-echo date('H:i:s') , " Done writing file" , EOL;
189
-echo 'File has been created in ' , getcwd() , EOL;
188
+echo date('H:i:s'), " Done writing file", EOL;
189
+echo 'File has been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Examples/10autofilter-selection-display.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		);
180 180
 
181 181
 // Execute filtering
182
-echo date('H:i:s').' Execute filtering'.EOL;
182
+echo date('H:i:s') . ' Execute filtering' . EOL;
183 183
 $autoFilter->showHideRows();
184 184
 
185 185
 // Set active sheet index to the first sheet, so Excel opens this as the first sheet
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
 
188 188
 
189 189
 // Display Results of filtering
190
-echo date('H:i:s').' Display filtered rows'.EOL;
190
+echo date('H:i:s') . ' Display filtered rows' . EOL;
191 191
 foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) {
192 192
 	if ($objPHPExcel->getActiveSheet()->getRowDimension($row->getRowIndex())->getVisible()) {
193
-		echo '    Row number - ' , $row->getRowIndex() , ' ';
194
-		echo $objPHPExcel->getActiveSheet()->getCell('C'.$row->getRowIndex())->getValue(), ' ';
195
-		echo $objPHPExcel->getActiveSheet()->getCell('D'.$row->getRowIndex())->getFormattedValue(), ' ';
193
+		echo '    Row number - ', $row->getRowIndex(), ' ';
194
+		echo $objPHPExcel->getActiveSheet()->getCell('C' . $row->getRowIndex())->getValue(), ' ';
195
+		echo $objPHPExcel->getActiveSheet()->getCell('D' . $row->getRowIndex())->getFormattedValue(), ' ';
196 196
 		echo EOL;
197 197
 	}
198 198
 }
Please login to merge, or discard this patch.
Examples/30template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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,14 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 
42
-echo date('H:i:s') , " Load from Excel5 template" , EOL;
42
+echo date('H:i:s'), " Load from Excel5 template", EOL;
43 43
 $objReader = \PHPExcel\IOFactory::createReader('Excel5');
44 44
 $objPHPExcel = $objReader->load("templates/30template.xls");
45 45
 
46 46
 
47 47
 
48 48
 
49
-echo date('H:i:s') , " Add new data to the template" , EOL;
49
+echo date('H:i:s'), " Add new data to the template", EOL;
50 50
 $data = array(array('title'		=> 'Excel for dummies',
51 51
 					'price'		=> 17.99,
52 52
 					'quantity'	=> 2
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
 $objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel(time()));
65 65
 
66 66
 $baseRow = 5;
67
-foreach($data as $r => $dataRow) {
67
+foreach ($data as $r => $dataRow) {
68 68
 	$row = $baseRow + $r;
69
-	$objPHPExcel->getActiveSheet()->insertNewRowBefore($row,1);
69
+	$objPHPExcel->getActiveSheet()->insertNewRowBefore($row, 1);
70 70
 
71
-	$objPHPExcel->getActiveSheet()->setCellValue('A'.$row, $r+1)
72
-	                              ->setCellValue('B'.$row, $dataRow['title'])
73
-	                              ->setCellValue('C'.$row, $dataRow['price'])
74
-	                              ->setCellValue('D'.$row, $dataRow['quantity'])
75
-	                              ->setCellValue('E'.$row, '=C'.$row.'*D'.$row);
71
+	$objPHPExcel->getActiveSheet()->setCellValue('A' . $row, $r + 1)
72
+	                              ->setCellValue('B' . $row, $dataRow['title'])
73
+	                              ->setCellValue('C' . $row, $dataRow['price'])
74
+	                              ->setCellValue('D' . $row, $dataRow['quantity'])
75
+	                              ->setCellValue('E' . $row, '=C' . $row . '*D' . $row);
76 76
 }
77
-$objPHPExcel->getActiveSheet()->removeRow($baseRow-1,1);
77
+$objPHPExcel->getActiveSheet()->removeRow($baseRow - 1, 1);
78 78
 
79 79
 
80
-echo date('H:i:s') , " Write to Excel5 format" , EOL;
80
+echo date('H:i:s'), " Write to Excel5 format", EOL;
81 81
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel5');
82 82
 $objWriter->save(str_replace('.php', '.xls', __FILE__));
83
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
83
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)), 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;
Please login to merge, or discard this patch.
Examples/32chartreadwrite.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 
@@ -18,63 +18,63 @@  discard block
 block discarded – undo
18 18
 
19 19
 if ((isset($argc)) && ($argc > 1)) {
20 20
 	$inputFileNames = array();
21
-	for($i = 1; $i < $argc; ++$i) {
21
+	for ($i = 1; $i < $argc; ++$i) {
22 22
 		$inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
23 23
 	}
24 24
 } else {
25 25
 	$inputFileNames = glob($inputFileNames);
26 26
 }
27
-foreach($inputFileNames as $inputFileName) {
27
+foreach ($inputFileNames as $inputFileName) {
28 28
 	$inputFileNameShort = basename($inputFileName);
29 29
 
30 30
 	if (!file_exists($inputFileName)) {
31
-		echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL;
31
+		echo date('H:i:s'), " File ", $inputFileNameShort, ' does not exist', EOL;
32 32
 		continue;
33 33
 	}
34 34
 
35
-	echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
35
+	echo date('H:i:s'), " Load Test from $inputFileType file ", $inputFileNameShort, EOL;
36 36
 
37 37
 	$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
38 38
 	$objReader->setIncludeCharts(TRUE);
39 39
 	$objPHPExcel = $objReader->load($inputFileName);
40 40
 
41 41
 
42
-	echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL;
42
+	echo date('H:i:s'), " Iterate worksheets looking at the charts", EOL;
43 43
 	foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
44 44
 		$sheetName = $worksheet->getTitle();
45
-		echo 'Worksheet: ' , $sheetName , EOL;
45
+		echo 'Worksheet: ', $sheetName, EOL;
46 46
 
47 47
 		$chartNames = $worksheet->getChartNames();
48
-		if(empty($chartNames)) {
49
-			echo '    There are no charts in this worksheet' , EOL;
48
+		if (empty($chartNames)) {
49
+			echo '    There are no charts in this worksheet', EOL;
50 50
 		} else {
51 51
 			natsort($chartNames);
52
-			foreach($chartNames as $i => $chartName) {
52
+			foreach ($chartNames as $i => $chartName) {
53 53
 				$chart = $worksheet->getChartByName($chartName);
54 54
 				if (!is_null($chart->getTitle())) {
55
-					$caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"';
55
+					$caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"';
56 56
 				} else {
57 57
 					$caption = 'Untitled';
58 58
 				}
59
-				echo '    ' , $chartName , ' - ' , $caption , EOL;
60
-				echo str_repeat(' ',strlen($chartName)+3);
59
+				echo '    ', $chartName, ' - ', $caption, EOL;
60
+				echo str_repeat(' ', strlen($chartName) + 3);
61 61
 				$groupCount = $chart->getPlotArea()->getPlotGroupCount();
62 62
 				if ($groupCount == 1) {
63 63
 					$chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
64
-					echo '    ' , $chartType , EOL;
64
+					echo '    ', $chartType, EOL;
65 65
 				} else {
66 66
 					$chartTypes = array();
67
-					for($i = 0; $i < $groupCount; ++$i) {
67
+					for ($i = 0; $i < $groupCount; ++$i) {
68 68
 						$chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
69 69
 					}
70 70
 					$chartTypes = array_unique($chartTypes);
71 71
 					if (count($chartTypes) == 1) {
72 72
 						$chartType = 'Multiple Plot ' . array_pop($chartTypes);
73
-						echo '    ' , $chartType , EOL;
73
+						echo '    ', $chartType, EOL;
74 74
 					} elseif (count($chartTypes) == 0) {
75
-						echo '    *** Type not yet implemented' , EOL;
75
+						echo '    *** Type not yet implemented', EOL;
76 76
 					} else {
77
-						echo '    Combination Chart' , EOL;
77
+						echo '    Combination Chart', EOL;
78 78
 					}
79 79
 				}
80 80
 			}
@@ -84,19 +84,19 @@  discard block
 block discarded – undo
84 84
 
85 85
 	$outputFileName = basename($inputFileName);
86 86
 
87
-	echo date('H:i:s') , " Write Tests to Excel2007 file " , EOL;
87
+	echo date('H:i:s'), " Write Tests to Excel2007 file ", EOL;
88 88
 	$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
89 89
 	$objWriter->setIncludeCharts(TRUE);
90 90
 	$objWriter->save($outputFileName);
91
-	echo date('H:i:s') , " File written to " , $outputFileName , EOL;
91
+	echo date('H:i:s'), " File written to ", $outputFileName, EOL;
92 92
 
93 93
 	$objPHPExcel->disconnectWorksheets();
94 94
 	unset($objPHPExcel);
95 95
 }
96 96
 
97 97
 // Echo memory peak usage
98
-echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
98
+echo date('H:i:s'), ' Peak memory usage: ', (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
99 99
 
100 100
 // Echo done
101
-echo date('H:i:s') , " Done writing files" , EOL;
102
-echo 'Files have been created in ' , getcwd() , EOL;
101
+echo date('H:i:s'), " Done writing files", EOL;
102
+echo 'Files have been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.