Completed
Push — develop ( e0a9f9...ba7054 )
by Adrien
19:36
created
Examples/06largescale.php 2 patches
Spacing   +15 added lines, -15 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
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 */
54 54
 
55 55
 // Create new PHPExcel object
56
-echo date('H:i:s') , " Create new PHPExcel object" , EOL;
56
+echo date('H:i:s'), " Create new PHPExcel object", EOL;
57 57
 $objPHPExcel = new \PHPExcel\Spreadsheet();
58 58
 
59 59
 // Set document properties
60
-echo date('H:i:s') , " Set properties" , EOL;
60
+echo date('H:i:s'), " Set properties", EOL;
61 61
 $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
62 62
 							 ->setLastModifiedBy("Maarten Balliauw")
63 63
 							 ->setTitle("Office 2007 XLSX Test Document")
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 
70 70
 // Create a first sheet
71
-echo date('H:i:s') , " Add data" , EOL;
71
+echo date('H:i:s'), " Add data", EOL;
72 72
 $objPHPExcel->setActiveSheetIndex(0);
73 73
 $objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname");
74 74
 $objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname");
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 // Hide "Phone" and "fax" column
81
-echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL;
81
+echo date('H:i:s'), " Hide 'Phone' and 'fax' columns", EOL;
82 82
 $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false);
83 83
 $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
84 84
 
85 85
 
86 86
 // Set outline levels
87
-echo date('H:i:s') , " Set outline levels" , EOL;
87
+echo date('H:i:s'), " Set outline levels", EOL;
88 88
 $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1)
89 89
                                                        ->setVisible(false)
90 90
                                                        ->setCollapsed(true);
91 91
 
92 92
 // Freeze panes
93
-echo date('H:i:s') , " Freeze panes" , EOL;
93
+echo date('H:i:s'), " Freeze panes", EOL;
94 94
 $objPHPExcel->getActiveSheet()->freezePane('A2');
95 95
 
96 96
 
97 97
 // Rows to repeat at top
98
-echo date('H:i:s') , " Rows to repeat at top" , EOL;
98
+echo date('H:i:s'), " Rows to repeat at top", EOL;
99 99
 $objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1);
100 100
 
101 101
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 
116 116
 // Save Excel 2007 file
117
-echo date('H:i:s') , " Write to Excel2007 format" , EOL;
117
+echo date('H:i:s'), " Write to Excel2007 format", EOL;
118 118
 $callStartTime = microtime(true);
119 119
 
120 120
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 $callEndTime = microtime(true);
123 123
 $callTime = $callEndTime - $callStartTime;
124 124
 
125
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
126
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
125
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
126
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
127 127
 // Echo memory usage
128
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
128
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
129 129
 
130 130
 
131 131
 // Echo memory peak usage
132
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
132
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
133 133
 
134 134
 // Echo done
135
-echo date('H:i:s') , " Done writing file" , EOL;
136
-echo 'File has been created in ' , getcwd() , EOL;
135
+echo date('H:i:s'), " Done writing file", EOL;
136
+echo 'File has been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 // Set document properties
53 53
 echo date('H:i:s') , " Set properties" , EOL;
54 54
 $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
55
-							 ->setLastModifiedBy("Maarten Balliauw")
56
-							 ->setTitle("Office 2007 XLSX Test Document")
57
-							 ->setSubject("Office 2007 XLSX Test Document")
58
-							 ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
59
-							 ->setKeywords("office 2007 openxml php")
60
-							 ->setCategory("Test result file");
55
+                                ->setLastModifiedBy("Maarten Balliauw")
56
+                                ->setTitle("Office 2007 XLSX Test Document")
57
+                                ->setSubject("Office 2007 XLSX Test Document")
58
+                                ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
59
+                                ->setKeywords("office 2007 openxml php")
60
+                                ->setCategory("Test result file");
61 61
 
62 62
 
63 63
 // Create a first sheet
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 // Set outline levels
80 80
 echo date('H:i:s') , " Set outline levels" , EOL;
81 81
 $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1)
82
-                                                       ->setVisible(false)
83
-                                                       ->setCollapsed(true);
82
+                                                        ->setVisible(false)
83
+                                                        ->setCollapsed(true);
84 84
 
85 85
 // Freeze panes
86 86
 echo date('H:i:s') , " Freeze panes" , EOL;
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
 // Add data
96 96
 for ($i = 2; $i <= 5000; $i++) {
97
-	$objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i")
98
-	                              ->setCellValue('B' . $i, "LName $i")
99
-	                              ->setCellValue('C' . $i, "PhoneNo $i")
100
-	                              ->setCellValue('D' . $i, "FaxNo $i")
101
-	                              ->setCellValue('E' . $i, true);
97
+    $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i")
98
+                                    ->setCellValue('B' . $i, "LName $i")
99
+                                    ->setCellValue('C' . $i, "PhoneNo $i")
100
+                                    ->setCellValue('D' . $i, "FaxNo $i")
101
+                                    ->setCellValue('E' . $i, true);
102 102
 }
103 103
 
104 104
 
Please login to merge, or discard this patch.
Examples/09pagebreaks.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -45,37 +45,37 @@
 block discarded – undo
45 45
 // Set document properties
46 46
 echo date('H:i:s') , " Set document properties" , EOL;
47 47
 $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
48
-							 ->setLastModifiedBy("Maarten Balliauw")
49
-							 ->setTitle("Office 2007 XLSX Test Document")
50
-							 ->setSubject("Office 2007 XLSX Test Document")
51
-							 ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
52
-							 ->setKeywords("office 2007 openxml php")
53
-							 ->setCategory("Test result file");
48
+                                ->setLastModifiedBy("Maarten Balliauw")
49
+                                ->setTitle("Office 2007 XLSX Test Document")
50
+                                ->setSubject("Office 2007 XLSX Test Document")
51
+                                ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
52
+                                ->setKeywords("office 2007 openxml php")
53
+                                ->setCategory("Test result file");
54 54
 
55 55
 
56 56
 // Create a first sheet
57 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
-                              ->setCellValue('B1', "Lastname")
61
-                              ->setCellValue('C1', "Phone")
62
-                              ->setCellValue('D1', "Fax")
63
-                              ->setCellValue('E1', "Is Client ?");
60
+                                ->setCellValue('B1', "Lastname")
61
+                                ->setCellValue('C1', "Phone")
62
+                                ->setCellValue('D1', "Fax")
63
+                                ->setCellValue('E1', "Is Client ?");
64 64
 
65 65
 
66 66
 // Add data
67 67
 for ($i = 2; $i <= 50; $i++) {
68
-	$objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i");
69
-	$objPHPExcel->getActiveSheet()->setCellValue('B' . $i, "LName $i");
70
-	$objPHPExcel->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i");
71
-	$objPHPExcel->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i");
72
-	$objPHPExcel->getActiveSheet()->setCellValue('E' . $i, true);
73
-
74
-	// Add page breaks every 10 rows
75
-	if ($i % 10 == 0) {
76
-		// Add a page break
77
-		$objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, \PHPExcel\Worksheet::BREAK_ROW );
78
-	}
68
+    $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i");
69
+    $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, "LName $i");
70
+    $objPHPExcel->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i");
71
+    $objPHPExcel->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i");
72
+    $objPHPExcel->getActiveSheet()->setCellValue('E' . $i, true);
73
+
74
+    // Add page breaks every 10 rows
75
+    if ($i % 10 == 0) {
76
+        // Add a page break
77
+        $objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, \PHPExcel\Worksheet::BREAK_ROW );
78
+    }
79 79
 }
80 80
 
81 81
 // Set active sheet index to the first sheet, so Excel opens this as the first sheet
Please login to merge, or discard this 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/33chartcreate-bar-stacked.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 $objPHPExcel = new \PHPExcel\Spreadsheet();
44 44
 $objWorksheet = $objPHPExcel->getActiveSheet();
45 45
 $objWorksheet->fromArray(
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),
52
-	)
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),
52
+    )
53 53
 );
54 54
 
55 55
 //	Set the Labels for each data series we want to plot
@@ -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
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 //		Data values
83 83
 //		Data Marker
84 84
 $dataSeriesValues = array(
85
-	new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
86
-	new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
87
-	new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
85
+    new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
86
+    new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
87
+    new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
88 88
 );
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
97
-	$dataSeriesValues								// plotValues
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
+    $dataSeriesValues								// plotValues
98 98
 );
99 99
 //	Set additional dataseries parameters
100 100
 //		Make it a horizontal bar rather than a vertical column graph
@@ -111,14 +111,14 @@  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
121
-	$yAxisLabel		// yAxisLabel
114
+    'chart1',		// name
115
+    $title,			// title
116
+    $legend,		// legend
117
+    $plotArea,		// plotArea
118
+    true,			// plotVisibleOnly
119
+    0,				// displayBlanksAs
120
+    NULL,			// xAxisLabel
121
+    $yAxisLabel		// yAxisLabel
122 122
 );
123 123
 
124 124
 //	Set the position where the chart should appear in the worksheet
Please login to merge, or discard this 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 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -45,37 +45,37 @@  discard block
 block discarded – undo
45 45
 // Set document properties
46 46
 echo date('H:i:s') , " Set document properties" , EOL;
47 47
 $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
48
-							 ->setLastModifiedBy("Maarten Balliauw")
49
-							 ->setTitle("Office 2007 XLSX Test Document")
50
-							 ->setSubject("Office 2007 XLSX Test Document")
51
-							 ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
52
-							 ->setKeywords("office 2007 openxml php")
53
-							 ->setCategory("Test result file");
48
+                                ->setLastModifiedBy("Maarten Balliauw")
49
+                                ->setTitle("Office 2007 XLSX Test Document")
50
+                                ->setSubject("Office 2007 XLSX Test Document")
51
+                                ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
52
+                                ->setKeywords("office 2007 openxml php")
53
+                                ->setCategory("Test result file");
54 54
 
55 55
 
56 56
 // Create a first sheet, representing sales data
57 57
 echo date('H:i:s') , " Add some data" , EOL;
58 58
 $objPHPExcel->setActiveSheetIndex(0);
59 59
 $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Description')
60
-                              ->setCellValue('B1', 'Amount');
60
+                                ->setCellValue('B1', 'Amount');
61 61
 
62 62
 $objPHPExcel->getActiveSheet()->setCellValue('A2', 'Paycheck received')
63
-                              ->setCellValue('B2', 100);
63
+                                ->setCellValue('B2', 100);
64 64
 
65 65
 $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought')
66
-                              ->setCellValue('B3', -1.5);
66
+                                ->setCellValue('B3', -1.5);
67 67
 
68 68
 $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought')
69
-                              ->setCellValue('B4', -1.5);
69
+                                ->setCellValue('B4', -1.5);
70 70
 
71 71
 $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Cup of tea bought')
72
-                              ->setCellValue('B5', -1.2);
72
+                                ->setCellValue('B5', -1.2);
73 73
 
74 74
 $objPHPExcel->getActiveSheet()->setCellValue('A6', 'Found some money')
75
-                              ->setCellValue('B6', 8);
75
+                                ->setCellValue('B6', 8);
76 76
 
77 77
 $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total:')
78
-                              ->setCellValue('B7', '=SUM(B2:B6)');
78
+                                ->setCellValue('B7', '=SUM(B2:B6)');
79 79
 
80 80
 
81 81
 // Set column widths
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 //	duplicate the conditional styles across a range of cells
122 122
 echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL;
123 123
 $objPHPExcel->getActiveSheet()->duplicateConditionalStyle(
124
-				$objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles(),
125
-				'B3:B7'
126
-			  );
124
+                $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles(),
125
+                'B3:B7'
126
+                );
127 127
 
128 128
 
129 129
 // Set fonts
Please login to merge, or discard this 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 2 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
 // Set document properties
45 45
 echo date('H:i:s').' Set document properties'.EOL;
46 46
 $objPHPExcel->getProperties()->setCreator('Maarten Balliauw')
47
-							 ->setLastModifiedBy('Maarten Balliauw')
48
-							 ->setTitle('PHPExcel Test Document')
49
-							 ->setSubject('PHPExcel Test Document')
50
-							 ->setDescription('Test document for PHPExcel, generated using PHP classes.')
51
-							 ->setKeywords('office PHPExcel php')
52
-							 ->setCategory('Test result file');
47
+                                ->setLastModifiedBy('Maarten Balliauw')
48
+                                ->setTitle('PHPExcel Test Document')
49
+                                ->setSubject('PHPExcel Test Document')
50
+                                ->setDescription('Test document for PHPExcel, generated using PHP classes.')
51
+                                ->setKeywords('office PHPExcel php')
52
+                                ->setCategory('Test result file');
53 53
 
54 54
 // Create the worksheet
55 55
 echo date('H:i:s').' Add data'.EOL;
56 56
 $objPHPExcel->setActiveSheetIndex(0);
57 57
 $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year')
58
-                              ->setCellValue('B1', 'Financial Period')
59
-                              ->setCellValue('C1', 'Country')
60
-                              ->setCellValue('D1', 'Date')
61
-                              ->setCellValue('E1', 'Sales Value')
62
-                              ->setCellValue('F1', 'Expenditure')
63
-                              ;
58
+                                ->setCellValue('B1', 'Financial Period')
59
+                                ->setCellValue('C1', 'Country')
60
+                                ->setCellValue('D1', 'Date')
61
+                                ->setCellValue('E1', 'Sales Value')
62
+                                ->setCellValue('F1', 'Expenditure')
63
+                                ;
64 64
 $startYear = $endYear = $currentYear = date('Y');
65 65
 $startYear--;
66 66
 $endYear++;
@@ -68,44 +68,44 @@  discard block
 block discarded – undo
68 68
 $years = range($startYear,$endYear);
69 69
 $periods = range(1,12);
70 70
 $countries = array(	'United States',	'UK',		'France',	'Germany',
71
-					'Italy',			'Spain',	'Portugal',	'Japan'
72
-				  );
71
+                    'Italy',			'Spain',	'Portugal',	'Japan'
72
+                    );
73 73
 
74 74
 $row = 2;
75 75
 foreach($years as $year) {
76
-	foreach($periods as $period) {
77
-		foreach($countries as $country) {
78
-			$endDays = date('t',mktime(0,0,0,$period,1,$year));
79
-			for($i = 1; $i <= $endDays; ++$i) {
80
-				$eDate = \PHPExcel\Shared\Date::formattedPHPToExcel(
81
-					$year,
82
-					$period,
83
-					$i
84
-				);
85
-				$value = rand(500,1000) * (1 + rand(-0.25,+0.25));
86
-				$salesValue = $invoiceValue = NULL;
87
-				$incomeOrExpenditure = rand(-1,1);
88
-				if ($incomeOrExpenditure == -1) {
89
-					$expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
90
-					$income = NULL;
91
-				} elseif ($incomeOrExpenditure == 1) {
92
-					$expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
93
-					$income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
94
-				} else {
95
-					$expenditure = NULL;
96
-					$income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
97
-				}
98
-				$dataArray = array(	$year,
99
-									$period,
100
-									$country,
101
-									$eDate,
102
-									$income,
103
-									$expenditure,
104
-								  );
105
-				$objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++);
106
-			}
107
-		}
108
-	}
76
+    foreach($periods as $period) {
77
+        foreach($countries as $country) {
78
+            $endDays = date('t',mktime(0,0,0,$period,1,$year));
79
+            for($i = 1; $i <= $endDays; ++$i) {
80
+                $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel(
81
+                    $year,
82
+                    $period,
83
+                    $i
84
+                );
85
+                $value = rand(500,1000) * (1 + rand(-0.25,+0.25));
86
+                $salesValue = $invoiceValue = NULL;
87
+                $incomeOrExpenditure = rand(-1,1);
88
+                if ($incomeOrExpenditure == -1) {
89
+                    $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
90
+                    $income = NULL;
91
+                } elseif ($incomeOrExpenditure == 1) {
92
+                    $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
93
+                    $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
94
+                } else {
95
+                    $expenditure = NULL;
96
+                    $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
97
+                }
98
+                $dataArray = array(	$year,
99
+                                    $period,
100
+                                    $country,
101
+                                    $eDate,
102
+                                    $income,
103
+                                    $expenditure,
104
+                                    );
105
+                $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++);
106
+            }
107
+        }
108
+    }
109 109
 }
110 110
 $row--;
111 111
 
@@ -138,45 +138,45 @@  discard block
 block discarded – undo
138 138
 $autoFilter->getColumn('C')
139 139
     ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
140 140
     ->createRule()
141
-		->setRule(
142
-			\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
143
-			'u*'
144
-		)
145
-		->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
141
+        ->setRule(
142
+            \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
143
+            'u*'
144
+        )
145
+        ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
146 146
 $autoFilter->getColumn('C')
147 147
     ->createRule()
148
-		->setRule(
149
-			\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
150
-			'japan'
151
-		)
152
-		->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
148
+        ->setRule(
149
+            \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
150
+            'japan'
151
+        )
152
+        ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
153 153
 // Filter the Date column on a filter value of the first day of every period of the current year
154 154
 //	We us a dateGroup ruletype for this, although it is still a standard filter
155 155
 foreach($periods as $period) {
156
-	$endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
157
-
158
-	$autoFilter->getColumn('D')
159
-	    ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
160
-	    ->createRule()
161
-			->setRule(
162
-				\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
163
-				array(
164
-					'year' => $currentYear,
165
-					'month' => $period,
166
-					'day' => $endDate
167
-				)
168
-			)
169
-			->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
156
+    $endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
157
+
158
+    $autoFilter->getColumn('D')
159
+        ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
160
+        ->createRule()
161
+            ->setRule(
162
+                \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
163
+                array(
164
+                    'year' => $currentYear,
165
+                    'month' => $period,
166
+                    'day' => $endDate
167
+                )
168
+            )
169
+            ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
170 170
 }
171 171
 // Display only sales values that are blank
172 172
 //     Standard filter, operator equals, and value of NULL
173 173
 $autoFilter->getColumn('E')
174 174
     ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
175 175
     ->createRule()
176
-		->setRule(
177
-			\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
178
-			''
179
-		);
176
+        ->setRule(
177
+            \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
178
+            ''
179
+        );
180 180
 
181 181
 // Execute filtering
182 182
 echo date('H:i:s').' Execute filtering'.EOL;
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 // Display Results of filtering
190 190
 echo date('H:i:s').' Display filtered rows'.EOL;
191 191
 foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) {
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(), ' ';
196
-		echo EOL;
197
-	}
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(), ' ';
196
+        echo EOL;
197
+    }
198 198
 }
Please login to merge, or discard this 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 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,31 +48,31 @@
 block discarded – undo
48 48
 
49 49
 echo date('H:i:s') , " Add new data to the template" , EOL;
50 50
 $data = array(array('title'		=> 'Excel for dummies',
51
-					'price'		=> 17.99,
52
-					'quantity'	=> 2
53
-				   ),
54
-			  array('title'		=> 'PHP for dummies',
55
-					'price'		=> 15.99,
56
-					'quantity'	=> 1
57
-				   ),
58
-			  array('title'		=> 'Inside OOP',
59
-					'price'		=> 12.95,
60
-					'quantity'	=> 1
61
-				   )
62
-			 );
51
+                    'price'		=> 17.99,
52
+                    'quantity'	=> 2
53
+                    ),
54
+                array('title'		=> 'PHP for dummies',
55
+                    'price'		=> 15.99,
56
+                    'quantity'	=> 1
57
+                    ),
58
+                array('title'		=> 'Inside OOP',
59
+                    'price'		=> 12.95,
60
+                    'quantity'	=> 1
61
+                    )
62
+                );
63 63
 
64 64
 $objPHPExcel->getActiveSheet()->setCellValue('D1', \PHPExcel\Shared\Date::PHPToExcel(time()));
65 65
 
66 66
 $baseRow = 5;
67 67
 foreach($data as $r => $dataRow) {
68
-	$row = $baseRow + $r;
69
-	$objPHPExcel->getActiveSheet()->insertNewRowBefore($row,1);
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);
68
+    $row = $baseRow + $r;
69
+    $objPHPExcel->getActiveSheet()->insertNewRowBefore($row,1);
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);
76 76
 }
77 77
 $objPHPExcel->getActiveSheet()->removeRow($baseRow-1,1);
78 78
 
Please login to merge, or discard this 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 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -17,81 +17,81 @@
 block discarded – undo
17 17
 $inputFileNames = 'templates/32readwrite*[0-9].xlsx';
18 18
 
19 19
 if ((isset($argc)) && ($argc > 1)) {
20
-	$inputFileNames = array();
21
-	for($i = 1; $i < $argc; ++$i) {
22
-		$inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
23
-	}
20
+    $inputFileNames = array();
21
+    for($i = 1; $i < $argc; ++$i) {
22
+        $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
23
+    }
24 24
 } else {
25
-	$inputFileNames = glob($inputFileNames);
25
+    $inputFileNames = glob($inputFileNames);
26 26
 }
27 27
 foreach($inputFileNames as $inputFileName) {
28
-	$inputFileNameShort = basename($inputFileName);
29
-
30
-	if (!file_exists($inputFileName)) {
31
-		echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL;
32
-		continue;
33
-	}
34
-
35
-	echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
36
-
37
-	$objReader = \PHPExcel\IOFactory::createReader($inputFileType);
38
-	$objReader->setIncludeCharts(TRUE);
39
-	$objPHPExcel = $objReader->load($inputFileName);
40
-
41
-
42
-	echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL;
43
-	foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
44
-		$sheetName = $worksheet->getTitle();
45
-		echo 'Worksheet: ' , $sheetName , EOL;
46
-
47
-		$chartNames = $worksheet->getChartNames();
48
-		if(empty($chartNames)) {
49
-			echo '    There are no charts in this worksheet' , EOL;
50
-		} else {
51
-			natsort($chartNames);
52
-			foreach($chartNames as $i => $chartName) {
53
-				$chart = $worksheet->getChartByName($chartName);
54
-				if (!is_null($chart->getTitle())) {
55
-					$caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"';
56
-				} else {
57
-					$caption = 'Untitled';
58
-				}
59
-				echo '    ' , $chartName , ' - ' , $caption , EOL;
60
-				echo str_repeat(' ',strlen($chartName)+3);
61
-				$groupCount = $chart->getPlotArea()->getPlotGroupCount();
62
-				if ($groupCount == 1) {
63
-					$chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
64
-					echo '    ' , $chartType , EOL;
65
-				} else {
66
-					$chartTypes = array();
67
-					for($i = 0; $i < $groupCount; ++$i) {
68
-						$chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
69
-					}
70
-					$chartTypes = array_unique($chartTypes);
71
-					if (count($chartTypes) == 1) {
72
-						$chartType = 'Multiple Plot ' . array_pop($chartTypes);
73
-						echo '    ' , $chartType , EOL;
74
-					} elseif (count($chartTypes) == 0) {
75
-						echo '    *** Type not yet implemented' , EOL;
76
-					} else {
77
-						echo '    Combination Chart' , EOL;
78
-					}
79
-				}
80
-			}
81
-		}
82
-	}
83
-
84
-
85
-	$outputFileName = basename($inputFileName);
86
-
87
-	echo date('H:i:s') , " Write Tests to Excel2007 file " , EOL;
88
-	$objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
89
-	$objWriter->setIncludeCharts(TRUE);
90
-	$objWriter->save($outputFileName);
91
-	echo date('H:i:s') , " File written to " , $outputFileName , EOL;
92
-
93
-	$objPHPExcel->disconnectWorksheets();
94
-	unset($objPHPExcel);
28
+    $inputFileNameShort = basename($inputFileName);
29
+
30
+    if (!file_exists($inputFileName)) {
31
+        echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL;
32
+        continue;
33
+    }
34
+
35
+    echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
36
+
37
+    $objReader = \PHPExcel\IOFactory::createReader($inputFileType);
38
+    $objReader->setIncludeCharts(TRUE);
39
+    $objPHPExcel = $objReader->load($inputFileName);
40
+
41
+
42
+    echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL;
43
+    foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
44
+        $sheetName = $worksheet->getTitle();
45
+        echo 'Worksheet: ' , $sheetName , EOL;
46
+
47
+        $chartNames = $worksheet->getChartNames();
48
+        if(empty($chartNames)) {
49
+            echo '    There are no charts in this worksheet' , EOL;
50
+        } else {
51
+            natsort($chartNames);
52
+            foreach($chartNames as $i => $chartName) {
53
+                $chart = $worksheet->getChartByName($chartName);
54
+                if (!is_null($chart->getTitle())) {
55
+                    $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"';
56
+                } else {
57
+                    $caption = 'Untitled';
58
+                }
59
+                echo '    ' , $chartName , ' - ' , $caption , EOL;
60
+                echo str_repeat(' ',strlen($chartName)+3);
61
+                $groupCount = $chart->getPlotArea()->getPlotGroupCount();
62
+                if ($groupCount == 1) {
63
+                    $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
64
+                    echo '    ' , $chartType , EOL;
65
+                } else {
66
+                    $chartTypes = array();
67
+                    for($i = 0; $i < $groupCount; ++$i) {
68
+                        $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
69
+                    }
70
+                    $chartTypes = array_unique($chartTypes);
71
+                    if (count($chartTypes) == 1) {
72
+                        $chartType = 'Multiple Plot ' . array_pop($chartTypes);
73
+                        echo '    ' , $chartType , EOL;
74
+                    } elseif (count($chartTypes) == 0) {
75
+                        echo '    *** Type not yet implemented' , EOL;
76
+                    } else {
77
+                        echo '    Combination Chart' , EOL;
78
+                    }
79
+                }
80
+            }
81
+        }
82
+    }
83
+
84
+
85
+    $outputFileName = basename($inputFileName);
86
+
87
+    echo date('H:i:s') , " Write Tests to Excel2007 file " , EOL;
88
+    $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
89
+    $objWriter->setIncludeCharts(TRUE);
90
+    $objWriter->save($outputFileName);
91
+    echo date('H:i:s') , " File written to " , $outputFileName , EOL;
92
+
93
+    $objPHPExcel->disconnectWorksheets();
94
+    unset($objPHPExcel);
95 95
 }
96 96
 
97 97
 // Echo memory peak usage
Please login to merge, or discard this 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.
Examples/16csv.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@
 block discarded – undo
45 45
 $callStartTime = microtime(true);
46 46
 
47 47
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
48
-                                                                  ->setEnclosure('"')
49
-                                                                  ->setSheetIndex(0)
50
-                                                                  ->save(str_replace('.php', '.csv', __FILE__));
48
+                                                                    ->setEnclosure('"')
49
+                                                                    ->setSheetIndex(0)
50
+                                                                    ->save(str_replace('.php', '.csv', __FILE__));
51 51
 $callEndTime = microtime(true);
52 52
 $callTime = $callEndTime - $callStartTime;
53 53
 echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  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
 date_default_timezone_set('Europe/London');
37 37
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 require_once dirname(__FILE__) . '/../src/Bootstrap.php';
42 42
 
43 43
 
44
-echo date('H:i:s') , " Write to CSV format" , EOL;
44
+echo date('H:i:s'), " Write to CSV format", EOL;
45 45
 $callStartTime = microtime(true);
46 46
 
47 47
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
                                                                   ->save(str_replace('.php', '.csv', __FILE__));
51 51
 $callEndTime = microtime(true);
52 52
 $callTime = $callEndTime - $callStartTime;
53
-echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
54
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
53
+echo date('H:i:s'), " File written to ", str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
54
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
55 55
 // Echo memory usage
56
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
56
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
57 57
 
58 58
 
59
-echo date('H:i:s') , " Read from CSV format" , EOL;
59
+echo date('H:i:s'), " Read from CSV format", EOL;
60 60
 $callStartTime = microtime(true);
61 61
 $objReader = \PHPExcel\IOFactory::createReader('CSV')->setDelimiter(',')
62 62
                                                     ->setEnclosure('"')
@@ -65,25 +65,25 @@  discard block
 block discarded – undo
65 65
 
66 66
 $callEndTime = microtime(true);
67 67
 $callTime = $callEndTime - $callStartTime;
68
-echo 'Call time to reload Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
68
+echo 'Call time to reload Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
69 69
 // Echo memory usage
70
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
70
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
71 71
 
72 72
 
73
-echo date('H:i:s') , " Write to Excel2007 format" , EOL;
73
+echo date('H:i:s'), " Write to Excel2007 format", EOL;
74 74
 $callStartTime = microtime(true);
75 75
 
76 76
 $objWriter2007 = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007');
77 77
 $objWriter2007->save(str_replace('.php', '.xlsx', __FILE__));
78 78
 $callEndTime = microtime(true);
79 79
 $callTime = $callEndTime - $callStartTime;
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
-echo date('H:i:s') , " Write to CSV format" , EOL;
86
+echo date('H:i:s'), " Write to CSV format", EOL;
87 87
 $callStartTime = microtime(true);
88 88
 
89 89
 $objWriterCSV = \PHPExcel\IOFactory::createWriter($objPHPExcelFromCSV, 'CSV');
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
 $objWriterCSV->save(str_replace('.php', '_excel.csv', __FILE__));
92 92
 $callEndTime = microtime(true);
93 93
 $callTime = $callEndTime - $callStartTime;
94
-echo date('H:i:s') , " File written to " , str_replace('.php', '_excel.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
95
-echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
94
+echo date('H:i:s'), " File written to ", str_replace('.php', '_excel.csv', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
95
+echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
96 96
 // Echo memory usage
97
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
97
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", EOL;
98 98
 
99 99
 
100 100
 // Echo memory peak usage
101
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
101
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL;
102 102
 
103 103
 // Echo done
104
-echo date('H:i:s') , " Done writing files" , EOL;
105
-echo 'Files have been created in ' , getcwd() , EOL;
104
+echo date('H:i:s'), " Done writing files", EOL;
105
+echo 'Files have been created in ', getcwd(), EOL;
Please login to merge, or discard this patch.
Examples/OOCalcReader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 /** \PHPExcel\IOFactory */
34 34
 require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
35 35
 
36
-echo date('H:i:s') , " Load from OOCalc file" , PHP_EOL;
36
+echo date('H:i:s'), " Load from OOCalc file", PHP_EOL;
37 37
 $callStartTime = microtime(true);
38 38
 
39 39
 $objReader = \PHPExcel\IOFactory::createReader('OOCalc');
@@ -42,20 +42,20 @@  discard block
 block discarded – undo
42 42
 
43 43
 $callEndTime = microtime(true);
44 44
 $callTime = $callEndTime - $callStartTime;
45
-echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL;
45
+echo 'Call time to read Workbook was ', sprintf('%.4f', $callTime), " seconds", PHP_EOL;
46 46
 // Echo memory usage
47
-echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
47
+echo date('H:i:s'), ' Current memory usage: ', (memory_get_usage(true) / 1024 / 1024), " MB", PHP_EOL;
48 48
 
49 49
 
50
-echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
50
+echo date('H:i:s'), " Write to Excel2007 format", PHP_EOL;
51 51
 $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'Excel2007');
52 52
 $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
53
-echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;
53
+echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', __FILE__), PHP_EOL;
54 54
 
55 55
 
56 56
 // Echo memory peak usage
57
-echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
57
+echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", PHP_EOL;
58 58
 
59 59
 // Echo done
60
-echo date('H:i:s') , " Done writing file" , PHP_EOL;
60
+echo date('H:i:s'), " Done writing file", PHP_EOL;
61 61
 
Please login to merge, or discard this patch.