@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | // Set document properties |
52 | 52 | echo date('H:i:s') , " Set document properties" , EOL; |
53 | 53 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
54 | - ->setLastModifiedBy("Maarten Balliauw") |
|
55 | - ->setTitle("Office 2007 XLSX Test Document") |
|
56 | - ->setSubject("Office 2007 XLSX Test Document") |
|
57 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
58 | - ->setKeywords("office 2007 openxml php") |
|
59 | - ->setCategory("Test result file"); |
|
54 | + ->setLastModifiedBy("Maarten Balliauw") |
|
55 | + ->setTitle("Office 2007 XLSX Test Document") |
|
56 | + ->setSubject("Office 2007 XLSX Test Document") |
|
57 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
58 | + ->setKeywords("office 2007 openxml php") |
|
59 | + ->setCategory("Test result file"); |
|
60 | 60 | |
61 | 61 | // Set default font |
62 | 62 | echo date('H:i:s') , " Set default font" , EOL; |
@@ -71,88 +71,88 @@ discard block |
||
71 | 71 | // Add some data, resembling some different data types |
72 | 72 | echo date('H:i:s') , " Add some data" , EOL; |
73 | 73 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'String value:') |
74 | - ->setCellValue('B1', 'Mark Baker'); |
|
74 | + ->setCellValue('B1', 'Mark Baker'); |
|
75 | 75 | |
76 | 76 | $objPHPExcel->getActiveSheet()->setCellValue('A2', 'Numeric value #1:') |
77 | - ->setCellValue('B2', 12345); |
|
77 | + ->setCellValue('B2', 12345); |
|
78 | 78 | |
79 | 79 | $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Numeric value #2:') |
80 | - ->setCellValue('B3', -12.345); |
|
80 | + ->setCellValue('B3', -12.345); |
|
81 | 81 | |
82 | 82 | $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Numeric value #3:') |
83 | - ->setCellValue('B4', .12345); |
|
83 | + ->setCellValue('B4', .12345); |
|
84 | 84 | |
85 | 85 | $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Numeric value #4:') |
86 | - ->setCellValue('B5', '12345'); |
|
86 | + ->setCellValue('B5', '12345'); |
|
87 | 87 | |
88 | 88 | $objPHPExcel->getActiveSheet()->setCellValue('A6', 'Numeric value #5:') |
89 | - ->setCellValue('B6', '1.2345'); |
|
89 | + ->setCellValue('B6', '1.2345'); |
|
90 | 90 | |
91 | 91 | $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Numeric value #6:') |
92 | - ->setCellValue('B7', '.12345'); |
|
92 | + ->setCellValue('B7', '.12345'); |
|
93 | 93 | |
94 | 94 | $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Numeric value #7:') |
95 | - ->setCellValue('B8', '1.234e-5'); |
|
95 | + ->setCellValue('B8', '1.234e-5'); |
|
96 | 96 | |
97 | 97 | $objPHPExcel->getActiveSheet()->setCellValue('A9', 'Numeric value #8:') |
98 | - ->setCellValue('B9', '-1.234e+5'); |
|
98 | + ->setCellValue('B9', '-1.234e+5'); |
|
99 | 99 | |
100 | 100 | $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Boolean value:') |
101 | - ->setCellValue('B10', 'TRUE'); |
|
101 | + ->setCellValue('B10', 'TRUE'); |
|
102 | 102 | |
103 | 103 | $objPHPExcel->getActiveSheet()->setCellValue('A11', 'Percentage value #1:') |
104 | - ->setCellValue('B11', '10%'); |
|
104 | + ->setCellValue('B11', '10%'); |
|
105 | 105 | |
106 | 106 | $objPHPExcel->getActiveSheet()->setCellValue('A12', 'Percentage value #2:') |
107 | - ->setCellValue('B12', '12.5%'); |
|
107 | + ->setCellValue('B12', '12.5%'); |
|
108 | 108 | |
109 | 109 | $objPHPExcel->getActiveSheet()->setCellValue('A13', 'Fraction value #1:') |
110 | - ->setCellValue('B13', '-1/2'); |
|
110 | + ->setCellValue('B13', '-1/2'); |
|
111 | 111 | |
112 | 112 | $objPHPExcel->getActiveSheet()->setCellValue('A14', 'Fraction value #2:') |
113 | - ->setCellValue('B14', '3 1/2'); |
|
113 | + ->setCellValue('B14', '3 1/2'); |
|
114 | 114 | |
115 | 115 | $objPHPExcel->getActiveSheet()->setCellValue('A15', 'Fraction value #3:') |
116 | - ->setCellValue('B15', '-12 3/4'); |
|
116 | + ->setCellValue('B15', '-12 3/4'); |
|
117 | 117 | |
118 | 118 | $objPHPExcel->getActiveSheet()->setCellValue('A16', 'Fraction value #4:') |
119 | - ->setCellValue('B16', '13/4'); |
|
119 | + ->setCellValue('B16', '13/4'); |
|
120 | 120 | |
121 | 121 | $objPHPExcel->getActiveSheet()->setCellValue('A17', 'Currency value #1:') |
122 | - ->setCellValue('B17', '$12345'); |
|
122 | + ->setCellValue('B17', '$12345'); |
|
123 | 123 | |
124 | 124 | $objPHPExcel->getActiveSheet()->setCellValue('A18', 'Currency value #2:') |
125 | - ->setCellValue('B18', '$12345.67'); |
|
125 | + ->setCellValue('B18', '$12345.67'); |
|
126 | 126 | |
127 | 127 | $objPHPExcel->getActiveSheet()->setCellValue('A19', 'Currency value #3:') |
128 | - ->setCellValue('B19', '$12,345.67'); |
|
128 | + ->setCellValue('B19', '$12,345.67'); |
|
129 | 129 | |
130 | 130 | $objPHPExcel->getActiveSheet()->setCellValue('A20', 'Date value #1:') |
131 | - ->setCellValue('B20', '21 December 1983'); |
|
131 | + ->setCellValue('B20', '21 December 1983'); |
|
132 | 132 | |
133 | 133 | $objPHPExcel->getActiveSheet()->setCellValue('A21', 'Date value #2:') |
134 | - ->setCellValue('B21', '19-Dec-1960'); |
|
134 | + ->setCellValue('B21', '19-Dec-1960'); |
|
135 | 135 | |
136 | 136 | $objPHPExcel->getActiveSheet()->setCellValue('A22', 'Date value #3:') |
137 | - ->setCellValue('B22', '07/12/1982'); |
|
137 | + ->setCellValue('B22', '07/12/1982'); |
|
138 | 138 | |
139 | 139 | $objPHPExcel->getActiveSheet()->setCellValue('A23', 'Date value #4:') |
140 | - ->setCellValue('B23', '24-11-1950'); |
|
140 | + ->setCellValue('B23', '24-11-1950'); |
|
141 | 141 | |
142 | 142 | $objPHPExcel->getActiveSheet()->setCellValue('A24', 'Date value #5:') |
143 | - ->setCellValue('B24', '17-Mar'); |
|
143 | + ->setCellValue('B24', '17-Mar'); |
|
144 | 144 | |
145 | 145 | $objPHPExcel->getActiveSheet()->setCellValue('A25', 'Time value #1:') |
146 | - ->setCellValue('B25', '01:30'); |
|
146 | + ->setCellValue('B25', '01:30'); |
|
147 | 147 | |
148 | 148 | $objPHPExcel->getActiveSheet()->setCellValue('A26', 'Time value #2:') |
149 | - ->setCellValue('B26', '01:30:15'); |
|
149 | + ->setCellValue('B26', '01:30:15'); |
|
150 | 150 | |
151 | 151 | $objPHPExcel->getActiveSheet()->setCellValue('A27', 'Date/Time value:') |
152 | - ->setCellValue('B27', '19-Dec-1960 01:30'); |
|
152 | + ->setCellValue('B27', '19-Dec-1960 01:30'); |
|
153 | 153 | |
154 | 154 | $objPHPExcel->getActiveSheet()->setCellValue('A28', 'Formula:') |
155 | - ->setCellValue('B28', '=SUM(B2:B9)'); |
|
155 | + ->setCellValue('B28', '=SUM(B2:B9)'); |
|
156 | 156 | |
157 | 157 | // Rename worksheet |
158 | 158 | echo date('H:i:s') , " Rename worksheet" , EOL; |
@@ -62,14 +62,14 @@ |
||
62 | 62 | echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL; |
63 | 63 | |
64 | 64 | if (!\PHPExcel\Settings::setPdfRenderer( |
65 | - $rendererName, |
|
66 | - $rendererLibraryPath |
|
67 | - )) { |
|
68 | - die( |
|
69 | - 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
70 | - EOL . |
|
71 | - 'at the top of this script as appropriate for your directory structure' |
|
72 | - ); |
|
65 | + $rendererName, |
|
66 | + $rendererLibraryPath |
|
67 | + )) { |
|
68 | + die( |
|
69 | + 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . |
|
70 | + EOL . |
|
71 | + 'at the top of this script as appropriate for your directory structure' |
|
72 | + ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | // Set document properties |
45 | 45 | echo date('H:i:s').' Set document properties'.EOL; |
46 | 46 | $objPHPExcel->getProperties()->setCreator('Maarten Balliauw') |
47 | - ->setLastModifiedBy('Maarten Balliauw') |
|
48 | - ->setTitle('PHPExcel Test Document') |
|
49 | - ->setSubject('PHPExcel Test Document') |
|
50 | - ->setDescription('Test document for PHPExcel, generated using PHP classes.') |
|
51 | - ->setKeywords('office PHPExcel php') |
|
52 | - ->setCategory('Test result file'); |
|
47 | + ->setLastModifiedBy('Maarten Balliauw') |
|
48 | + ->setTitle('PHPExcel Test Document') |
|
49 | + ->setSubject('PHPExcel Test Document') |
|
50 | + ->setDescription('Test document for PHPExcel, generated using PHP classes.') |
|
51 | + ->setKeywords('office PHPExcel php') |
|
52 | + ->setCategory('Test result file'); |
|
53 | 53 | |
54 | 54 | // Create the worksheet |
55 | 55 | echo date('H:i:s').' Add data'.EOL; |
56 | 56 | $objPHPExcel->setActiveSheetIndex(0); |
57 | 57 | $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year') |
58 | - ->setCellValue('B1', 'Financial Period') |
|
59 | - ->setCellValue('C1', 'Country') |
|
60 | - ->setCellValue('D1', 'Date') |
|
61 | - ->setCellValue('E1', 'Sales Value') |
|
62 | - ->setCellValue('F1', 'Expenditure') |
|
63 | - ; |
|
58 | + ->setCellValue('B1', 'Financial Period') |
|
59 | + ->setCellValue('C1', 'Country') |
|
60 | + ->setCellValue('D1', 'Date') |
|
61 | + ->setCellValue('E1', 'Sales Value') |
|
62 | + ->setCellValue('F1', 'Expenditure') |
|
63 | + ; |
|
64 | 64 | $startYear = $endYear = $currentYear = date('Y'); |
65 | 65 | $startYear--; |
66 | 66 | $endYear++; |
@@ -68,44 +68,44 @@ discard block |
||
68 | 68 | $years = range($startYear,$endYear); |
69 | 69 | $periods = range(1,12); |
70 | 70 | $countries = array( 'United States', 'UK', 'France', 'Germany', |
71 | - 'Italy', 'Spain', 'Portugal', 'Japan' |
|
72 | - ); |
|
71 | + 'Italy', 'Spain', 'Portugal', 'Japan' |
|
72 | + ); |
|
73 | 73 | |
74 | 74 | $row = 2; |
75 | 75 | foreach($years as $year) { |
76 | - foreach($periods as $period) { |
|
77 | - foreach($countries as $country) { |
|
78 | - $endDays = date('t',mktime(0,0,0,$period,1,$year)); |
|
79 | - for($i = 1; $i <= $endDays; ++$i) { |
|
80 | - $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( |
|
81 | - $year, |
|
82 | - $period, |
|
83 | - $i |
|
84 | - ); |
|
85 | - $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); |
|
86 | - $salesValue = $invoiceValue = NULL; |
|
87 | - $incomeOrExpenditure = rand(-1,1); |
|
88 | - if ($incomeOrExpenditure == -1) { |
|
89 | - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
90 | - $income = NULL; |
|
91 | - } elseif ($incomeOrExpenditure == 1) { |
|
92 | - $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
93 | - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
94 | - } else { |
|
95 | - $expenditure = NULL; |
|
96 | - $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
97 | - } |
|
98 | - $dataArray = array( $year, |
|
99 | - $period, |
|
100 | - $country, |
|
101 | - $eDate, |
|
102 | - $income, |
|
103 | - $expenditure, |
|
104 | - ); |
|
105 | - $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); |
|
106 | - } |
|
107 | - } |
|
108 | - } |
|
76 | + foreach($periods as $period) { |
|
77 | + foreach($countries as $country) { |
|
78 | + $endDays = date('t',mktime(0,0,0,$period,1,$year)); |
|
79 | + for($i = 1; $i <= $endDays; ++$i) { |
|
80 | + $eDate = \PHPExcel\Shared\Date::formattedPHPToExcel( |
|
81 | + $year, |
|
82 | + $period, |
|
83 | + $i |
|
84 | + ); |
|
85 | + $value = rand(500,1000) * (1 + rand(-0.25,+0.25)); |
|
86 | + $salesValue = $invoiceValue = NULL; |
|
87 | + $incomeOrExpenditure = rand(-1,1); |
|
88 | + if ($incomeOrExpenditure == -1) { |
|
89 | + $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
90 | + $income = NULL; |
|
91 | + } elseif ($incomeOrExpenditure == 1) { |
|
92 | + $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25)); |
|
93 | + $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
94 | + } else { |
|
95 | + $expenditure = NULL; |
|
96 | + $income = rand(500,1000) * (1 + rand(-0.25,+0.25));; |
|
97 | + } |
|
98 | + $dataArray = array( $year, |
|
99 | + $period, |
|
100 | + $country, |
|
101 | + $eDate, |
|
102 | + $income, |
|
103 | + $expenditure, |
|
104 | + ); |
|
105 | + $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++); |
|
106 | + } |
|
107 | + } |
|
108 | + } |
|
109 | 109 | } |
110 | 110 | $row--; |
111 | 111 | |
@@ -138,45 +138,45 @@ discard block |
||
138 | 138 | $autoFilter->getColumn('C') |
139 | 139 | ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) |
140 | 140 | ->createRule() |
141 | - ->setRule( |
|
142 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
143 | - 'u*' |
|
144 | - ) |
|
145 | - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
141 | + ->setRule( |
|
142 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
143 | + 'u*' |
|
144 | + ) |
|
145 | + ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
146 | 146 | $autoFilter->getColumn('C') |
147 | 147 | ->createRule() |
148 | - ->setRule( |
|
149 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
150 | - 'japan' |
|
151 | - ) |
|
152 | - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
148 | + ->setRule( |
|
149 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
150 | + 'japan' |
|
151 | + ) |
|
152 | + ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); |
|
153 | 153 | // Filter the Date column on a filter value of the first day of every period of the current year |
154 | 154 | // We us a dateGroup ruletype for this, although it is still a standard filter |
155 | 155 | foreach($periods as $period) { |
156 | - $endDate = date('t',mktime(0,0,0,$period,1,$currentYear)); |
|
157 | - |
|
158 | - $autoFilter->getColumn('D') |
|
159 | - ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) |
|
160 | - ->createRule() |
|
161 | - ->setRule( |
|
162 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
163 | - array( |
|
164 | - 'year' => $currentYear, |
|
165 | - 'month' => $period, |
|
166 | - 'day' => $endDate |
|
167 | - ) |
|
168 | - ) |
|
169 | - ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP); |
|
156 | + $endDate = date('t',mktime(0,0,0,$period,1,$currentYear)); |
|
157 | + |
|
158 | + $autoFilter->getColumn('D') |
|
159 | + ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) |
|
160 | + ->createRule() |
|
161 | + ->setRule( |
|
162 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
163 | + array( |
|
164 | + 'year' => $currentYear, |
|
165 | + 'month' => $period, |
|
166 | + 'day' => $endDate |
|
167 | + ) |
|
168 | + ) |
|
169 | + ->setRuleType(\PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP); |
|
170 | 170 | } |
171 | 171 | // Display only sales values that are blank |
172 | 172 | // Standard filter, operator equals, and value of NULL |
173 | 173 | $autoFilter->getColumn('E') |
174 | 174 | ->setFilterType(\PHPExcel\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER) |
175 | 175 | ->createRule() |
176 | - ->setRule( |
|
177 | - \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
178 | - '' |
|
179 | - ); |
|
176 | + ->setRule( |
|
177 | + \PHPExcel\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, |
|
178 | + '' |
|
179 | + ); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | // Set active sheet index to the first sheet, so Excel opens this as the first sheet |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | // Set document properties |
46 | 46 | echo date('H:i:s') , " Set document properties" , EOL; |
47 | 47 | $objPHPExcel->getProperties()->setCreator("Mark Baker") |
48 | - ->setLastModifiedBy("Mark Baker") |
|
49 | - ->setTitle("Office 2007 XLSX Test Document") |
|
50 | - ->setSubject("Office 2007 XLSX Test Document") |
|
51 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | - ->setKeywords("office 2007 openxml php") |
|
53 | - ->setCategory("Test result file"); |
|
48 | + ->setLastModifiedBy("Mark Baker") |
|
49 | + ->setTitle("Office 2007 XLSX Test Document") |
|
50 | + ->setSubject("Office 2007 XLSX Test Document") |
|
51 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
52 | + ->setKeywords("office 2007 openxml php") |
|
53 | + ->setCategory("Test result file"); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | // Add some data |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | echo date('H:i:s') , " Set sheet security" , EOL; |
75 | 75 | $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); |
76 | 76 | $objPHPExcel->getActiveSheet() |
77 | - ->getStyle('A2:B2') |
|
78 | - ->getProtection()->setLocked( |
|
79 | - \PHPExcel\Style\Protection::PROTECTION_UNPROTECTED |
|
80 | - ); |
|
77 | + ->getStyle('A2:B2') |
|
78 | + ->getProtection()->setLocked( |
|
79 | + \PHPExcel\Style\Protection::PROTECTION_UNPROTECTED |
|
80 | + ); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | // Set active sheet index to the first sheet, so Excel opens this as the first sheet |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | // Set document properties |
40 | 40 | echo date('H:i:s') , " Set document properties" , EOL; |
41 | 41 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
42 | - ->setLastModifiedBy("Maarten Balliauw") |
|
43 | - ->setTitle("Office 2007 XLSX Test Document") |
|
44 | - ->setSubject("Office 2007 XLSX Test Document") |
|
45 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
46 | - ->setKeywords("office 2007 openxml php") |
|
47 | - ->setCategory("Test result file"); |
|
42 | + ->setLastModifiedBy("Maarten Balliauw") |
|
43 | + ->setTitle("Office 2007 XLSX Test Document") |
|
44 | + ->setSubject("Office 2007 XLSX Test Document") |
|
45 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
46 | + ->setKeywords("office 2007 openxml php") |
|
47 | + ->setCategory("Test result file"); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | // Create a first sheet, representing sales data |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | // Set thin black border outline around column |
177 | 177 | echo date('H:i:s') , " Set thin black border outline around column" , EOL; |
178 | 178 | $styleThinBlackBorderOutline = array( |
179 | - 'borders' => array( |
|
180 | - 'outline' => array( |
|
181 | - 'style' => \PHPExcel\Style\Border::BORDER_THIN, |
|
182 | - 'color' => array('argb' => 'FF000000'), |
|
183 | - ), |
|
184 | - ), |
|
179 | + 'borders' => array( |
|
180 | + 'outline' => array( |
|
181 | + 'style' => \PHPExcel\Style\Border::BORDER_THIN, |
|
182 | + 'color' => array('argb' => 'FF000000'), |
|
183 | + ), |
|
184 | + ), |
|
185 | 185 | ); |
186 | 186 | $objPHPExcel->getActiveSheet()->getStyle('A4:E10')->applyFromArray($styleThinBlackBorderOutline); |
187 | 187 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | // Set thick brown border outline around "Total" |
190 | 190 | echo date('H:i:s') , " Set thick brown border outline around Total" , EOL; |
191 | 191 | $styleThickBrownBorderOutline = array( |
192 | - 'borders' => array( |
|
193 | - 'outline' => array( |
|
194 | - 'style' => \PHPExcel\Style\Border::BORDER_THICK, |
|
195 | - 'color' => array('argb' => 'FF993300'), |
|
196 | - ), |
|
197 | - ), |
|
192 | + 'borders' => array( |
|
193 | + 'outline' => array( |
|
194 | + 'style' => \PHPExcel\Style\Border::BORDER_THICK, |
|
195 | + 'color' => array('argb' => 'FF993300'), |
|
196 | + ), |
|
197 | + ), |
|
198 | 198 | ); |
199 | 199 | $objPHPExcel->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickBrownBorderOutline); |
200 | 200 | |
@@ -206,60 +206,60 @@ discard block |
||
206 | 206 | // Set style for header row using alternative method |
207 | 207 | echo date('H:i:s') , " Set style for header row using alternative method" , EOL; |
208 | 208 | $objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray( |
209 | - array( |
|
210 | - 'font' => array( |
|
211 | - 'bold' => true |
|
212 | - ), |
|
213 | - 'alignment' => array( |
|
214 | - 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT, |
|
215 | - ), |
|
216 | - 'borders' => array( |
|
217 | - 'top' => array( |
|
218 | - 'style' => \PHPExcel\Style\Border::BORDER_THIN |
|
219 | - ) |
|
220 | - ), |
|
221 | - 'fill' => array( |
|
222 | - 'type' => \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR, |
|
223 | - 'rotation' => 90, |
|
224 | - 'startcolor' => array( |
|
225 | - 'argb' => 'FFA0A0A0' |
|
226 | - ), |
|
227 | - 'endcolor' => array( |
|
228 | - 'argb' => 'FFFFFFFF' |
|
229 | - ) |
|
230 | - ) |
|
231 | - ) |
|
209 | + array( |
|
210 | + 'font' => array( |
|
211 | + 'bold' => true |
|
212 | + ), |
|
213 | + 'alignment' => array( |
|
214 | + 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_RIGHT, |
|
215 | + ), |
|
216 | + 'borders' => array( |
|
217 | + 'top' => array( |
|
218 | + 'style' => \PHPExcel\Style\Border::BORDER_THIN |
|
219 | + ) |
|
220 | + ), |
|
221 | + 'fill' => array( |
|
222 | + 'type' => \PHPExcel\Style\Fill::FILL_GRADIENT_LINEAR, |
|
223 | + 'rotation' => 90, |
|
224 | + 'startcolor' => array( |
|
225 | + 'argb' => 'FFA0A0A0' |
|
226 | + ), |
|
227 | + 'endcolor' => array( |
|
228 | + 'argb' => 'FFFFFFFF' |
|
229 | + ) |
|
230 | + ) |
|
231 | + ) |
|
232 | 232 | ); |
233 | 233 | |
234 | 234 | $objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray( |
235 | - array( |
|
236 | - 'alignment' => array( |
|
237 | - 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT, |
|
238 | - ), |
|
239 | - 'borders' => array( |
|
240 | - 'left' => array( |
|
241 | - 'style' => \PHPExcel\Style\Border::BORDER_THIN |
|
242 | - ) |
|
243 | - ) |
|
244 | - ) |
|
235 | + array( |
|
236 | + 'alignment' => array( |
|
237 | + 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT, |
|
238 | + ), |
|
239 | + 'borders' => array( |
|
240 | + 'left' => array( |
|
241 | + 'style' => \PHPExcel\Style\Border::BORDER_THIN |
|
242 | + ) |
|
243 | + ) |
|
244 | + ) |
|
245 | 245 | ); |
246 | 246 | |
247 | 247 | $objPHPExcel->getActiveSheet()->getStyle('B3')->applyFromArray( |
248 | - array( |
|
249 | - 'alignment' => array( |
|
250 | - 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT, |
|
251 | - ) |
|
252 | - ) |
|
248 | + array( |
|
249 | + 'alignment' => array( |
|
250 | + 'horizontal' => \PHPExcel\Style\Alignment::HORIZONTAL_LEFT, |
|
251 | + ) |
|
252 | + ) |
|
253 | 253 | ); |
254 | 254 | |
255 | 255 | $objPHPExcel->getActiveSheet()->getStyle('E3')->applyFromArray( |
256 | - array( |
|
257 | - 'borders' => array( |
|
258 | - 'right' => array( |
|
259 | - 'style' => \PHPExcel\Style\Border::BORDER_THIN |
|
260 | - ) |
|
261 | - ) |
|
262 | - ) |
|
256 | + array( |
|
257 | + 'borders' => array( |
|
258 | + 'right' => array( |
|
259 | + 'style' => \PHPExcel\Style\Border::BORDER_THIN |
|
260 | + ) |
|
261 | + ) |
|
262 | + ) |
|
263 | 263 | ); |
264 | 264 | |
265 | 265 | // Unprotect a cell |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | // Set document properties |
47 | 47 | echo date('H:i:s') , " Set document properties" , EOL; |
48 | 48 | $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") |
49 | - ->setLastModifiedBy("Maarten Balliauw") |
|
50 | - ->setTitle("Office 2007 XLSX Test Document") |
|
51 | - ->setSubject("Office 2007 XLSX Test Document") |
|
52 | - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
53 | - ->setKeywords("office 2007 openxml php") |
|
54 | - ->setCategory("Test result file"); |
|
49 | + ->setLastModifiedBy("Maarten Balliauw") |
|
50 | + ->setTitle("Office 2007 XLSX Test Document") |
|
51 | + ->setSubject("Office 2007 XLSX Test Document") |
|
52 | + ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") |
|
53 | + ->setKeywords("office 2007 openxml php") |
|
54 | + ->setCategory("Test result file"); |
|
55 | 55 | |
56 | 56 | |
57 | 57 | // Add some data |
@@ -59,24 +59,24 @@ discard block |
||
59 | 59 | $objPHPExcel->setActiveSheetIndex(0); |
60 | 60 | |
61 | 61 | $objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray( |
62 | - array('fill' => array( |
|
63 | - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
64 | - 'color' => array('argb' => 'FFCCFFCC') |
|
65 | - ), |
|
66 | - 'borders' => array( |
|
67 | - 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), |
|
68 | - 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) |
|
69 | - ) |
|
70 | - ) |
|
71 | - ); |
|
62 | + array('fill' => array( |
|
63 | + 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
64 | + 'color' => array('argb' => 'FFCCFFCC') |
|
65 | + ), |
|
66 | + 'borders' => array( |
|
67 | + 'bottom' => array('style' => \PHPExcel\Style\Border::BORDER_THIN), |
|
68 | + 'right' => array('style' => \PHPExcel\Style\Border::BORDER_MEDIUM) |
|
69 | + ) |
|
70 | + ) |
|
71 | + ); |
|
72 | 72 | |
73 | 73 | $objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray( |
74 | - array('fill' => array( |
|
75 | - 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
76 | - 'color' => array('argb' => 'FFFFFF00') |
|
77 | - ), |
|
78 | - ) |
|
79 | - ); |
|
74 | + array('fill' => array( |
|
75 | + 'type' => \PHPExcel\Style\Fill::FILL_SOLID, |
|
76 | + 'color' => array('argb' => 'FFFFFF00') |
|
77 | + ), |
|
78 | + ) |
|
79 | + ); |
|
80 | 80 | |
81 | 81 | // Save Excel 2007 file |
82 | 82 | echo date('H:i:s') , " Write to Excel2007 format" , EOL; |
@@ -43,13 +43,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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_STANDARD, // 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_STANDARD, // 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 vertical column rather than a horizontal bar graph |
@@ -111,14 +111,14 @@ discard block |
||
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 |
@@ -43,13 +43,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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_LINECHART, // 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_LINECHART, // 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 | |
100 | 100 | // Set the series in the plot area |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | |
109 | 109 | // Create the chart |
110 | 110 | $chart = new \PHPExcel\Chart( |
111 | - 'chart1', // name |
|
112 | - $title, // title |
|
113 | - $legend, // legend |
|
114 | - $plotArea, // plotArea |
|
115 | - true, // plotVisibleOnly |
|
116 | - 0, // displayBlanksAs |
|
117 | - NULL, // xAxisLabel |
|
118 | - $yAxisLabel // yAxisLabel |
|
111 | + 'chart1', // name |
|
112 | + $title, // title |
|
113 | + $legend, // legend |
|
114 | + $plotArea, // plotArea |
|
115 | + true, // plotVisibleOnly |
|
116 | + 0, // displayBlanksAs |
|
117 | + NULL, // xAxisLabel |
|
118 | + $yAxisLabel // yAxisLabel |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | // Set the position where the chart should appear in the worksheet |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | // Add some data, we will use some formulas here |
47 | 47 | echo date('H:i:s') , " Add some data and formulas" , EOL; |
48 | 48 | $objPHPExcel->getActiveSheet()->setCellValue('A1', '=B1') |
49 | - ->setCellValue('A2', '=B2+1') |
|
50 | - ->setCellValue('B1', '=A1+1') |
|
51 | - ->setCellValue('B2', '=A2'); |
|
49 | + ->setCellValue('A2', '=B2+1') |
|
50 | + ->setCellValue('B1', '=A1+1') |
|
51 | + ->setCellValue('B2', '=A2'); |
|
52 | 52 | |
53 | 53 | \PHPExcel\Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100; |
54 | 54 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | for($row = 1; $row <= 2; ++$row) { |
58 | 58 | for ($col = 'A'; $col != 'C'; ++$col) { |
59 | 59 | if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) && |
60 | - ($formula[0] == '=')) { |
|
60 | + ($formula[0] == '=')) { |
|
61 | 61 | echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' , |
62 | - $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; |
|
62 | + $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |