@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | // XML header |
150 | - $objWriter->startDocument('1.0','UTF-8','yes'); |
|
150 | + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|
151 | 151 | |
152 | 152 | // a:theme |
153 | 153 | $objWriter->startElement('a:theme'); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | $objWriter->writeAttribute('typeface', ''); |
840 | 840 | $objWriter->endElement(); |
841 | 841 | |
842 | - foreach($fontSet as $fontScript => $typeface) { |
|
842 | + foreach ($fontSet as $fontScript => $typeface) { |
|
843 | 843 | $objWriter->startElement('a:font'); |
844 | 844 | $objWriter->writeAttribute('script', $fontScript); |
845 | 845 | $objWriter->writeAttribute('typeface', $typeface); |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | */ |
858 | 858 | private function _writeColourScheme($objWriter) |
859 | 859 | { |
860 | - foreach(self::$_colourScheme as $colourName => $colourValue) { |
|
860 | + foreach (self::$_colourScheme as $colourName => $colourValue) { |
|
861 | 861 | $objWriter->startElement('a:'.$colourName); |
862 | 862 | |
863 | 863 | $objWriter->startElement('a:srgbClr'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // XML header |
57 | - $objWriter->startDocument('1.0','UTF-8','yes'); |
|
57 | + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|
58 | 58 | |
59 | 59 | // workbook |
60 | 60 | $objWriter->startElement('workbook'); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->_writeDefinedNames($objWriter, $pPHPExcel); |
84 | 84 | |
85 | 85 | // calcPr |
86 | - $this->_writeCalcPr($objWriter,$recalcRequired); |
|
86 | + $this->_writeCalcPr($objWriter, $recalcRequired); |
|
87 | 87 | |
88 | 88 | $objWriter->endElement(); |
89 | 89 | |
@@ -167,16 +167,16 @@ discard block |
||
167 | 167 | { |
168 | 168 | if ($pPHPExcel->getSecurity()->isSecurityEnabled()) { |
169 | 169 | $objWriter->startElement('workbookProtection'); |
170 | - $objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false')); |
|
171 | - $objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false')); |
|
172 | - $objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false')); |
|
170 | + $objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false')); |
|
171 | + $objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false')); |
|
172 | + $objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false')); |
|
173 | 173 | |
174 | 174 | if ($pPHPExcel->getSecurity()->getRevisionsPassword() != '') { |
175 | - $objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword()); |
|
175 | + $objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword()); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if ($pPHPExcel->getSecurity()->getWorkbookPassword() != '') { |
179 | - $objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword()); |
|
179 | + $objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword()); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $objWriter->endElement(); |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | { |
195 | 195 | $objWriter->startElement('calcPr'); |
196 | 196 | |
197 | - $objWriter->writeAttribute('calcId', '124519'); |
|
198 | - $objWriter->writeAttribute('calcMode', 'auto'); |
|
197 | + $objWriter->writeAttribute('calcId', '124519'); |
|
198 | + $objWriter->writeAttribute('calcMode', 'auto'); |
|
199 | 199 | // fullCalcOnLoad isn't needed if we've recalculating for the save |
200 | - $objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? '0' : '1'); |
|
200 | + $objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? '0' : '1'); |
|
201 | 201 | |
202 | 202 | $objWriter->endElement(); |
203 | 203 | } |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | if ($pSheetname != '') { |
244 | 244 | // Write sheet |
245 | 245 | $objWriter->startElement('sheet'); |
246 | - $objWriter->writeAttribute('name', $pSheetname); |
|
247 | - $objWriter->writeAttribute('sheetId', $pSheetId); |
|
246 | + $objWriter->writeAttribute('name', $pSheetname); |
|
247 | + $objWriter->writeAttribute('sheetId', $pSheetId); |
|
248 | 248 | if ($sheetState != 'visible' && $sheetState != '') { |
249 | 249 | $objWriter->writeAttribute('state', $sheetState); |
250 | 250 | } |
251 | - $objWriter->writeAttribute('r:id', 'rId' . $pRelId); |
|
251 | + $objWriter->writeAttribute('r:id', 'rId'.$pRelId); |
|
252 | 252 | $objWriter->endElement(); |
253 | 253 | } else { |
254 | 254 | throw new Exception("Invalid parameters passed."); |
@@ -316,15 +316,15 @@ discard block |
||
316 | 316 | { |
317 | 317 | // definedName for named range |
318 | 318 | $objWriter->startElement('definedName'); |
319 | - $objWriter->writeAttribute('name', $pNamedRange->getName()); |
|
319 | + $objWriter->writeAttribute('name', $pNamedRange->getName()); |
|
320 | 320 | if ($pNamedRange->getLocalOnly()) { |
321 | - $objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope())); |
|
321 | + $objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope())); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // Create absolute coordinate and write as raw text |
325 | 325 | $range = PHPExcel_Cell::splitRange($pNamedRange->getRange()); |
326 | 326 | for ($i = 0; $i < count($range); $i++) { |
327 | - $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteReference($range[$i][0]); |
|
327 | + $range[$i][0] = '\''.str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()).'\'!'.PHPExcel_Cell::absoluteReference($range[$i][0]); |
|
328 | 328 | if (isset($range[$i][1])) { |
329 | 329 | $range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]); |
330 | 330 | } |
@@ -349,23 +349,23 @@ discard block |
||
349 | 349 | // definedName for autoFilter |
350 | 350 | if ($pSheet->getAutoFilter() != '') { |
351 | 351 | $objWriter->startElement('definedName'); |
352 | - $objWriter->writeAttribute('name', '_xlnm._FilterDatabase'); |
|
353 | - $objWriter->writeAttribute('localSheetId', $pSheetId); |
|
354 | - $objWriter->writeAttribute('hidden', '1'); |
|
352 | + $objWriter->writeAttribute('name', '_xlnm._FilterDatabase'); |
|
353 | + $objWriter->writeAttribute('localSheetId', $pSheetId); |
|
354 | + $objWriter->writeAttribute('hidden', '1'); |
|
355 | 355 | |
356 | 356 | // Create absolute coordinate and write as raw text |
357 | 357 | $range = PHPExcel_Cell::splitRange($pSheet->getAutoFilter()); |
358 | 358 | $range = $range[0]; |
359 | 359 | // Strip any worksheet ref so we can make the cell ref absolute |
360 | - if (strpos($range[0],'!') !== false) { |
|
361 | - list($ws,$range[0]) = explode('!',$range[0]); |
|
360 | + if (strpos($range[0], '!') !== false) { |
|
361 | + list($ws, $range[0]) = explode('!', $range[0]); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | $range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]); |
365 | 365 | $range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]); |
366 | 366 | $range = implode(':', $range); |
367 | 367 | |
368 | - $objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range); |
|
368 | + $objWriter->writeRawData('\''.str_replace("'", "''", $pSheet->getTitle()).'\'!'.$range); |
|
369 | 369 | |
370 | 370 | $objWriter->endElement(); |
371 | 371 | } |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | // definedName for PrintTitles |
385 | 385 | if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { |
386 | 386 | $objWriter->startElement('definedName'); |
387 | - $objWriter->writeAttribute('name', '_xlnm.Print_Titles'); |
|
388 | - $objWriter->writeAttribute('localSheetId', $pSheetId); |
|
387 | + $objWriter->writeAttribute('name', '_xlnm.Print_Titles'); |
|
388 | + $objWriter->writeAttribute('localSheetId', $pSheetId); |
|
389 | 389 | |
390 | 390 | // Setting string |
391 | 391 | $settingString = ''; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) { |
395 | 395 | $repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft(); |
396 | 396 | |
397 | - $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1]; |
|
397 | + $settingString .= '\''.str_replace("'", "''", $pSheet->getTitle()).'\'!$'.$repeat[0].':$'.$repeat[1]; |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | // Rows to repeat |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | |
406 | 406 | $repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop(); |
407 | 407 | |
408 | - $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1]; |
|
408 | + $settingString .= '\''.str_replace("'", "''", $pSheet->getTitle()).'\'!$'.$repeat[0].':$'.$repeat[1]; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | $objWriter->writeRawData($settingString); |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | // definedName for PrintArea |
428 | 428 | if ($pSheet->getPageSetup()->isPrintAreaSet()) { |
429 | 429 | $objWriter->startElement('definedName'); |
430 | - $objWriter->writeAttribute('name', '_xlnm.Print_Area'); |
|
431 | - $objWriter->writeAttribute('localSheetId', $pSheetId); |
|
430 | + $objWriter->writeAttribute('name', '_xlnm.Print_Area'); |
|
431 | + $objWriter->writeAttribute('localSheetId', $pSheetId); |
|
432 | 432 | |
433 | 433 | // Setting string |
434 | 434 | $settingString = ''; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | foreach ($printArea as $printAreaRect) { |
441 | 441 | $printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]); |
442 | 442 | $printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]); |
443 | - $chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect); |
|
443 | + $chunks[] = '\''.str_replace("'", "''", $pSheet->getTitle()).'\'!'.implode(':', $printAreaRect); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | $objWriter->writeRawData(implode(',', $chunks)); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = FALSE) |
48 | 48 | { |
49 | - if (!is_null($pSheet)) { |
|
49 | + if ( ! is_null($pSheet)) { |
|
50 | 50 | // Create XML writer |
51 | 51 | $objWriter = null; |
52 | 52 | if ($this->getParentWriter()->getUseDiskCaching()) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | // XML header |
59 | - $objWriter->startDocument('1.0','UTF-8','yes'); |
|
59 | + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); |
|
60 | 60 | |
61 | 61 | // Worksheet |
62 | 62 | $objWriter->startElement('worksheet'); |
@@ -152,20 +152,20 @@ discard block |
||
152 | 152 | // tabColor |
153 | 153 | if ($pSheet->isTabColorSet()) { |
154 | 154 | $objWriter->startElement('tabColor'); |
155 | - $objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB()); |
|
155 | + $objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB()); |
|
156 | 156 | $objWriter->endElement(); |
157 | 157 | } |
158 | 158 | |
159 | 159 | // outlinePr |
160 | 160 | $objWriter->startElement('outlinePr'); |
161 | - $objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0')); |
|
162 | - $objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0')); |
|
161 | + $objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0')); |
|
162 | + $objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0')); |
|
163 | 163 | $objWriter->endElement(); |
164 | 164 | |
165 | 165 | // pageSetUpPr |
166 | 166 | if ($pSheet->getPageSetup()->getFitToPage()) { |
167 | 167 | $objWriter->startElement('pageSetUpPr'); |
168 | - $objWriter->writeAttribute('fitToPage', '1'); |
|
168 | + $objWriter->writeAttribute('fitToPage', '1'); |
|
169 | 169 | $objWriter->endElement(); |
170 | 170 | } |
171 | 171 | |
@@ -207,22 +207,22 @@ discard block |
||
207 | 207 | |
208 | 208 | // sheetView |
209 | 209 | $objWriter->startElement('sheetView'); |
210 | - $objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0'); |
|
211 | - $objWriter->writeAttribute('workbookViewId', '0'); |
|
210 | + $objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0'); |
|
211 | + $objWriter->writeAttribute('workbookViewId', '0'); |
|
212 | 212 | |
213 | 213 | // Zoom scales |
214 | 214 | if ($pSheet->getSheetView()->getZoomScale() != 100) { |
215 | - $objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale()); |
|
215 | + $objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale()); |
|
216 | 216 | } |
217 | 217 | if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) { |
218 | - $objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal()); |
|
218 | + $objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // Gridlines |
222 | 222 | if ($pSheet->getShowGridlines()) { |
223 | - $objWriter->writeAttribute('showGridLines', 'true'); |
|
223 | + $objWriter->writeAttribute('showGridLines', 'true'); |
|
224 | 224 | } else { |
225 | - $objWriter->writeAttribute('showGridLines', 'false'); |
|
225 | + $objWriter->writeAttribute('showGridLines', 'false'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Row and column headers |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | // Right-to-left |
236 | 236 | if ($pSheet->getRightToLeft()) { |
237 | - $objWriter->writeAttribute('rightToLeft', 'true'); |
|
237 | + $objWriter->writeAttribute('rightToLeft', 'true'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | $activeCell = $pSheet->getActiveCell(); |
@@ -254,20 +254,20 @@ discard block |
||
254 | 254 | $pane = 'topRight'; |
255 | 255 | $objWriter->startElement('pane'); |
256 | 256 | if ($xSplit > 1) |
257 | - $objWriter->writeAttribute('xSplit', $xSplit - 1); |
|
257 | + $objWriter->writeAttribute('xSplit', $xSplit - 1); |
|
258 | 258 | if ($ySplit > 1) { |
259 | - $objWriter->writeAttribute('ySplit', $ySplit - 1); |
|
259 | + $objWriter->writeAttribute('ySplit', $ySplit - 1); |
|
260 | 260 | $pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft'; |
261 | 261 | } |
262 | - $objWriter->writeAttribute('topLeftCell', $topLeftCell); |
|
263 | - $objWriter->writeAttribute('activePane', $pane); |
|
264 | - $objWriter->writeAttribute('state', 'frozen'); |
|
262 | + $objWriter->writeAttribute('topLeftCell', $topLeftCell); |
|
263 | + $objWriter->writeAttribute('activePane', $pane); |
|
264 | + $objWriter->writeAttribute('state', 'frozen'); |
|
265 | 265 | $objWriter->endElement(); |
266 | 266 | |
267 | 267 | if (($xSplit > 1) && ($ySplit > 1)) { |
268 | 268 | // Write additional selections if more than two panes (ie both an X and a Y split) |
269 | - $objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'topRight'); $objWriter->endElement(); |
|
270 | - $objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'bottomLeft'); $objWriter->endElement(); |
|
269 | + $objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'topRight'); $objWriter->endElement(); |
|
270 | + $objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'bottomLeft'); $objWriter->endElement(); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | |
304 | 304 | // Default row height |
305 | 305 | if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) { |
306 | - $objWriter->writeAttribute('customHeight', 'true'); |
|
307 | - $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); |
|
306 | + $objWriter->writeAttribute('customHeight', 'true'); |
|
307 | + $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); |
|
308 | 308 | } else { |
309 | 309 | $objWriter->writeAttribute('defaultRowHeight', '14.4'); |
310 | 310 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $outlineLevelRow = $dimension->getOutlineLevel(); |
322 | 322 | } |
323 | 323 | } |
324 | - $objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow); |
|
324 | + $objWriter->writeAttribute('outlineLevelRow', (int) $outlineLevelRow); |
|
325 | 325 | |
326 | 326 | // Outline level - column |
327 | 327 | $outlineLevelCol = 0; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $outlineLevelCol = $dimension->getOutlineLevel(); |
331 | 331 | } |
332 | 332 | } |
333 | - $objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol); |
|
333 | + $objWriter->writeAttribute('outlineLevelCol', (int) $outlineLevelCol); |
|
334 | 334 | |
335 | 335 | $objWriter->endElement(); |
336 | 336 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) |
346 | 346 | { |
347 | 347 | // cols |
348 | - if (count($pSheet->getColumnDimensions()) > 0) { |
|
348 | + if (count($pSheet->getColumnDimensions()) > 0) { |
|
349 | 349 | $objWriter->startElement('cols'); |
350 | 350 | |
351 | 351 | $pSheet->calculateColumnWidths(); |
@@ -354,40 +354,40 @@ discard block |
||
354 | 354 | foreach ($pSheet->getColumnDimensions() as $colDimension) { |
355 | 355 | // col |
356 | 356 | $objWriter->startElement('col'); |
357 | - $objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); |
|
358 | - $objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); |
|
357 | + $objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); |
|
358 | + $objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex())); |
|
359 | 359 | |
360 | 360 | if ($colDimension->getWidth() < 0) { |
361 | 361 | // No width set, apply default of 10 |
362 | - $objWriter->writeAttribute('width', '9.10'); |
|
362 | + $objWriter->writeAttribute('width', '9.10'); |
|
363 | 363 | } else { |
364 | 364 | // Width set |
365 | - $objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth())); |
|
365 | + $objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth())); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | // Column visibility |
369 | 369 | if ($colDimension->getVisible() == false) { |
370 | - $objWriter->writeAttribute('hidden', 'true'); |
|
370 | + $objWriter->writeAttribute('hidden', 'true'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // Auto size? |
374 | 374 | if ($colDimension->getAutoSize()) { |
375 | - $objWriter->writeAttribute('bestFit', 'true'); |
|
375 | + $objWriter->writeAttribute('bestFit', 'true'); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | // Custom width? |
379 | 379 | if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) { |
380 | - $objWriter->writeAttribute('customWidth', 'true'); |
|
380 | + $objWriter->writeAttribute('customWidth', 'true'); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // Collapsed |
384 | 384 | if ($colDimension->getCollapsed() == true) { |
385 | - $objWriter->writeAttribute('collapsed', 'true'); |
|
385 | + $objWriter->writeAttribute('collapsed', 'true'); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | // Outline level |
389 | 389 | if ($colDimension->getOutlineLevel() > 0) { |
390 | - $objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel()); |
|
390 | + $objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel()); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | // Style |
@@ -413,25 +413,25 @@ discard block |
||
413 | 413 | $objWriter->startElement('sheetProtection'); |
414 | 414 | |
415 | 415 | if ($pSheet->getProtection()->getPassword() != '') { |
416 | - $objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword()); |
|
416 | + $objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword()); |
|
417 | 417 | } |
418 | 418 | |
419 | - $objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false')); |
|
420 | - $objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false')); |
|
421 | - $objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false')); |
|
422 | - $objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false')); |
|
423 | - $objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false')); |
|
424 | - $objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false')); |
|
425 | - $objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false')); |
|
426 | - $objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false')); |
|
427 | - $objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false')); |
|
428 | - $objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false')); |
|
429 | - $objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false')); |
|
430 | - $objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false')); |
|
431 | - $objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false')); |
|
432 | - $objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false')); |
|
433 | - $objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false')); |
|
434 | - $objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false')); |
|
419 | + $objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false')); |
|
420 | + $objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false')); |
|
421 | + $objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false')); |
|
422 | + $objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false')); |
|
423 | + $objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false')); |
|
424 | + $objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false')); |
|
425 | + $objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false')); |
|
426 | + $objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false')); |
|
427 | + $objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false')); |
|
428 | + $objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false')); |
|
429 | + $objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false')); |
|
430 | + $objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false')); |
|
431 | + $objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false')); |
|
432 | + $objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false')); |
|
433 | + $objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false')); |
|
434 | + $objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false')); |
|
435 | 435 | $objWriter->endElement(); |
436 | 436 | } |
437 | 437 | |
@@ -458,48 +458,48 @@ discard block |
||
458 | 458 | if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) { |
459 | 459 | // conditionalFormatting |
460 | 460 | $objWriter->startElement('conditionalFormatting'); |
461 | - $objWriter->writeAttribute('sqref', $cellCoordinate); |
|
461 | + $objWriter->writeAttribute('sqref', $cellCoordinate); |
|
462 | 462 | |
463 | 463 | // cfRule |
464 | 464 | $objWriter->startElement('cfRule'); |
465 | - $objWriter->writeAttribute('type', $conditional->getConditionType()); |
|
466 | - $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() )); |
|
467 | - $objWriter->writeAttribute('priority', $id++); |
|
465 | + $objWriter->writeAttribute('type', $conditional->getConditionType()); |
|
466 | + $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode())); |
|
467 | + $objWriter->writeAttribute('priority', $id++); |
|
468 | 468 | |
469 | 469 | if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS |
470 | 470 | || |
471 | 471 | $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT) |
472 | 472 | && $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) { |
473 | - $objWriter->writeAttribute('operator', $conditional->getOperatorType()); |
|
473 | + $objWriter->writeAttribute('operator', $conditional->getOperatorType()); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT |
477 | - && !is_null($conditional->getText())) { |
|
478 | - $objWriter->writeAttribute('text', $conditional->getText()); |
|
477 | + && ! is_null($conditional->getText())) { |
|
478 | + $objWriter->writeAttribute('text', $conditional->getText()); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT |
482 | 482 | && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT |
483 | - && !is_null($conditional->getText())) { |
|
484 | - $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))'); |
|
483 | + && ! is_null($conditional->getText())) { |
|
484 | + $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("'.$conditional->getText().'",'.$cellCoordinate.')))'); |
|
485 | 485 | } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT |
486 | 486 | && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH |
487 | - && !is_null($conditional->getText())) { |
|
488 | - $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); |
|
487 | + && ! is_null($conditional->getText())) { |
|
488 | + $objWriter->writeElement('formula', 'LEFT('.$cellCoordinate.','.strlen($conditional->getText()).')="'.$conditional->getText().'"'); |
|
489 | 489 | } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT |
490 | 490 | && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH |
491 | - && !is_null($conditional->getText())) { |
|
492 | - $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); |
|
491 | + && ! is_null($conditional->getText())) { |
|
492 | + $objWriter->writeElement('formula', 'RIGHT('.$cellCoordinate.','.strlen($conditional->getText()).')="'.$conditional->getText().'"'); |
|
493 | 493 | } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT |
494 | 494 | && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS |
495 | - && !is_null($conditional->getText())) { |
|
496 | - $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))'); |
|
495 | + && ! is_null($conditional->getText())) { |
|
496 | + $objWriter->writeElement('formula', 'ISERROR(SEARCH("'.$conditional->getText().'",'.$cellCoordinate.'))'); |
|
497 | 497 | } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS |
498 | 498 | || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT |
499 | 499 | || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { |
500 | 500 | foreach ($conditional->getConditions() as $formula) { |
501 | 501 | // Formula |
502 | - $objWriter->writeElement('formula', $formula); |
|
502 | + $objWriter->writeElement('formula', $formula); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $dataValidationCollection = $pSheet->getDataValidationCollection(); |
525 | 525 | |
526 | 526 | // Write data validations? |
527 | - if (!empty($dataValidationCollection)) { |
|
527 | + if ( ! empty($dataValidationCollection)) { |
|
528 | 528 | $objWriter->startElement('dataValidations'); |
529 | 529 | $objWriter->writeAttribute('count', count($dataValidationCollection)); |
530 | 530 | |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | $objWriter->writeAttribute('operator', $dv->getOperator()); |
544 | 544 | } |
545 | 545 | |
546 | - $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0')); |
|
547 | - $objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0')); |
|
548 | - $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0')); |
|
549 | - $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0')); |
|
546 | + $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0')); |
|
547 | + $objWriter->writeAttribute('showDropDown', ( ! $dv->getShowDropDown() ? '1' : '0')); |
|
548 | + $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0')); |
|
549 | + $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0')); |
|
550 | 550 | |
551 | 551 | if ($dv->getErrorTitle() !== '') { |
552 | 552 | $objWriter->writeAttribute('errorTitle', $dv->getErrorTitle()); |
@@ -593,18 +593,18 @@ discard block |
||
593 | 593 | $relationId = 1; |
594 | 594 | |
595 | 595 | // Write hyperlinks? |
596 | - if (!empty($hyperlinkCollection)) { |
|
596 | + if ( ! empty($hyperlinkCollection)) { |
|
597 | 597 | $objWriter->startElement('hyperlinks'); |
598 | 598 | |
599 | 599 | foreach ($hyperlinkCollection as $coordinate => $hyperlink) { |
600 | 600 | $objWriter->startElement('hyperlink'); |
601 | 601 | |
602 | 602 | $objWriter->writeAttribute('ref', $coordinate); |
603 | - if (!$hyperlink->isInternal()) { |
|
604 | - $objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId); |
|
603 | + if ( ! $hyperlink->isInternal()) { |
|
604 | + $objWriter->writeAttribute('r:id', 'rId_hyperlink_'.$relationId); |
|
605 | 605 | ++$relationId; |
606 | 606 | } else { |
607 | - $objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl())); |
|
607 | + $objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl())); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | if ($hyperlink->getTooltip() != '') { |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) { |
636 | 636 | // protectedRange |
637 | 637 | $objWriter->startElement('protectedRange'); |
638 | - $objWriter->writeAttribute('name', 'p' . md5($protectedCell)); |
|
639 | - $objWriter->writeAttribute('sqref', $protectedCell); |
|
640 | - $objWriter->writeAttribute('password', $passwordHash); |
|
638 | + $objWriter->writeAttribute('name', 'p'.md5($protectedCell)); |
|
639 | + $objWriter->writeAttribute('sqref', $protectedCell); |
|
640 | + $objWriter->writeAttribute('password', $passwordHash); |
|
641 | 641 | $objWriter->endElement(); |
642 | 642 | } |
643 | 643 | |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | // printOptions |
683 | 683 | $objWriter->startElement('printOptions'); |
684 | 684 | |
685 | - $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false')); |
|
686 | - $objWriter->writeAttribute('gridLinesSet', 'true'); |
|
685 | + $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true' : 'false')); |
|
686 | + $objWriter->writeAttribute('gridLinesSet', 'true'); |
|
687 | 687 | |
688 | 688 | if ($pSheet->getPageSetup()->getHorizontalCentered()) { |
689 | 689 | $objWriter->writeAttribute('horizontalCentered', 'true'); |
@@ -707,12 +707,12 @@ discard block |
||
707 | 707 | { |
708 | 708 | // pageMargins |
709 | 709 | $objWriter->startElement('pageMargins'); |
710 | - $objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft())); |
|
711 | - $objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight())); |
|
712 | - $objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop())); |
|
713 | - $objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom())); |
|
714 | - $objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader())); |
|
715 | - $objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter())); |
|
710 | + $objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft())); |
|
711 | + $objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight())); |
|
712 | + $objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop())); |
|
713 | + $objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom())); |
|
714 | + $objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader())); |
|
715 | + $objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter())); |
|
716 | 716 | $objWriter->endElement(); |
717 | 717 | } |
718 | 718 | |
@@ -733,12 +733,12 @@ discard block |
||
733 | 733 | $range = PHPExcel_Cell::splitRange($pSheet->getAutoFilter()); |
734 | 734 | $range = $range[0]; |
735 | 735 | // Strip any worksheet ref |
736 | - if (strpos($range[0],'!') !== false) { |
|
737 | - list($ws,$range[0]) = explode('!',$range[0]); |
|
736 | + if (strpos($range[0], '!') !== false) { |
|
737 | + list($ws, $range[0]) = explode('!', $range[0]); |
|
738 | 738 | } |
739 | 739 | $range = implode(':', $range); |
740 | 740 | |
741 | - $objWriter->writeAttribute('ref', str_replace('$','',$range)); |
|
741 | + $objWriter->writeAttribute('ref', str_replace('$', '', $range)); |
|
742 | 742 | $objWriter->endElement(); |
743 | 743 | } |
744 | 744 | } |
@@ -754,24 +754,24 @@ discard block |
||
754 | 754 | { |
755 | 755 | // pageSetup |
756 | 756 | $objWriter->startElement('pageSetup'); |
757 | - $objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize()); |
|
758 | - $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation()); |
|
757 | + $objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize()); |
|
758 | + $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation()); |
|
759 | 759 | |
760 | - if (!is_null($pSheet->getPageSetup()->getScale())) { |
|
761 | - $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale()); |
|
760 | + if ( ! is_null($pSheet->getPageSetup()->getScale())) { |
|
761 | + $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale()); |
|
762 | 762 | } |
763 | - if (!is_null($pSheet->getPageSetup()->getFitToHeight())) { |
|
764 | - $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight()); |
|
763 | + if ( ! is_null($pSheet->getPageSetup()->getFitToHeight())) { |
|
764 | + $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight()); |
|
765 | 765 | } else { |
766 | - $objWriter->writeAttribute('fitToHeight', '0'); |
|
766 | + $objWriter->writeAttribute('fitToHeight', '0'); |
|
767 | 767 | } |
768 | - if (!is_null($pSheet->getPageSetup()->getFitToWidth())) { |
|
769 | - $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth()); |
|
768 | + if ( ! is_null($pSheet->getPageSetup()->getFitToWidth())) { |
|
769 | + $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth()); |
|
770 | 770 | } else { |
771 | - $objWriter->writeAttribute('fitToWidth', '0'); |
|
771 | + $objWriter->writeAttribute('fitToWidth', '0'); |
|
772 | 772 | } |
773 | - if (!is_null($pSheet->getPageSetup()->getFirstPageNumber())) { |
|
774 | - $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber()); |
|
773 | + if ( ! is_null($pSheet->getPageSetup()->getFirstPageNumber())) { |
|
774 | + $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber()); |
|
775 | 775 | $objWriter->writeAttribute('useFirstPageNumber', '1'); |
776 | 776 | } |
777 | 777 | |
@@ -789,17 +789,17 @@ discard block |
||
789 | 789 | { |
790 | 790 | // headerFooter |
791 | 791 | $objWriter->startElement('headerFooter'); |
792 | - $objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false')); |
|
793 | - $objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false')); |
|
794 | - $objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false')); |
|
795 | - $objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false')); |
|
796 | - |
|
797 | - $objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader()); |
|
798 | - $objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter()); |
|
799 | - $objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader()); |
|
800 | - $objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter()); |
|
801 | - $objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader()); |
|
802 | - $objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter()); |
|
792 | + $objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false')); |
|
793 | + $objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false')); |
|
794 | + $objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false')); |
|
795 | + $objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false')); |
|
796 | + |
|
797 | + $objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader()); |
|
798 | + $objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter()); |
|
799 | + $objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader()); |
|
800 | + $objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter()); |
|
801 | + $objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader()); |
|
802 | + $objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter()); |
|
803 | 803 | $objWriter->endElement(); |
804 | 804 | } |
805 | 805 | |
@@ -824,17 +824,17 @@ discard block |
||
824 | 824 | } |
825 | 825 | |
826 | 826 | // rowBreaks |
827 | - if (!empty($aRowBreaks)) { |
|
827 | + if ( ! empty($aRowBreaks)) { |
|
828 | 828 | $objWriter->startElement('rowBreaks'); |
829 | - $objWriter->writeAttribute('count', count($aRowBreaks)); |
|
830 | - $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks)); |
|
829 | + $objWriter->writeAttribute('count', count($aRowBreaks)); |
|
830 | + $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks)); |
|
831 | 831 | |
832 | 832 | foreach ($aRowBreaks as $cell) { |
833 | 833 | $coords = PHPExcel_Cell::coordinateFromString($cell); |
834 | 834 | |
835 | 835 | $objWriter->startElement('brk'); |
836 | - $objWriter->writeAttribute('id', $coords[1]); |
|
837 | - $objWriter->writeAttribute('man', '1'); |
|
836 | + $objWriter->writeAttribute('id', $coords[1]); |
|
837 | + $objWriter->writeAttribute('man', '1'); |
|
838 | 838 | $objWriter->endElement(); |
839 | 839 | } |
840 | 840 | |
@@ -842,17 +842,17 @@ discard block |
||
842 | 842 | } |
843 | 843 | |
844 | 844 | // Second, write column breaks |
845 | - if (!empty($aColumnBreaks)) { |
|
845 | + if ( ! empty($aColumnBreaks)) { |
|
846 | 846 | $objWriter->startElement('colBreaks'); |
847 | - $objWriter->writeAttribute('count', count($aColumnBreaks)); |
|
848 | - $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks)); |
|
847 | + $objWriter->writeAttribute('count', count($aColumnBreaks)); |
|
848 | + $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks)); |
|
849 | 849 | |
850 | 850 | foreach ($aColumnBreaks as $cell) { |
851 | 851 | $coords = PHPExcel_Cell::coordinateFromString($cell); |
852 | 852 | |
853 | 853 | $objWriter->startElement('brk'); |
854 | - $objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1); |
|
855 | - $objWriter->writeAttribute('man', '1'); |
|
854 | + $objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1); |
|
855 | + $objWriter->writeAttribute('man', '1'); |
|
856 | 856 | $objWriter->endElement(); |
857 | 857 | } |
858 | 858 | |
@@ -891,12 +891,12 @@ discard block |
||
891 | 891 | } |
892 | 892 | |
893 | 893 | $currentRow = 0; |
894 | - while($currentRow++ < $highestRow) { |
|
894 | + while ($currentRow++ < $highestRow) { |
|
895 | 895 | // Get row dimension |
896 | 896 | $rowDimension = $pSheet->getRowDimension($currentRow); |
897 | 897 | |
898 | 898 | // Write current row? |
899 | - $writeCurrentRow = isset($cellsByRow[$currentRow]) || |
|
899 | + $writeCurrentRow = isset($cellsByRow[$currentRow]) || |
|
900 | 900 | $rowDimension->getRowHeight() >= 0 || |
901 | 901 | $rowDimension->getVisible() == false || |
902 | 902 | $rowDimension->getCollapsed() == true || |
@@ -906,39 +906,39 @@ discard block |
||
906 | 906 | if ($writeCurrentRow) { |
907 | 907 | // Start a new row |
908 | 908 | $objWriter->startElement('row'); |
909 | - $objWriter->writeAttribute('r', $currentRow); |
|
910 | - $objWriter->writeAttribute('spans', '1:' . $colCount); |
|
909 | + $objWriter->writeAttribute('r', $currentRow); |
|
910 | + $objWriter->writeAttribute('spans', '1:'.$colCount); |
|
911 | 911 | |
912 | 912 | // Row dimensions |
913 | 913 | if ($rowDimension->getRowHeight() >= 0) { |
914 | - $objWriter->writeAttribute('customHeight', '1'); |
|
915 | - $objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight())); |
|
914 | + $objWriter->writeAttribute('customHeight', '1'); |
|
915 | + $objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight())); |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | // Row visibility |
919 | 919 | if ($rowDimension->getVisible() == false) { |
920 | - $objWriter->writeAttribute('hidden', 'true'); |
|
920 | + $objWriter->writeAttribute('hidden', 'true'); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | // Collapsed |
924 | 924 | if ($rowDimension->getCollapsed() == true) { |
925 | - $objWriter->writeAttribute('collapsed', 'true'); |
|
925 | + $objWriter->writeAttribute('collapsed', 'true'); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | // Outline level |
929 | 929 | if ($rowDimension->getOutlineLevel() > 0) { |
930 | - $objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel()); |
|
930 | + $objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel()); |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | // Style |
934 | 934 | if ($rowDimension->getXfIndex() !== null) { |
935 | - $objWriter->writeAttribute('s', $rowDimension->getXfIndex()); |
|
935 | + $objWriter->writeAttribute('s', $rowDimension->getXfIndex()); |
|
936 | 936 | $objWriter->writeAttribute('customFormat', '1'); |
937 | 937 | } |
938 | 938 | |
939 | 939 | // Write cells |
940 | 940 | if (isset($cellsByRow[$currentRow])) { |
941 | - foreach($cellsByRow[$currentRow] as $cellAddress) { |
|
941 | + foreach ($cellsByRow[$currentRow] as $cellAddress) { |
|
942 | 942 | // Write cell |
943 | 943 | $this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable); |
944 | 944 | } |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | // Write data depending on its type |
1010 | 1010 | switch (strtolower($mappedType)) { |
1011 | 1011 | case 'inlinestr': // Inline string |
1012 | - if (! $cellValue instanceof PHPExcel_RichText) { |
|
1013 | - $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($cellValue) ) ); |
|
1012 | + if ( ! $cellValue instanceof PHPExcel_RichText) { |
|
1013 | + $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue))); |
|
1014 | 1014 | } else if ($cellValue instanceof PHPExcel_RichText) { |
1015 | 1015 | $objWriter->startElement('is'); |
1016 | 1016 | $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue); |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | |
1020 | 1020 | break; |
1021 | 1021 | case 's': // String |
1022 | - if (! $cellValue instanceof PHPExcel_RichText) { |
|
1022 | + if ( ! $cellValue instanceof PHPExcel_RichText) { |
|
1023 | 1023 | if (isset($pFlippedStringTable[$cellValue])) { |
1024 | 1024 | $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]); |
1025 | 1025 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | break; |
1031 | 1031 | case 'f': // Formula |
1032 | 1032 | $attributes = $pCell->getFormulaAttributes(); |
1033 | - if($attributes['t'] == 'array') { |
|
1033 | + if ($attributes['t'] == 'array') { |
|
1034 | 1034 | $objWriter->startElement('f'); |
1035 | 1035 | $objWriter->writeAttribute('t', 'array'); |
1036 | 1036 | $objWriter->writeAttribute('ref', $pCellAddress); |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | if ($this->getParentWriter()->getOffice2003Compatibility() === false) { |
1045 | 1045 | if ($this->getParentWriter()->getPreCalculateFormulas()) { |
1046 | 1046 | $calculatedValue = $pCell->getCalculatedValue(); |
1047 | - if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') { |
|
1047 | + if ( ! is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') { |
|
1048 | 1048 | $objWriter->writeElement('v', PHPExcel_Shared_String::FormatNumber($calculatedValue)); |
1049 | 1049 | } else { |
1050 | 1050 | $objWriter->writeElement('v', '0'); |
@@ -201,8 +201,9 @@ discard block |
||
201 | 201 | |
202 | 202 | // Sheet selected? |
203 | 203 | $sheetSelected = false; |
204 | - if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) |
|
205 | - $sheetSelected = true; |
|
204 | + if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) { |
|
205 | + $sheetSelected = true; |
|
206 | + } |
|
206 | 207 | |
207 | 208 | |
208 | 209 | // sheetView |
@@ -253,8 +254,9 @@ discard block |
||
253 | 254 | // pane |
254 | 255 | $pane = 'topRight'; |
255 | 256 | $objWriter->startElement('pane'); |
256 | - if ($xSplit > 1) |
|
257 | - $objWriter->writeAttribute('xSplit', $xSplit - 1); |
|
257 | + if ($xSplit > 1) { |
|
258 | + $objWriter->writeAttribute('xSplit', $xSplit - 1); |
|
259 | + } |
|
258 | 260 | if ($ySplit > 1) { |
259 | 261 | $objWriter->writeAttribute('ySplit', $ySplit - 1); |
260 | 262 | $pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft'; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @throws Exception |
60 | 60 | */ |
61 | 61 | public function getParentWriter() { |
62 | - if (!is_null($this->_parentWriter)) { |
|
62 | + if ( ! is_null($this->_parentWriter)) { |
|
63 | 63 | return $this->_parentWriter; |
64 | 64 | } else { |
65 | 65 | throw new Exception("No parent PHPExcel_Writer_IWriter assigned."); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @throws Exception |
74 | 74 | */ |
75 | 75 | public function __construct(PHPExcel_Writer_IWriter $pWriter = null) { |
76 | - if (!is_null($pWriter)) { |
|
76 | + if ( ! is_null($pWriter)) { |
|
77 | 77 | $this->_parentWriter = $pWriter; |
78 | 78 | } |
79 | 79 | } |
@@ -621,33 +621,33 @@ |
||
621 | 621 | $dataProp = pack('v', 0x0002); |
622 | 622 | $dataProp .= pack('v', 0x0000); |
623 | 623 | // Array of vtHeadingPair |
624 | - // vtUnalignedString - headingString |
|
625 | - // stringType |
|
626 | - $dataProp .= pack('v', 0x001E); |
|
627 | - // padding |
|
628 | - $dataProp .= pack('v', 0x0000); |
|
629 | - // UnalignedLpstr |
|
630 | - // cch |
|
631 | - $dataProp .= pack('v', 0x0013); |
|
632 | - $dataProp .= pack('v', 0x0000); |
|
633 | - // value |
|
634 | - $dataProp .= 'Feuilles de calcul'; |
|
635 | - // vtUnalignedString - headingParts |
|
636 | - // wType : 0x0003 = 32 bit signed integer |
|
637 | - $dataProp .= pack('v', 0x0300); |
|
638 | - // padding |
|
639 | - $dataProp .= pack('v', 0x0000); |
|
640 | - // value |
|
641 | - $dataProp .= pack('v', 0x0100); |
|
642 | - $dataProp .= pack('v', 0x0000); |
|
624 | + // vtUnalignedString - headingString |
|
625 | + // stringType |
|
626 | + $dataProp .= pack('v', 0x001E); |
|
627 | + // padding |
|
628 | + $dataProp .= pack('v', 0x0000); |
|
629 | + // UnalignedLpstr |
|
630 | + // cch |
|
631 | + $dataProp .= pack('v', 0x0013); |
|
632 | + $dataProp .= pack('v', 0x0000); |
|
633 | + // value |
|
634 | + $dataProp .= 'Feuilles de calcul'; |
|
635 | + // vtUnalignedString - headingParts |
|
636 | + // wType : 0x0003 = 32 bit signed integer |
|
637 | + $dataProp .= pack('v', 0x0300); |
|
638 | + // padding |
|
639 | + $dataProp .= pack('v', 0x0000); |
|
640 | + // value |
|
641 | + $dataProp .= pack('v', 0x0100); |
|
642 | + $dataProp .= pack('v', 0x0000); |
|
643 | + $dataProp .= pack('v', 0x0000); |
|
643 | 644 | $dataProp .= pack('v', 0x0000); |
644 | - $dataProp .= pack('v', 0x0000); |
|
645 | 645 | |
646 | - $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C), |
|
647 | - 'offset' => array('pack' => 'V'), |
|
648 | - 'type' => array('pack' => 'V', 'data' => 0x100C), |
|
649 | - 'data' => array('data' => $dataProp, 'length' => strlen($dataProp))); |
|
650 | - $dataSection_NumProps++; |
|
646 | + $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C), |
|
647 | + 'offset' => array('pack' => 'V'), |
|
648 | + 'type' => array('pack' => 'V', 'data' => 0x100C), |
|
649 | + 'data' => array('data' => $dataProp, 'length' => strlen($dataProp))); |
|
650 | + $dataSection_NumProps++; |
|
651 | 651 | |
652 | 652 | // 4 Section Length |
653 | 653 | // 4 Property count |
@@ -440,33 +440,33 @@ discard block |
||
440 | 440 | |
441 | 441 | switch ($imageFormat) { |
442 | 442 | |
443 | - case 1: // GIF, not supported by BIFF8, we convert to PNG |
|
444 | - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
445 | - ob_start(); |
|
446 | - imagepng(imagecreatefromgif($filename)); |
|
447 | - $blipData = ob_get_contents(); |
|
448 | - ob_end_clean(); |
|
449 | - break; |
|
450 | - |
|
451 | - case 2: // JPEG |
|
452 | - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; |
|
453 | - $blipData = file_get_contents($filename); |
|
454 | - break; |
|
455 | - |
|
456 | - case 3: // PNG |
|
457 | - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
458 | - $blipData = file_get_contents($filename); |
|
459 | - break; |
|
460 | - |
|
461 | - case 6: // Windows DIB (BMP), we convert to PNG |
|
462 | - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
463 | - ob_start(); |
|
464 | - imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename)); |
|
465 | - $blipData = ob_get_contents(); |
|
466 | - ob_end_clean(); |
|
467 | - break; |
|
468 | - |
|
469 | - default: continue 2; |
|
443 | + case 1: // GIF, not supported by BIFF8, we convert to PNG |
|
444 | + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
445 | + ob_start(); |
|
446 | + imagepng(imagecreatefromgif($filename)); |
|
447 | + $blipData = ob_get_contents(); |
|
448 | + ob_end_clean(); |
|
449 | + break; |
|
450 | + |
|
451 | + case 2: // JPEG |
|
452 | + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; |
|
453 | + $blipData = file_get_contents($filename); |
|
454 | + break; |
|
455 | + |
|
456 | + case 3: // PNG |
|
457 | + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
458 | + $blipData = file_get_contents($filename); |
|
459 | + break; |
|
460 | + |
|
461 | + case 6: // Windows DIB (BMP), we convert to PNG |
|
462 | + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
463 | + ob_start(); |
|
464 | + imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename)); |
|
465 | + $blipData = ob_get_contents(); |
|
466 | + ob_end_clean(); |
|
467 | + break; |
|
468 | + |
|
469 | + default: continue 2; |
|
470 | 470 | |
471 | 471 | } |
472 | 472 | |
@@ -483,17 +483,17 @@ discard block |
||
483 | 483 | |
484 | 484 | switch ($drawing->getRenderingFunction()) { |
485 | 485 | |
486 | - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG: |
|
487 | - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; |
|
488 | - $renderingFunction = 'imagejpeg'; |
|
489 | - break; |
|
490 | - |
|
491 | - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF: |
|
492 | - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG: |
|
493 | - case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT: |
|
494 | - $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
495 | - $renderingFunction = 'imagepng'; |
|
496 | - break; |
|
486 | + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG: |
|
487 | + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG; |
|
488 | + $renderingFunction = 'imagejpeg'; |
|
489 | + break; |
|
490 | + |
|
491 | + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF: |
|
492 | + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG: |
|
493 | + case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT: |
|
494 | + $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG; |
|
495 | + $renderingFunction = 'imagepng'; |
|
496 | + break; |
|
497 | 497 | |
498 | 498 | } |
499 | 499 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @var boolean |
42 | 42 | */ |
43 | - private $_preCalculateFormulas = true; |
|
43 | + private $_preCalculateFormulas = true; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * PHPExcel object |
@@ -54,21 +54,21 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @var int |
56 | 56 | */ |
57 | - private $_str_total = 0; |
|
57 | + private $_str_total = 0; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Number of unique shared strings in workbook |
61 | 61 | * |
62 | 62 | * @var int |
63 | 63 | */ |
64 | - private $_str_unique = 0; |
|
64 | + private $_str_unique = 0; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Array of unique shared strings in workbook |
68 | 68 | * |
69 | 69 | * @var array |
70 | 70 | */ |
71 | - private $_str_table = array(); |
|
71 | + private $_str_table = array(); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Color cache. Mapping between RGB value and color index. |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | * @param PHPExcel $phpExcel PHPExcel object |
112 | 112 | */ |
113 | 113 | public function __construct(PHPExcel $phpExcel) { |
114 | - $this->_phpExcel = $phpExcel; |
|
114 | + $this->_phpExcel = $phpExcel; |
|
115 | 115 | |
116 | - $this->_parser = new PHPExcel_Writer_Excel5_Parser(); |
|
116 | + $this->_parser = new PHPExcel_Writer_Excel5_Parser(); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); |
134 | 134 | |
135 | 135 | // initialize colors array |
136 | - $this->_colors = array(); |
|
136 | + $this->_colors = array(); |
|
137 | 137 | |
138 | 138 | // Initialise workbook writer |
139 | 139 | $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | // add binary data for global workbook stream |
199 | - $OLE->append( $this->_writerWorkbook->writeWorkbook($worksheetSizes) ); |
|
199 | + $OLE->append($this->_writerWorkbook->writeWorkbook($worksheetSizes)); |
|
200 | 200 | |
201 | 201 | // add binary data for sheet streams |
202 | 202 | for ($i = 0; $i < $countSheets; ++$i) { |
@@ -205,26 +205,26 @@ discard block |
||
205 | 205 | |
206 | 206 | $this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation(); |
207 | 207 | // initialize OLE Document Summary Information |
208 | - if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){ |
|
209 | - $OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation')); |
|
208 | + if (isset($this->_documentSummaryInformation) && ! empty($this->_documentSummaryInformation)) { |
|
209 | + $OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5).'DocumentSummaryInformation')); |
|
210 | 210 | $OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation); |
211 | 211 | } |
212 | 212 | |
213 | 213 | $this->_summaryInformation = $this->_writeSummaryInformation(); |
214 | 214 | // initialize OLE Summary Information |
215 | - if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){ |
|
216 | - $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation')); |
|
215 | + if (isset($this->_summaryInformation) && ! empty($this->_summaryInformation)) { |
|
216 | + $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5).'SummaryInformation')); |
|
217 | 217 | $OLE_SummaryInformation->append($this->_summaryInformation); |
218 | 218 | } |
219 | 219 | |
220 | 220 | // define OLE Parts |
221 | 221 | $arrRootData = array($OLE); |
222 | 222 | // initialize OLE Properties file |
223 | - if(isset($OLE_SummaryInformation)){ |
|
223 | + if (isset($OLE_SummaryInformation)) { |
|
224 | 224 | $arrRootData[] = $OLE_SummaryInformation; |
225 | 225 | } |
226 | 226 | // initialize OLE Extended Properties file |
227 | - if(isset($OLE_DocumentSummaryInformation)){ |
|
227 | + if (isset($OLE_DocumentSummaryInformation)) { |
|
228 | 228 | $arrRootData[] = $OLE_DocumentSummaryInformation; |
229 | 229 | } |
230 | 230 | |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | // nothing to do if there are no drawings |
388 | - if (!$found) { |
|
388 | + if ( ! $found) { |
|
389 | 389 | return; |
390 | 390 | } |
391 | 391 | |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | * Build the OLE Part for DocumentSummary Information |
523 | 523 | * @return string |
524 | 524 | */ |
525 | - private function _writeDocumentSummaryInformation(){ |
|
525 | + private function _writeDocumentSummaryInformation() { |
|
526 | 526 | |
527 | 527 | // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) |
528 | 528 | $data = pack('v', 0xFFFE); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $dataSection_NumProps++; |
557 | 557 | |
558 | 558 | // GKPIDDSI_CATEGORY : Category |
559 | - if($this->_phpExcel->getProperties()->getCategory()){ |
|
559 | + if ($this->_phpExcel->getProperties()->getCategory()) { |
|
560 | 560 | $dataProp = $this->_phpExcel->getProperties()->getCategory(); |
561 | 561 | $dataProp = 'Test result file'; |
562 | 562 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | // 4 Property count |
654 | 654 | // 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4)) |
655 | 655 | $dataSection_Content_Offset = 8 + $dataSection_NumProps * 8; |
656 | - foreach ($dataSection as $dataProp){ |
|
656 | + foreach ($dataSection as $dataProp) { |
|
657 | 657 | // Summary |
658 | 658 | $dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']); |
659 | 659 | // Offset |
@@ -661,30 +661,30 @@ discard block |
||
661 | 661 | // DataType |
662 | 662 | $dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']); |
663 | 663 | // Data |
664 | - if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer |
|
664 | + if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer |
|
665 | 665 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
666 | 666 | |
667 | 667 | $dataSection_Content_Offset += 4 + 4; |
668 | 668 | } |
669 | - elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer |
|
669 | + elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer |
|
670 | 670 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
671 | 671 | |
672 | 672 | $dataSection_Content_Offset += 4 + 4; |
673 | 673 | } |
674 | - elseif($dataProp['type']['data'] == 0x0B){ // Boolean |
|
675 | - if($dataProp['data']['data'] == false){ |
|
674 | + elseif ($dataProp['type']['data'] == 0x0B) { // Boolean |
|
675 | + if ($dataProp['data']['data'] == false) { |
|
676 | 676 | $dataSection_Content .= pack('V', 0x0000); |
677 | 677 | } else { |
678 | 678 | $dataSection_Content .= pack('V', 0x0001); |
679 | 679 | } |
680 | 680 | $dataSection_Content_Offset += 4 + 4; |
681 | 681 | } |
682 | - elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length |
|
682 | + elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length |
|
683 | 683 | // Null-terminated string |
684 | 684 | $dataProp['data']['data'] .= chr(0); |
685 | 685 | $dataProp['data']['length'] += 1; |
686 | 686 | // Complete the string with null string for being a %4 |
687 | - $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4)); |
|
687 | + $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4)); |
|
688 | 688 | $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT); |
689 | 689 | |
690 | 690 | $dataSection_Content .= pack('V', $dataProp['data']['length']); |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | |
693 | 693 | $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']); |
694 | 694 | } |
695 | - elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
695 | + elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
696 | 696 | $dataSection_Content .= $dataProp['data']['data']; |
697 | 697 | |
698 | 698 | $dataSection_Content_Offset += 4 + 8; |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | * Build the OLE Part for Summary Information |
725 | 725 | * @return string |
726 | 726 | */ |
727 | - private function _writeSummaryInformation(){ |
|
727 | + private function _writeSummaryInformation() { |
|
728 | 728 | // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) |
729 | 729 | $data = pack('v', 0xFFFE); |
730 | 730 | // offset: 2; size: 2; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | $dataSection_NumProps++; |
758 | 758 | |
759 | 759 | // Title |
760 | - if($this->_phpExcel->getProperties()->getTitle()){ |
|
760 | + if ($this->_phpExcel->getProperties()->getTitle()) { |
|
761 | 761 | $dataProp = $this->_phpExcel->getProperties()->getTitle(); |
762 | 762 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), |
763 | 763 | 'offset' => array('pack' => 'V'), |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | $dataSection_NumProps++; |
767 | 767 | } |
768 | 768 | // Subject |
769 | - if($this->_phpExcel->getProperties()->getSubject()){ |
|
769 | + if ($this->_phpExcel->getProperties()->getSubject()) { |
|
770 | 770 | $dataProp = $this->_phpExcel->getProperties()->getSubject(); |
771 | 771 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03), |
772 | 772 | 'offset' => array('pack' => 'V'), |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $dataSection_NumProps++; |
776 | 776 | } |
777 | 777 | // Author (Creator) |
778 | - if($this->_phpExcel->getProperties()->getCreator()){ |
|
778 | + if ($this->_phpExcel->getProperties()->getCreator()) { |
|
779 | 779 | $dataProp = $this->_phpExcel->getProperties()->getCreator(); |
780 | 780 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04), |
781 | 781 | 'offset' => array('pack' => 'V'), |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $dataSection_NumProps++; |
785 | 785 | } |
786 | 786 | // Keywords |
787 | - if($this->_phpExcel->getProperties()->getKeywords()){ |
|
787 | + if ($this->_phpExcel->getProperties()->getKeywords()) { |
|
788 | 788 | $dataProp = $this->_phpExcel->getProperties()->getKeywords(); |
789 | 789 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05), |
790 | 790 | 'offset' => array('pack' => 'V'), |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | $dataSection_NumProps++; |
794 | 794 | } |
795 | 795 | // Comments (Description) |
796 | - if($this->_phpExcel->getProperties()->getDescription()){ |
|
796 | + if ($this->_phpExcel->getProperties()->getDescription()) { |
|
797 | 797 | $dataProp = $this->_phpExcel->getProperties()->getDescription(); |
798 | 798 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06), |
799 | 799 | 'offset' => array('pack' => 'V'), |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | $dataSection_NumProps++; |
803 | 803 | } |
804 | 804 | // Last Saved By (LastModifiedBy) |
805 | - if($this->_phpExcel->getProperties()->getLastModifiedBy()){ |
|
805 | + if ($this->_phpExcel->getProperties()->getLastModifiedBy()) { |
|
806 | 806 | $dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy(); |
807 | 807 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08), |
808 | 808 | 'offset' => array('pack' => 'V'), |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | $dataSection_NumProps++; |
812 | 812 | } |
813 | 813 | // Created Date/Time |
814 | - if($this->_phpExcel->getProperties()->getCreated()){ |
|
814 | + if ($this->_phpExcel->getProperties()->getCreated()) { |
|
815 | 815 | $dataProp = $this->_phpExcel->getProperties()->getCreated(); |
816 | 816 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C), |
817 | 817 | 'offset' => array('pack' => 'V'), |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $dataSection_NumProps++; |
821 | 821 | } |
822 | 822 | // Modified Date/Time |
823 | - if($this->_phpExcel->getProperties()->getModified()){ |
|
823 | + if ($this->_phpExcel->getProperties()->getModified()) { |
|
824 | 824 | $dataProp = $this->_phpExcel->getProperties()->getModified(); |
825 | 825 | $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D), |
826 | 826 | 'offset' => array('pack' => 'V'), |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | // 4 Property count |
841 | 841 | // 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4)) |
842 | 842 | $dataSection_Content_Offset = 8 + $dataSection_NumProps * 8; |
843 | - foreach ($dataSection as $dataProp){ |
|
843 | + foreach ($dataSection as $dataProp) { |
|
844 | 844 | // Summary |
845 | 845 | $dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']); |
846 | 846 | // Offset |
@@ -848,22 +848,22 @@ discard block |
||
848 | 848 | // DataType |
849 | 849 | $dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']); |
850 | 850 | // Data |
851 | - if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer |
|
851 | + if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer |
|
852 | 852 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
853 | 853 | |
854 | 854 | $dataSection_Content_Offset += 4 + 4; |
855 | 855 | } |
856 | - elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer |
|
856 | + elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer |
|
857 | 857 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
858 | 858 | |
859 | 859 | $dataSection_Content_Offset += 4 + 4; |
860 | 860 | } |
861 | - elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length |
|
861 | + elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length |
|
862 | 862 | // Null-terminated string |
863 | 863 | $dataProp['data']['data'] .= chr(0); |
864 | 864 | $dataProp['data']['length'] += 1; |
865 | 865 | // Complete the string with null string for being a %4 |
866 | - $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4)); |
|
866 | + $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4)); |
|
867 | 867 | $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT); |
868 | 868 | |
869 | 869 | $dataSection_Content .= pack('V', $dataProp['data']['length']); |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | |
872 | 872 | $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']); |
873 | 873 | } |
874 | - elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
874 | + elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
875 | 875 | $dataSection_Content .= $dataProp['data']['data']; |
876 | 876 | |
877 | 877 | $dataSection_Content_Offset += 4 + 8; |
@@ -665,21 +665,18 @@ discard block |
||
665 | 665 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
666 | 666 | |
667 | 667 | $dataSection_Content_Offset += 4 + 4; |
668 | - } |
|
669 | - elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer |
|
668 | + } elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer |
|
670 | 669 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
671 | 670 | |
672 | 671 | $dataSection_Content_Offset += 4 + 4; |
673 | - } |
|
674 | - elseif($dataProp['type']['data'] == 0x0B){ // Boolean |
|
672 | + } elseif($dataProp['type']['data'] == 0x0B){ // Boolean |
|
675 | 673 | if($dataProp['data']['data'] == false){ |
676 | 674 | $dataSection_Content .= pack('V', 0x0000); |
677 | 675 | } else { |
678 | 676 | $dataSection_Content .= pack('V', 0x0001); |
679 | 677 | } |
680 | 678 | $dataSection_Content_Offset += 4 + 4; |
681 | - } |
|
682 | - elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length |
|
679 | + } elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length |
|
683 | 680 | // Null-terminated string |
684 | 681 | $dataProp['data']['data'] .= chr(0); |
685 | 682 | $dataProp['data']['length'] += 1; |
@@ -691,13 +688,11 @@ discard block |
||
691 | 688 | $dataSection_Content .= $dataProp['data']['data']; |
692 | 689 | |
693 | 690 | $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']); |
694 | - } |
|
695 | - elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
691 | + } elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
696 | 692 | $dataSection_Content .= $dataProp['data']['data']; |
697 | 693 | |
698 | 694 | $dataSection_Content_Offset += 4 + 8; |
699 | - } |
|
700 | - else { |
|
695 | + } else { |
|
701 | 696 | // Data Type Not Used at the moment |
702 | 697 | $dataSection_Content .= $dataProp['data']['data']; |
703 | 698 | |
@@ -852,13 +847,11 @@ discard block |
||
852 | 847 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
853 | 848 | |
854 | 849 | $dataSection_Content_Offset += 4 + 4; |
855 | - } |
|
856 | - elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer |
|
850 | + } elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer |
|
857 | 851 | $dataSection_Content .= pack('V', $dataProp['data']['data']); |
858 | 852 | |
859 | 853 | $dataSection_Content_Offset += 4 + 4; |
860 | - } |
|
861 | - elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length |
|
854 | + } elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length |
|
862 | 855 | // Null-terminated string |
863 | 856 | $dataProp['data']['data'] .= chr(0); |
864 | 857 | $dataProp['data']['length'] += 1; |
@@ -870,13 +863,11 @@ discard block |
||
870 | 863 | $dataSection_Content .= $dataProp['data']['data']; |
871 | 864 | |
872 | 865 | $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']); |
873 | - } |
|
874 | - elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
866 | + } elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) |
|
875 | 867 | $dataSection_Content .= $dataProp['data']['data']; |
876 | 868 | |
877 | 869 | $dataSection_Content_Offset += 4 + 8; |
878 | - } |
|
879 | - else { |
|
870 | + } else { |
|
880 | 871 | // Data Type Not Used at the moment |
881 | 872 | } |
882 | 873 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @var integer |
93 | 93 | * @see _addContinue() |
94 | 94 | */ |
95 | - public $_limit = 8224; |
|
95 | + public $_limit = 8224; |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Constructor |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public static function getByteOrder() |
114 | 114 | { |
115 | - if (!isset(self::$_byte_order)) { |
|
115 | + if ( ! isset(self::$_byte_order)) { |
|
116 | 116 | // Check if "pack" gives the required IEEE 64bit float |
117 | 117 | $teststr = pack("d", 1.2345); |
118 | 118 | $number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F); |
119 | 119 | if ($number == $teststr) { |
120 | - $byte_order = 0; // Little Endian |
|
121 | - } elseif ($number == strrev($teststr)){ |
|
122 | - $byte_order = 1; // Big Endian |
|
120 | + $byte_order = 0; // Little Endian |
|
121 | + } elseif ($number == strrev($teststr)) { |
|
122 | + $byte_order = 1; // Big Endian |
|
123 | 123 | } else { |
124 | 124 | // Give up. I'll fix this in a later version. |
125 | 125 | throw new Exception("Required floating point format not supported on this platform."); |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | if (strlen($data) - 4 > $this->_limit) { |
142 | 142 | $data = $this->_addContinue($data); |
143 | 143 | } |
144 | - $this->_data .= $data; |
|
145 | - $this->_datasize += strlen($data); |
|
144 | + $this->_data .= $data; |
|
145 | + $this->_datasize += strlen($data); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -171,20 +171,20 @@ discard block |
||
171 | 171 | */ |
172 | 172 | function _storeBof($type) |
173 | 173 | { |
174 | - $record = 0x0809; // Record identifier (BIFF5-BIFF8) |
|
174 | + $record = 0x0809; // Record identifier (BIFF5-BIFF8) |
|
175 | 175 | $length = 0x0010; |
176 | 176 | |
177 | 177 | // by inspection of real files, MS Office Excel 2007 writes the following |
178 | 178 | $unknown = pack("VV", 0x000100D1, 0x00000406); |
179 | 179 | |
180 | - $build = 0x0DBB; // Excel 97 |
|
181 | - $year = 0x07CC; // Excel 97 |
|
180 | + $build = 0x0DBB; // Excel 97 |
|
181 | + $year = 0x07CC; // Excel 97 |
|
182 | 182 | |
183 | - $version = 0x0600; // BIFF8 |
|
183 | + $version = 0x0600; // BIFF8 |
|
184 | 184 | |
185 | - $header = pack("vv", $record, $length); |
|
185 | + $header = pack("vv", $record, $length); |
|
186 | 186 | $data = pack("vvvv", $version, $type, $build, $year); |
187 | - $this->_append($header . $data . $unknown); |
|
187 | + $this->_append($header.$data.$unknown); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | */ |
195 | 195 | function _storeEof() |
196 | 196 | { |
197 | - $record = 0x000A; // Record identifier |
|
198 | - $length = 0x0000; // Number of bytes to follow |
|
197 | + $record = 0x000A; // Record identifier |
|
198 | + $length = 0x0000; // Number of bytes to follow |
|
199 | 199 | |
200 | 200 | $header = pack("vv", $record, $length); |
201 | 201 | $this->_append($header); |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function writeEof() |
210 | 210 | { |
211 | - $record = 0x000A; // Record identifier |
|
212 | - $length = 0x0000; // Number of bytes to follow |
|
211 | + $record = 0x000A; // Record identifier |
|
212 | + $length = 0x0000; // Number of bytes to follow |
|
213 | 213 | $header = pack("vv", $record, $length); |
214 | 214 | return $this->writeData($header); |
215 | 215 | } |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | function _addContinue($data) |
230 | 230 | { |
231 | 231 | $limit = $this->_limit; |
232 | - $record = 0x003C; // Record identifier |
|
232 | + $record = 0x003C; // Record identifier |
|
233 | 233 | |
234 | 234 | // The first 2080/8224 bytes remain intact. However, we have to change |
235 | 235 | // the length field of the record. |
236 | - $tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit); |
|
236 | + $tmp = substr($data, 0, 2).pack("v", $limit).substr($data, 4, $limit); |
|
237 | 237 | |
238 | - $header = pack("vv", $record, $limit); // Headers for continue records |
|
238 | + $header = pack("vv", $record, $limit); // Headers for continue records |
|
239 | 239 | |
240 | 240 | // Retrieve chunks of 2080/8224 bytes +4 for the header. |
241 | 241 | $data_length = strlen($data); |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | $bFamily = 0; // Font family |
92 | 92 | $bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->_font->getName()); // Character set |
93 | 93 | |
94 | - $record = 0x31; // Record identifier |
|
95 | - $reserved = 0x00; // Reserved |
|
96 | - $grbit = 0x00; // Font attributes |
|
94 | + $record = 0x31; // Record identifier |
|
95 | + $reserved = 0x00; // Reserved |
|
96 | + $grbit = 0x00; // Font attributes |
|
97 | 97 | if ($this->_font->getItalic()) { |
98 | 98 | $grbit |= 0x02; |
99 | 99 | } |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | $data = pack("vvvvvCCCC", |
111 | - $this->_font->getSize() * 20, // Fontsize (in twips) |
|
111 | + $this->_font->getSize() * 20, // Fontsize (in twips) |
|
112 | 112 | $grbit, |
113 | - $icv, // Colour |
|
114 | - self::_mapBold($this->_font->getBold()), // Font weight |
|
115 | - $sss, // Superscript/Subscript |
|
113 | + $icv, // Colour |
|
114 | + self::_mapBold($this->_font->getBold()), // Font weight |
|
115 | + $sss, // Superscript/Subscript |
|
116 | 116 | self::_mapUnderline($this->_font->getUnderline()), |
117 | 117 | $bFamily, |
118 | 118 | $bCharSet, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $length = strlen($data); |
124 | 124 | $header = pack("vv", $record, $length); |
125 | 125 | |
126 | - return($header . $data); |
|
126 | + return($header.$data); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private static function _mapBold($bold) { |
136 | 136 | if ($bold) { |
137 | - return 0x2BC; // 700 = Bold font weight |
|
137 | + return 0x2BC; // 700 = Bold font weight |
|
138 | 138 | } |
139 | - return 0x190; // 400 = Normal font weight |
|
139 | + return 0x190; // 400 = Normal font weight |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @static array of int |
145 | 145 | * |
146 | 146 | */ |
147 | - private static $_mapUnderline = array( PHPExcel_Style_Font::UNDERLINE_NONE => 0x00, |
|
147 | + private static $_mapUnderline = array(PHPExcel_Style_Font::UNDERLINE_NONE => 0x00, |
|
148 | 148 | PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01, |
149 | 149 | PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02, |
150 | 150 | PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21, |
@@ -157,8 +157,9 @@ |
||
157 | 157 | * @return int |
158 | 158 | */ |
159 | 159 | private static function _mapUnderline($underline) { |
160 | - if (isset(self::$_mapUnderline[$underline])) |
|
161 | - return self::$_mapUnderline[$underline]; |
|
160 | + if (isset(self::$_mapUnderline[$underline])) { |
|
161 | + return self::$_mapUnderline[$underline]; |
|
162 | + } |
|
162 | 163 | return 0x00; |
163 | 164 | } |
164 | 165 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | class PHPExcel_Writer_Excel5_Xf |
72 | 72 | { |
73 | - /** |
|
73 | + /** |
|
74 | 74 | * Style XF or a cell XF ? |
75 | 75 | * |
76 | 76 | * @var boolean |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | public $_top_color; |
121 | 121 | |
122 | 122 | /** |
123 | - * Color of the left border of the cell. |
|
124 | - * @var integer |
|
125 | - */ |
|
123 | + * Color of the left border of the cell. |
|
124 | + * @var integer |
|
125 | + */ |
|
126 | 126 | public $_left_color; |
127 | 127 | |
128 | 128 | /** |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function __construct(PHPExcel_Style $style = null) |
141 | 141 | { |
142 | - $this->_isStyleXf = false; |
|
143 | - $this->_fontIndex = 0; |
|
142 | + $this->_isStyleXf = false; |
|
143 | + $this->_fontIndex = 0; |
|
144 | 144 | |
145 | - $this->_numberFormatIndex = 0; |
|
145 | + $this->_numberFormatIndex = 0; |
|
146 | 146 | |
147 | 147 | $this->_text_justlast = 0; |
148 | 148 | |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | // Flags to indicate if attributes have been set. |
180 | - $atr_num = ($this->_numberFormatIndex != 0)?1:0; |
|
181 | - $atr_fnt = ($this->_fontIndex != 0)?1:0; |
|
182 | - $atr_alc = ((int) $this->_style->getAlignment()->getWrapText())?1:0; |
|
183 | - $atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || |
|
184 | - self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || |
|
185 | - self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || |
|
186 | - self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0; |
|
180 | + $atr_num = ($this->_numberFormatIndex != 0) ? 1 : 0; |
|
181 | + $atr_fnt = ($this->_fontIndex != 0) ? 1 : 0; |
|
182 | + $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0; |
|
183 | + $atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || |
|
184 | + self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || |
|
185 | + self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || |
|
186 | + self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle())) ? 1 : 0; |
|
187 | 187 | $atr_pat = (($this->_fg_color != 0x40) || |
188 | 188 | ($this->_bg_color != 0x41) || |
189 | - self::_mapFillType($this->_style->getFill()->getFillType()))?1:0; |
|
189 | + self::_mapFillType($this->_style->getFill()->getFillType())) ? 1 : 0; |
|
190 | 190 | $atr_prot = self::_mapLocked($this->_style->getProtection()->getLocked()) |
191 | 191 | | self::_mapHidden($this->_style->getProtection()->getHidden()); |
192 | 192 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) { |
195 | 195 | $this->_bottom_color = 0; |
196 | 196 | } |
197 | - if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { |
|
197 | + if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { |
|
198 | 198 | $this->_top_color = 0; |
199 | 199 | } |
200 | 200 | if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) { |
@@ -207,49 +207,49 @@ discard block |
||
207 | 207 | $this->_diag_color = 0; |
208 | 208 | } |
209 | 209 | |
210 | - $record = 0x00E0; // Record identifier |
|
211 | - $length = 0x0014; // Number of bytes to follow |
|
210 | + $record = 0x00E0; // Record identifier |
|
211 | + $length = 0x0014; // Number of bytes to follow |
|
212 | 212 | |
213 | - $ifnt = $this->_fontIndex; // Index to FONT record |
|
214 | - $ifmt = $this->_numberFormatIndex; // Index to FORMAT record |
|
213 | + $ifnt = $this->_fontIndex; // Index to FONT record |
|
214 | + $ifmt = $this->_numberFormatIndex; // Index to FORMAT record |
|
215 | 215 | |
216 | - $align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment |
|
217 | - $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; |
|
218 | - $align |= self::_mapVAlign($this->_style->getAlignment()->getVertical()) << 4; |
|
216 | + $align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment |
|
217 | + $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; |
|
218 | + $align |= self::_mapVAlign($this->_style->getAlignment()->getVertical()) << 4; |
|
219 | 219 | $align |= $this->_text_justlast << 7; |
220 | 220 | |
221 | - $used_attrib = $atr_num << 2; |
|
222 | - $used_attrib |= $atr_fnt << 3; |
|
223 | - $used_attrib |= $atr_alc << 4; |
|
224 | - $used_attrib |= $atr_bdr << 5; |
|
225 | - $used_attrib |= $atr_pat << 6; |
|
226 | - $used_attrib |= $atr_prot << 7; |
|
221 | + $used_attrib = $atr_num << 2; |
|
222 | + $used_attrib |= $atr_fnt << 3; |
|
223 | + $used_attrib |= $atr_alc << 4; |
|
224 | + $used_attrib |= $atr_bdr << 5; |
|
225 | + $used_attrib |= $atr_pat << 6; |
|
226 | + $used_attrib |= $atr_prot << 7; |
|
227 | 227 | |
228 | - $icv = $this->_fg_color; // fg and bg pattern colors |
|
229 | - $icv |= $this->_bg_color << 7; |
|
228 | + $icv = $this->_fg_color; // fg and bg pattern colors |
|
229 | + $icv |= $this->_bg_color << 7; |
|
230 | 230 | |
231 | - $border1 = self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color |
|
232 | - $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4; |
|
233 | - $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8; |
|
234 | - $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; |
|
235 | - $border1 |= $this->_left_color << 16; |
|
236 | - $border1 |= $this->_right_color << 23; |
|
231 | + $border1 = self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color |
|
232 | + $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4; |
|
233 | + $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8; |
|
234 | + $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; |
|
235 | + $border1 |= $this->_left_color << 16; |
|
236 | + $border1 |= $this->_right_color << 23; |
|
237 | 237 | |
238 | 238 | $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection(); |
239 | 239 | $diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH |
240 | 240 | || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN; |
241 | 241 | $diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH |
242 | 242 | || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP; |
243 | - $border1 |= $diag_tl_to_rb << 30; |
|
244 | - $border1 |= $diag_tr_to_lb << 31; |
|
243 | + $border1 |= $diag_tl_to_rb << 30; |
|
244 | + $border1 |= $diag_tr_to_lb << 31; |
|
245 | 245 | |
246 | - $border2 = $this->_top_color; // Border color |
|
247 | - $border2 |= $this->_bottom_color << 7; |
|
248 | - $border2 |= $this->_diag_color << 14; |
|
249 | - $border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; |
|
250 | - $border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26; |
|
246 | + $border2 = $this->_top_color; // Border color |
|
247 | + $border2 |= $this->_bottom_color << 7; |
|
248 | + $border2 |= $this->_diag_color << 14; |
|
249 | + $border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; |
|
250 | + $border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26; |
|
251 | 251 | |
252 | - $header = pack("vv", $record, $length); |
|
252 | + $header = pack("vv", $record, $length); |
|
253 | 253 | |
254 | 254 | //BIFF8 options: identation, shrinkToFit and text direction |
255 | 255 | $biff8_options = $this->_style->getAlignment()->getIndent(); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | ); |
264 | 264 | $data .= pack("VVv", $border1, $border2, $icv); |
265 | 265 | |
266 | - return($header . $data); |
|
266 | + return($header.$data); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @static array of int |
382 | 382 | * |
383 | 383 | */ |
384 | - private static $_mapBorderStyle = array ( PHPExcel_Style_Border::BORDER_NONE => 0x00, |
|
384 | + private static $_mapBorderStyle = array(PHPExcel_Style_Border::BORDER_NONE => 0x00, |
|
385 | 385 | PHPExcel_Style_Border::BORDER_THIN => 0x01, |
386 | 386 | PHPExcel_Style_Border::BORDER_MEDIUM => 0x02, |
387 | 387 | PHPExcel_Style_Border::BORDER_DASHED => 0x03, |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * @static array of int |
415 | 415 | * |
416 | 416 | */ |
417 | - private static $_mapFillType = array( PHPExcel_Style_Fill::FILL_NONE => 0x00, |
|
417 | + private static $_mapFillType = array(PHPExcel_Style_Fill::FILL_NONE => 0x00, |
|
418 | 418 | PHPExcel_Style_Fill::FILL_SOLID => 0x01, |
419 | 419 | PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, |
420 | 420 | PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03, |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, |
434 | 434 | PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11, |
435 | 435 | PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12, |
436 | - PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 |
|
437 | - PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 |
|
436 | + PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 |
|
437 | + PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 |
|
438 | 438 | ); |
439 | 439 | /** |
440 | 440 | * Map fill type |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @static array of int |
454 | 454 | * |
455 | 455 | */ |
456 | - private static $_mapHAlign = array( PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, |
|
456 | + private static $_mapHAlign = array(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0, |
|
457 | 457 | PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, |
458 | 458 | PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, |
459 | 459 | PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * @static array of int |
479 | 479 | * |
480 | 480 | */ |
481 | - private static $_mapVAlign = array( PHPExcel_Style_Alignment::VERTICAL_TOP => 0, |
|
481 | + private static $_mapVAlign = array(PHPExcel_Style_Alignment::VERTICAL_TOP => 0, |
|
482 | 482 | PHPExcel_Style_Alignment::VERTICAL_CENTER => 1, |
483 | 483 | PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2, |
484 | 484 | PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3, |
@@ -404,8 +404,9 @@ discard block |
||
404 | 404 | * @return int |
405 | 405 | */ |
406 | 406 | private static function _mapBorderStyle($borderStyle) { |
407 | - if (isset(self::$_mapBorderStyle[$borderStyle])) |
|
408 | - return self::$_mapBorderStyle[$borderStyle]; |
|
407 | + if (isset(self::$_mapBorderStyle[$borderStyle])) { |
|
408 | + return self::$_mapBorderStyle[$borderStyle]; |
|
409 | + } |
|
409 | 410 | return 0x00; |
410 | 411 | } |
411 | 412 | |
@@ -443,8 +444,9 @@ discard block |
||
443 | 444 | * @return int |
444 | 445 | */ |
445 | 446 | private static function _mapFillType($fillType) { |
446 | - if (isset(self::$_mapFillType[$fillType])) |
|
447 | - return self::$_mapFillType[$fillType]; |
|
447 | + if (isset(self::$_mapFillType[$fillType])) { |
|
448 | + return self::$_mapFillType[$fillType]; |
|
449 | + } |
|
448 | 450 | return 0x00; |
449 | 451 | } |
450 | 452 | |
@@ -468,8 +470,9 @@ discard block |
||
468 | 470 | */ |
469 | 471 | private function _mapHAlign($hAlign) |
470 | 472 | { |
471 | - if (isset(self::$_mapHAlign[$hAlign])) |
|
472 | - return self::$_mapHAlign[$hAlign]; |
|
473 | + if (isset(self::$_mapHAlign[$hAlign])) { |
|
474 | + return self::$_mapHAlign[$hAlign]; |
|
475 | + } |
|
473 | 476 | return 0; |
474 | 477 | } |
475 | 478 | |
@@ -490,8 +493,9 @@ discard block |
||
490 | 493 | * @return int |
491 | 494 | */ |
492 | 495 | private static function _mapVAlign($vAlign) { |
493 | - if (isset(self::$_mapVAlign[$vAlign])) |
|
494 | - return self::$_mapVAlign[$vAlign]; |
|
496 | + if (isset(self::$_mapVAlign[$vAlign])) { |
|
497 | + return self::$_mapVAlign[$vAlign]; |
|
498 | + } |
|
495 | 499 | return 2; |
496 | 500 | } |
497 | 501 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @var int |
48 | 48 | */ |
49 | - private $_sheetIndex = 0; |
|
49 | + private $_sheetIndex = 0; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Pre-calculate formulas |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @var string |
62 | 62 | */ |
63 | - private $_imagesRoot = '.'; |
|
63 | + private $_imagesRoot = '.'; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Use inline CSS? |
@@ -95,28 +95,28 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @var boolean |
97 | 97 | */ |
98 | - private $_spansAreCalculated = false; |
|
98 | + private $_spansAreCalculated = false; |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Excel cells that should not be written as HTML cells |
102 | 102 | * |
103 | 103 | * @var array |
104 | 104 | */ |
105 | - private $_isSpannedCell = array(); |
|
105 | + private $_isSpannedCell = array(); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Excel cells that are upper-left corner in a cell merge |
109 | 109 | * |
110 | 110 | * @var array |
111 | 111 | */ |
112 | - private $_isBaseCell = array(); |
|
112 | + private $_isBaseCell = array(); |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Excel rows that should not be written as HTML rows |
116 | 116 | * |
117 | 117 | * @var array |
118 | 118 | */ |
119 | - private $_isSpannedRow = array(); |
|
119 | + private $_isSpannedRow = array(); |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Is the current writer creating PDF? |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); |
159 | 159 | |
160 | 160 | // Build CSS |
161 | - $this->buildCSS(!$this->_useInlineCss); |
|
161 | + $this->buildCSS( ! $this->_useInlineCss); |
|
162 | 162 | |
163 | 163 | // Open file |
164 | 164 | $fileHandle = fopen($pFilename, 'wb+'); |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | // Write headers |
170 | - fwrite($fileHandle, $this->generateHTMLHeader(!$this->_useInlineCss)); |
|
170 | + fwrite($fileHandle, $this->generateHTMLHeader( ! $this->_useInlineCss)); |
|
171 | 171 | |
172 | 172 | // Write navigation (tabs) |
173 | - if ((!$this->_isPdf) && ($this->_generateSheetNavigationBlock)) { |
|
173 | + if (( ! $this->_isPdf) && ($this->_generateSheetNavigationBlock)) { |
|
174 | 174 | fwrite($fileHandle, $this->generateNavigation()); |
175 | 175 | } |
176 | 176 | |
@@ -310,38 +310,38 @@ discard block |
||
310 | 310 | |
311 | 311 | // Construct HTML |
312 | 312 | $properties = $this->_phpExcel->getProperties(); |
313 | - $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . PHP_EOL; |
|
314 | - $html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . PHP_EOL; |
|
315 | - $html .= '<html>' . PHP_EOL; |
|
316 | - $html .= ' <head>' . PHP_EOL; |
|
317 | - $html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL; |
|
313 | + $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'.PHP_EOL; |
|
314 | + $html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->'.PHP_EOL; |
|
315 | + $html .= '<html>'.PHP_EOL; |
|
316 | + $html .= ' <head>'.PHP_EOL; |
|
317 | + $html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">'.PHP_EOL; |
|
318 | 318 | if ($properties->getTitle() > '') |
319 | - $html .= ' <title>' . htmlspecialchars($properties->getTitle()) . '</title>' . PHP_EOL; |
|
319 | + $html .= ' <title>'.htmlspecialchars($properties->getTitle()).'</title>'.PHP_EOL; |
|
320 | 320 | |
321 | 321 | if ($properties->getCreator() > '') |
322 | - $html .= ' <meta name="author" content="' . htmlspecialchars($properties->getCreator()) . '" />' . PHP_EOL; |
|
322 | + $html .= ' <meta name="author" content="'.htmlspecialchars($properties->getCreator()).'" />'.PHP_EOL; |
|
323 | 323 | if ($properties->getTitle() > '') |
324 | - $html .= ' <meta name="title" content="' . htmlspecialchars($properties->getTitle()) . '" />' . PHP_EOL; |
|
324 | + $html .= ' <meta name="title" content="'.htmlspecialchars($properties->getTitle()).'" />'.PHP_EOL; |
|
325 | 325 | if ($properties->getDescription() > '') |
326 | - $html .= ' <meta name="description" content="' . htmlspecialchars($properties->getDescription()) . '" />' . PHP_EOL; |
|
326 | + $html .= ' <meta name="description" content="'.htmlspecialchars($properties->getDescription()).'" />'.PHP_EOL; |
|
327 | 327 | if ($properties->getSubject() > '') |
328 | - $html .= ' <meta name="subject" content="' . htmlspecialchars($properties->getSubject()) . '" />' . PHP_EOL; |
|
328 | + $html .= ' <meta name="subject" content="'.htmlspecialchars($properties->getSubject()).'" />'.PHP_EOL; |
|
329 | 329 | if ($properties->getKeywords() > '') |
330 | - $html .= ' <meta name="keywords" content="' . htmlspecialchars($properties->getKeywords()) . '" />' . PHP_EOL; |
|
330 | + $html .= ' <meta name="keywords" content="'.htmlspecialchars($properties->getKeywords()).'" />'.PHP_EOL; |
|
331 | 331 | if ($properties->getCategory() > '') |
332 | - $html .= ' <meta name="category" content="' . htmlspecialchars($properties->getCategory()) . '" />' . PHP_EOL; |
|
332 | + $html .= ' <meta name="category" content="'.htmlspecialchars($properties->getCategory()).'" />'.PHP_EOL; |
|
333 | 333 | if ($properties->getCompany() > '') |
334 | - $html .= ' <meta name="company" content="' . htmlspecialchars($properties->getCompany()) . '" />' . PHP_EOL; |
|
334 | + $html .= ' <meta name="company" content="'.htmlspecialchars($properties->getCompany()).'" />'.PHP_EOL; |
|
335 | 335 | if ($properties->getManager() > '') |
336 | - $html .= ' <meta name="manager" content="' . htmlspecialchars($properties->getManager()) . '" />' . PHP_EOL; |
|
336 | + $html .= ' <meta name="manager" content="'.htmlspecialchars($properties->getManager()).'" />'.PHP_EOL; |
|
337 | 337 | |
338 | 338 | if ($pIncludeStyles) { |
339 | 339 | $html .= $this->generateStyles(true); |
340 | 340 | } |
341 | 341 | |
342 | - $html .= ' </head>' . PHP_EOL; |
|
343 | - $html .= '' . PHP_EOL; |
|
344 | - $html .= ' <body>' . PHP_EOL; |
|
342 | + $html .= ' </head>'.PHP_EOL; |
|
343 | + $html .= ''.PHP_EOL; |
|
344 | + $html .= ' <body>'.PHP_EOL; |
|
345 | 345 | |
346 | 346 | // Return |
347 | 347 | return $html; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | } |
361 | 361 | |
362 | 362 | // Ensure that Spans have been calculated? |
363 | - if (!$this->_spansAreCalculated) { |
|
363 | + if ( ! $this->_spansAreCalculated) { |
|
364 | 364 | $this->_calculateSpans(); |
365 | 365 | } |
366 | 366 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | // calculate start of <tbody>, <thead> |
396 | 396 | $tbodyStart = $rowMin; |
397 | 397 | $tbodyEnd = $rowMax; |
398 | - $theadStart = $theadEnd = 0; // default: no <thead> no </thead> |
|
398 | + $theadStart = $theadEnd = 0; // default: no <thead> no </thead> |
|
399 | 399 | if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) { |
400 | 400 | $rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop(); |
401 | 401 | |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | } |
409 | 409 | |
410 | 410 | // Loop through cells |
411 | - $row = $rowMin-1; |
|
412 | - while($row++ < $rowMax) { |
|
411 | + $row = $rowMin - 1; |
|
412 | + while ($row++ < $rowMax) { |
|
413 | 413 | // <thead> ? |
414 | 414 | if ($row == $theadStart) { |
415 | - $html .= ' <thead>' . PHP_EOL; |
|
415 | + $html .= ' <thead>'.PHP_EOL; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | // <tbody> ? |
419 | 419 | if ($row == $tbodyStart) { |
420 | - $html .= ' <tbody>' . PHP_EOL; |
|
420 | + $html .= ' <tbody>'.PHP_EOL; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | // Write row if there are HTML table cells in it |
424 | - if ( !isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row]) ) { |
|
424 | + if ( ! isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row])) { |
|
425 | 425 | // Start a new rowData |
426 | 426 | $rowData = array(); |
427 | 427 | // Loop through columns |
428 | 428 | $column = $dimension[0][0] - 1; |
429 | - while($column++ < $dimension[1][0]) { |
|
429 | + while ($column++ < $dimension[1][0]) { |
|
430 | 430 | // Cell exists? |
431 | 431 | if ($sheet->cellExistsByColumnAndRow($column, $row)) { |
432 | 432 | $rowData[$column] = $sheet->getCellByColumnAndRow($column, $row); |
@@ -439,12 +439,12 @@ discard block |
||
439 | 439 | |
440 | 440 | // </thead> ? |
441 | 441 | if ($row == $theadEnd) { |
442 | - $html .= ' </thead>' . PHP_EOL; |
|
442 | + $html .= ' </thead>'.PHP_EOL; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | // </tbody> ? |
446 | 446 | if ($row == $tbodyEnd) { |
447 | - $html .= ' </tbody>' . PHP_EOL; |
|
447 | + $html .= ' </tbody>'.PHP_EOL; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
@@ -495,14 +495,14 @@ discard block |
||
495 | 495 | // Loop all sheets |
496 | 496 | $sheetId = 0; |
497 | 497 | |
498 | - $html .= '<ul class="navigation">' . PHP_EOL; |
|
498 | + $html .= '<ul class="navigation">'.PHP_EOL; |
|
499 | 499 | |
500 | 500 | foreach ($sheets as $sheet) { |
501 | - $html .= ' <li class="sheet' . $sheetId . '"><a href="#sheet' . $sheetId . '">' . $sheet->getTitle() . '</a></li>' . PHP_EOL; |
|
501 | + $html .= ' <li class="sheet'.$sheetId.'"><a href="#sheet'.$sheetId.'">'.$sheet->getTitle().'</a></li>'.PHP_EOL; |
|
502 | 502 | ++$sheetId; |
503 | 503 | } |
504 | 504 | |
505 | - $html .= '</ul>' . PHP_EOL; |
|
505 | + $html .= '</ul>'.PHP_EOL; |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | return $html; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | // Prepend images root |
535 | - $filename = $this->getImagesRoot() . $filename; |
|
535 | + $filename = $this->getImagesRoot().$filename; |
|
536 | 536 | |
537 | 537 | // Strip off eventual '.' |
538 | 538 | if (substr($filename, 0, 1) == '.' && substr($filename, 0, 2) != './') { |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $filename = htmlspecialchars($filename); |
544 | 544 | |
545 | 545 | $html .= PHP_EOL; |
546 | - $html .= ' <img style="position: relative; left: ' . $drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px; width: ' . $drawing->getWidth() . 'px; height: ' . $drawing->getHeight() . 'px;" src="' . $filename . '" border="0" width="' . $drawing->getWidth() . '" height="' . $drawing->getHeight() . '" />' . PHP_EOL; |
|
546 | + $html .= ' <img style="position: relative; left: '.$drawing->getOffsetX().'px; top: '.$drawing->getOffsetY().'px; width: '.$drawing->getWidth().'px; height: '.$drawing->getHeight().'px;" src="'.$filename.'" border="0" width="'.$drawing->getWidth().'" height="'.$drawing->getHeight().'" />'.PHP_EOL; |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | } |
@@ -573,20 +573,20 @@ discard block |
||
573 | 573 | |
574 | 574 | // Start styles |
575 | 575 | if ($generateSurroundingHTML) { |
576 | - $html .= ' <style type="text/css">' . PHP_EOL; |
|
577 | - $html .= ' html { ' . $this->_assembleCSS($css['html']) . ' }' . PHP_EOL; |
|
576 | + $html .= ' <style type="text/css">'.PHP_EOL; |
|
577 | + $html .= ' html { '.$this->_assembleCSS($css['html']).' }'.PHP_EOL; |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | // Write all other styles |
581 | 581 | foreach ($css as $styleName => $styleDefinition) { |
582 | 582 | if ($styleName != 'html') { |
583 | - $html .= ' ' . $styleName . ' { ' . $this->_assembleCSS($styleDefinition) . ' }' . PHP_EOL; |
|
583 | + $html .= ' '.$styleName.' { '.$this->_assembleCSS($styleDefinition).' }'.PHP_EOL; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | |
587 | 587 | // End styles |
588 | 588 | if ($generateSurroundingHTML) { |
589 | - $html .= ' </style>' . PHP_EOL; |
|
589 | + $html .= ' </style>'.PHP_EOL; |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | // Return |
@@ -607,12 +607,12 @@ discard block |
||
607 | 607 | } |
608 | 608 | |
609 | 609 | // Cached? |
610 | - if (!is_null($this->_cssStyles)) { |
|
610 | + if ( ! is_null($this->_cssStyles)) { |
|
611 | 611 | return $this->_cssStyles; |
612 | 612 | } |
613 | 613 | |
614 | 614 | // Ensure that spans have been calculated |
615 | - if (!$this->_spansAreCalculated) { |
|
615 | + if ( ! $this->_spansAreCalculated) { |
|
616 | 616 | $this->_calculateSpans(); |
617 | 617 | } |
618 | 618 | |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | // Start styles |
623 | 623 | if ($generateSurroundingHTML) { |
624 | 624 | // html { } |
625 | - $css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif'; |
|
626 | - $css['html']['font-size'] = '11pt'; |
|
625 | + $css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif'; |
|
626 | + $css['html']['font-size'] = '11pt'; |
|
627 | 627 | $css['html']['background-color'] = 'white'; |
628 | 628 | } |
629 | 629 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | // Calculate cell style hashes |
657 | 657 | foreach ($this->_phpExcel->getCellXfCollection() as $index => $style) { |
658 | - $css['td.style' . $index] = $this->_createCSSStyle( $style ); |
|
658 | + $css['td.style'.$index] = $this->_createCSSStyle($style); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | // Fetch sheets |
@@ -678,9 +678,9 @@ discard block |
||
678 | 678 | // col elements, initialize |
679 | 679 | $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1; |
680 | 680 | $column = -1; |
681 | - while($column++ < $highestColumnIndex) { |
|
681 | + while ($column++ < $highestColumnIndex) { |
|
682 | 682 | $this->_columnWidths[$sheetIndex][$column] = 42; // approximation |
683 | - $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = '42pt'; |
|
683 | + $css['table.sheet'.$sheetIndex.' col.col'.$column]['width'] = '42pt'; |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | // col elements, loop through columnDimensions and set width |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | $width = PHPExcel_Shared_Drawing::pixelsToPoints($width); |
690 | 690 | $column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1; |
691 | 691 | $this->_columnWidths[$sheetIndex][$column] = $width; |
692 | - $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt'; |
|
692 | + $css['table.sheet'.$sheetIndex.' col.col'.$column]['width'] = $width.'pt'; |
|
693 | 693 | |
694 | 694 | if ($columnDimension->getVisible() === false) { |
695 | - $css['table.sheet' . $sheetIndex . ' col.col' . $column]['visibility'] = 'collapse'; |
|
696 | - $css['table.sheet' . $sheetIndex . ' col.col' . $column]['*display'] = 'none'; // target IE6+7 |
|
695 | + $css['table.sheet'.$sheetIndex.' col.col'.$column]['visibility'] = 'collapse'; |
|
696 | + $css['table.sheet'.$sheetIndex.' col.col'.$column]['*display'] = 'none'; // target IE6+7 |
|
697 | 697 | } |
698 | 698 | } |
699 | 699 | } |
@@ -702,17 +702,17 @@ discard block |
||
702 | 702 | $rowDimension = $sheet->getDefaultRowDimension(); |
703 | 703 | |
704 | 704 | // table.sheetN tr { } |
705 | - $css['table.sheet' . $sheetIndex . ' tr'] = array(); |
|
705 | + $css['table.sheet'.$sheetIndex.' tr'] = array(); |
|
706 | 706 | |
707 | 707 | if ($rowDimension->getRowHeight() == -1) { |
708 | 708 | $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont()); |
709 | 709 | } else { |
710 | 710 | $pt_height = $rowDimension->getRowHeight(); |
711 | 711 | } |
712 | - $css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt'; |
|
712 | + $css['table.sheet'.$sheetIndex.' tr']['height'] = $pt_height.'pt'; |
|
713 | 713 | if ($rowDimension->getVisible() === false) { |
714 | - $css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none'; |
|
715 | - $css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden'; |
|
714 | + $css['table.sheet'.$sheetIndex.' tr']['display'] = 'none'; |
|
715 | + $css['table.sheet'.$sheetIndex.' tr']['visibility'] = 'hidden'; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | // Calculate row heights |
@@ -720,17 +720,17 @@ discard block |
||
720 | 720 | $row = $rowDimension->getRowIndex() - 1; |
721 | 721 | |
722 | 722 | // table.sheetN tr.rowYYYYYY { } |
723 | - $css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array(); |
|
723 | + $css['table.sheet'.$sheetIndex.' tr.row'.$row] = array(); |
|
724 | 724 | |
725 | 725 | if ($rowDimension->getRowHeight() == -1) { |
726 | 726 | $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont()); |
727 | 727 | } else { |
728 | 728 | $pt_height = $rowDimension->getRowHeight(); |
729 | 729 | } |
730 | - $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['height'] = $pt_height . 'pt'; |
|
730 | + $css['table.sheet'.$sheetIndex.' tr.row'.$row]['height'] = $pt_height.'pt'; |
|
731 | 731 | if ($rowDimension->getVisible() === false) { |
732 | - $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['display'] = 'none'; |
|
733 | - $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['visibility'] = 'hidden'; |
|
732 | + $css['table.sheet'.$sheetIndex.' tr.row'.$row]['display'] = 'none'; |
|
733 | + $css['table.sheet'.$sheetIndex.' tr.row'.$row]['visibility'] = 'hidden'; |
|
734 | 734 | } |
735 | 735 | } |
736 | 736 | } |
@@ -811,9 +811,9 @@ discard block |
||
811 | 811 | $css['font-style'] = 'italic'; |
812 | 812 | } |
813 | 813 | |
814 | - $css['color'] = '#' . $pStyle->getColor()->getRGB(); |
|
815 | - $css['font-family'] = '\'' . $pStyle->getName() . '\''; |
|
816 | - $css['font-size'] = $pStyle->getSize() . 'pt'; |
|
814 | + $css['color'] = '#'.$pStyle->getColor()->getRGB(); |
|
815 | + $css['font-family'] = '\''.$pStyle->getName().'\''; |
|
816 | + $css['font-size'] = $pStyle->getSize().'pt'; |
|
817 | 817 | |
818 | 818 | // Return |
819 | 819 | return $css; |
@@ -830,8 +830,8 @@ discard block |
||
830 | 830 | $css = array(); |
831 | 831 | |
832 | 832 | // Create CSS |
833 | - $css['border-bottom'] = $this->_createCSSStyleBorder($pStyle->getBottom()); |
|
834 | - $css['border-top'] = $this->_createCSSStyleBorder($pStyle->getTop()); |
|
833 | + $css['border-bottom'] = $this->_createCSSStyleBorder($pStyle->getBottom()); |
|
834 | + $css['border-top'] = $this->_createCSSStyleBorder($pStyle->getTop()); |
|
835 | 835 | $css['border-left'] = $this->_createCSSStyleBorder($pStyle->getLeft()); |
836 | 836 | $css['border-right'] = $this->_createCSSStyleBorder($pStyle->getRight()); |
837 | 837 | |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | */ |
848 | 848 | private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) { |
849 | 849 | // Create CSS |
850 | - $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); |
|
850 | + $css = $this->_mapBorderStyle($pStyle->getBorderStyle()).' #'.$pStyle->getColor()->getRGB(); |
|
851 | 851 | |
852 | 852 | // Return |
853 | 853 | return $css; |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | // Create CSS |
867 | 867 | $value = $pStyle->getFillType() == PHPExcel_Style_Fill::FILL_NONE ? |
868 | - 'white' : '#' . $pStyle->getStartColor()->getRGB(); |
|
868 | + 'white' : '#'.$pStyle->getStartColor()->getRGB(); |
|
869 | 869 | $css['background-color'] = $value; |
870 | 870 | |
871 | 871 | // Return |
@@ -878,8 +878,8 @@ discard block |
||
878 | 878 | public function generateHTMLFooter() { |
879 | 879 | // Construct HTML |
880 | 880 | $html = ''; |
881 | - $html .= ' </body>' . PHP_EOL; |
|
882 | - $html .= '</html>' . PHP_EOL; |
|
881 | + $html .= ' </body>'.PHP_EOL; |
|
882 | + $html .= '</html>'.PHP_EOL; |
|
883 | 883 | |
884 | 884 | // Return |
885 | 885 | return $html; |
@@ -898,30 +898,30 @@ discard block |
||
898 | 898 | // Construct HTML |
899 | 899 | $html = ''; |
900 | 900 | |
901 | - if (!$this->_useInlineCss) { |
|
901 | + if ( ! $this->_useInlineCss) { |
|
902 | 902 | $gridlines = $pSheet->getShowGridLines() ? ' gridlines' : ''; |
903 | - $html .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . PHP_EOL; |
|
903 | + $html .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet'.$sheetIndex.'" class="sheet'.$sheetIndex.$gridlines.'">'.PHP_EOL; |
|
904 | 904 | } else { |
905 | 905 | $style = isset($this->_cssStyles['table']) ? |
906 | 906 | $this->_assembleCSS($this->_cssStyles['table']) : ''; |
907 | 907 | |
908 | 908 | if ($this->_isPdf && $pSheet->getShowGridLines()) { |
909 | - $html .= ' <table border="1" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="4" style="' . $style . '">' . PHP_EOL; |
|
909 | + $html .= ' <table border="1" cellpadding="1" id="sheet'.$sheetIndex.'" cellspacing="4" style="'.$style.'">'.PHP_EOL; |
|
910 | 910 | } else { |
911 | - $html .= ' <table border="0" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="4" style="' . $style . '">' . PHP_EOL; |
|
911 | + $html .= ' <table border="0" cellpadding="1" id="sheet'.$sheetIndex.'" cellspacing="4" style="'.$style.'">'.PHP_EOL; |
|
912 | 912 | } |
913 | 913 | } |
914 | 914 | |
915 | 915 | // Write <col> elements |
916 | 916 | $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1; |
917 | 917 | $i = -1; |
918 | - while($i++ < $highestColumnIndex) { |
|
919 | - if (!$this->_useInlineCss) { |
|
920 | - $html .= ' <col class="col' . $i . '">' . PHP_EOL; |
|
918 | + while ($i++ < $highestColumnIndex) { |
|
919 | + if ( ! $this->_useInlineCss) { |
|
920 | + $html .= ' <col class="col'.$i.'">'.PHP_EOL; |
|
921 | 921 | } else { |
922 | - $style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ? |
|
923 | - $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : ''; |
|
924 | - $html .= ' <col style="' . $style . '">' . PHP_EOL; |
|
922 | + $style = isset($this->_cssStyles['table.sheet'.$sheetIndex.' col.col'.$i]) ? |
|
923 | + $this->_assembleCSS($this->_cssStyles['table.sheet'.$sheetIndex.' col.col'.$i]) : ''; |
|
924 | + $html .= ' <col style="'.$style.'">'.PHP_EOL; |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | private function _generateTableFooter() { |
938 | 938 | // Construct HTML |
939 | 939 | $html = ''; |
940 | - $html .= ' </table>' . PHP_EOL; |
|
940 | + $html .= ' </table>'.PHP_EOL; |
|
941 | 941 | |
942 | 942 | // Return |
943 | 943 | return $html; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $breaks = $pSheet->getBreaks(); |
966 | 966 | |
967 | 967 | // check if a break is needed before this row |
968 | - if (isset($breaks['A' . $pRow])) { |
|
968 | + if (isset($breaks['A'.$pRow])) { |
|
969 | 969 | // close table: </table> |
970 | 970 | $html .= $this->_generateTableFooter(); |
971 | 971 | |
@@ -978,27 +978,27 @@ discard block |
||
978 | 978 | } |
979 | 979 | |
980 | 980 | // Write row start |
981 | - if (!$this->_useInlineCss) { |
|
982 | - $html .= ' <tr class="row' . $pRow . '">' . PHP_EOL; |
|
981 | + if ( ! $this->_useInlineCss) { |
|
982 | + $html .= ' <tr class="row'.$pRow.'">'.PHP_EOL; |
|
983 | 983 | } else { |
984 | - $style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) |
|
985 | - ? $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : ''; |
|
984 | + $style = isset($this->_cssStyles['table.sheet'.$sheetIndex.' tr.row'.$pRow]) |
|
985 | + ? $this->_assembleCSS($this->_cssStyles['table.sheet'.$sheetIndex.' tr.row'.$pRow]) : ''; |
|
986 | 986 | |
987 | - $html .= ' <tr style="' . $style . '">' . PHP_EOL; |
|
987 | + $html .= ' <tr style="'.$style.'">'.PHP_EOL; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | // Write cells |
991 | 991 | $colNum = 0; |
992 | 992 | foreach ($pValues as $cell) { |
993 | - $coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum) . ($pRow + 1); |
|
993 | + $coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum).($pRow + 1); |
|
994 | 994 | |
995 | - if (!$this->_useInlineCss) { |
|
995 | + if ( ! $this->_useInlineCss) { |
|
996 | 996 | $cssClass = ''; |
997 | - $cssClass = 'column' . $colNum; |
|
997 | + $cssClass = 'column'.$colNum; |
|
998 | 998 | } else { |
999 | 999 | $cssClass = array(); |
1000 | - if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum])) { |
|
1001 | - $this->_cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum]; |
|
1000 | + if (isset($this->_cssStyles['table.sheet'.$sheetIndex.' td.column'.$colNum])) { |
|
1001 | + $this->_cssStyles['table.sheet'.$sheetIndex.' td.column'.$colNum]; |
|
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | $colSpan = 1; |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | foreach ($elements as $element) { |
1020 | 1020 | // Rich text start? |
1021 | 1021 | if ($element instanceof PHPExcel_RichText_Run) { |
1022 | - $cellData .= '<span style="' . $this->_assembleCSS($this->_createCSSStyleFont($element->getFont())) . '">'; |
|
1022 | + $cellData .= '<span style="'.$this->_assembleCSS($this->_createCSSStyleFont($element->getFont())).'">'; |
|
1023 | 1023 | |
1024 | 1024 | if ($element->getFont()->getSuperScript()) { |
1025 | 1025 | $cellData .= '<sup>'; |
@@ -1046,19 +1046,19 @@ discard block |
||
1046 | 1046 | if ($this->_preCalculateFormulas) { |
1047 | 1047 | $cellData = PHPExcel_Style_NumberFormat::toFormattedString( |
1048 | 1048 | $cell->getCalculatedValue(), |
1049 | - $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(), |
|
1049 | + $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(), |
|
1050 | 1050 | array($this, 'formatColor') |
1051 | 1051 | ); |
1052 | 1052 | } else { |
1053 | 1053 | $cellData = PHPExcel_Style_NumberFormat::ToFormattedString( |
1054 | 1054 | $cell->getValue(), |
1055 | - $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(), |
|
1055 | + $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(), |
|
1056 | 1056 | array($this, 'formatColor') |
1057 | 1057 | ); |
1058 | 1058 | } |
1059 | - if ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSuperScript()) { |
|
1059 | + if ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSuperScript()) { |
|
1060 | 1060 | $cellData = '<sup>'.$cellData.'</sup>'; |
1061 | - } elseif ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSubScript()) { |
|
1061 | + } elseif ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSubScript()) { |
|
1062 | 1062 | $cellData = '<sub>'.$cellData.'</sub>'; |
1063 | 1063 | } |
1064 | 1064 | } |
@@ -1071,32 +1071,32 @@ discard block |
||
1071 | 1071 | $cellData = nl2br($cellData); |
1072 | 1072 | |
1073 | 1073 | // Extend CSS class? |
1074 | - if (!$this->_useInlineCss) { |
|
1075 | - $cssClass .= ' style' . $cell->getXfIndex(); |
|
1076 | - $cssClass .= ' ' . $cell->getDataType(); |
|
1074 | + if ( ! $this->_useInlineCss) { |
|
1075 | + $cssClass .= ' style'.$cell->getXfIndex(); |
|
1076 | + $cssClass .= ' '.$cell->getDataType(); |
|
1077 | 1077 | } else { |
1078 | - if (isset($this->_cssStyles['td.style' . $cell->getXfIndex()])) { |
|
1079 | - $cssClass = array_merge($cssClass, $this->_cssStyles['td.style' . $cell->getXfIndex()]); |
|
1078 | + if (isset($this->_cssStyles['td.style'.$cell->getXfIndex()])) { |
|
1079 | + $cssClass = array_merge($cssClass, $this->_cssStyles['td.style'.$cell->getXfIndex()]); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | // General horizontal alignment: Actual horizontal alignment depends on dataType |
1083 | - $sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() ); |
|
1083 | + $sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex()); |
|
1084 | 1084 | if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL |
1085 | - && isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) |
|
1085 | + && isset($this->_cssStyles['.'.$cell->getDataType()]['text-align'])) |
|
1086 | 1086 | { |
1087 | - $cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align']; |
|
1087 | + $cssClass['text-align'] = $this->_cssStyles['.'.$cell->getDataType()]['text-align']; |
|
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | // Hyperlink? |
1093 | - if ($pSheet->hyperlinkExists($coordinate) && !$pSheet->getHyperlink($coordinate)->isInternal()) { |
|
1094 | - $cellData = '<a href="' . htmlspecialchars($pSheet->getHyperlink($coordinate)->getUrl()) . '" title="' . htmlspecialchars($pSheet->getHyperlink($coordinate)->getTooltip()) . '">' . $cellData . '</a>'; |
|
1093 | + if ($pSheet->hyperlinkExists($coordinate) && ! $pSheet->getHyperlink($coordinate)->isInternal()) { |
|
1094 | + $cellData = '<a href="'.htmlspecialchars($pSheet->getHyperlink($coordinate)->getUrl()).'" title="'.htmlspecialchars($pSheet->getHyperlink($coordinate)->getTooltip()).'">'.$cellData.'</a>'; |
|
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | // Should the cell be written or is it swallowed by a rowspan or colspan? |
1098 | - $writeCell = ! ( isset($this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]) |
|
1099 | - && $this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum] ); |
|
1098 | + $writeCell = ! (isset($this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]) |
|
1099 | + && $this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]); |
|
1100 | 1100 | |
1101 | 1101 | // Colspan and Rowspan |
1102 | 1102 | $colspan = 1; |
@@ -1111,8 +1111,8 @@ discard block |
||
1111 | 1111 | if ($writeCell) { |
1112 | 1112 | // Column start |
1113 | 1113 | $html .= ' <td'; |
1114 | - if (!$this->_useInlineCss) { |
|
1115 | - $html .= ' class="' . $cssClass . '"'; |
|
1114 | + if ( ! $this->_useInlineCss) { |
|
1115 | + $html .= ' class="'.$cssClass.'"'; |
|
1116 | 1116 | } else { |
1117 | 1117 | //** Necessary redundant code for the sake of PHPExcel_Writer_PDF ** |
1118 | 1118 | // We must explicitly write the width of the <td> element because TCPDF |
@@ -1120,28 +1120,28 @@ discard block |
||
1120 | 1120 | $width = 0; |
1121 | 1121 | $i = $colNum - 1; |
1122 | 1122 | $e = $colNum + $colSpan - 1; |
1123 | - while($i++ < $e) { |
|
1123 | + while ($i++ < $e) { |
|
1124 | 1124 | if (isset($this->_columnWidths[$sheetIndex][$i])) { |
1125 | 1125 | $width += $this->_columnWidths[$sheetIndex][$i]; |
1126 | 1126 | } |
1127 | 1127 | } |
1128 | - $cssClass['width'] = $width . 'pt'; |
|
1128 | + $cssClass['width'] = $width.'pt'; |
|
1129 | 1129 | |
1130 | 1130 | // We must also explicitly write the height of the <td> element because TCPDF |
1131 | 1131 | // does not recognize e.g. <tr style="height:50pt"> |
1132 | - if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) { |
|
1133 | - $height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height']; |
|
1132 | + if (isset($this->_cssStyles['table.sheet'.$sheetIndex.' tr.row'.$pRow]['height'])) { |
|
1133 | + $height = $this->_cssStyles['table.sheet'.$sheetIndex.' tr.row'.$pRow]['height']; |
|
1134 | 1134 | $cssClass['height'] = $height; |
1135 | 1135 | } |
1136 | 1136 | //** end of redundant code ** |
1137 | 1137 | |
1138 | - $html .= ' style="' . $this->_assembleCSS($cssClass) . '"'; |
|
1138 | + $html .= ' style="'.$this->_assembleCSS($cssClass).'"'; |
|
1139 | 1139 | } |
1140 | 1140 | if ($colSpan > 1) { |
1141 | - $html .= ' colspan="' . $colSpan . '"'; |
|
1141 | + $html .= ' colspan="'.$colSpan.'"'; |
|
1142 | 1142 | } |
1143 | 1143 | if ($rowSpan > 1) { |
1144 | - $html .= ' rowspan="' . $rowSpan . '"'; |
|
1144 | + $html .= ' rowspan="'.$rowSpan.'"'; |
|
1145 | 1145 | } |
1146 | 1146 | $html .= '>'; |
1147 | 1147 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | $html .= $cellData; |
1153 | 1153 | |
1154 | 1154 | // Column end |
1155 | - $html .= '</td>' . PHP_EOL; |
|
1155 | + $html .= '</td>'.PHP_EOL; |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | // Next column |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | // Write row end |
1163 | - $html .= ' </tr>' . PHP_EOL; |
|
1163 | + $html .= ' </tr>'.PHP_EOL; |
|
1164 | 1164 | |
1165 | 1165 | // Return |
1166 | 1166 | return $html; |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | { |
1180 | 1180 | $pairs = array(); |
1181 | 1181 | foreach ($pValue as $property => $value) { |
1182 | - $pairs[] = $property . ':' . $value; |
|
1182 | + $pairs[] = $property.':'.$value; |
|
1183 | 1183 | } |
1184 | 1184 | $string = implode('; ', $pairs); |
1185 | 1185 | |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | |
1272 | 1272 | // color span tag |
1273 | 1273 | if ($color !== null) { |
1274 | - $value = '<span style="color:' . $color . '">' . $value . '</span>'; |
|
1274 | + $value = '<span style="color:'.$color.'">'.$value.'</span>'; |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | return $value; |
@@ -1291,11 +1291,11 @@ discard block |
||
1291 | 1291 | foreach ($sheetIndexes as $sheetIndex) { |
1292 | 1292 | $sheet = $this->_phpExcel->getSheet($sheetIndex); |
1293 | 1293 | |
1294 | - $candidateSpannedRow = array(); |
|
1294 | + $candidateSpannedRow = array(); |
|
1295 | 1295 | |
1296 | 1296 | // loop through all Excel merged cells |
1297 | 1297 | foreach ($sheet->getMergeCells() as $cells) { |
1298 | - list($cells, ) = PHPExcel_Cell::splitRange($cells); |
|
1298 | + list($cells,) = PHPExcel_Cell::splitRange($cells); |
|
1299 | 1299 | $first = $cells[0]; |
1300 | 1300 | $last = $cells[1]; |
1301 | 1301 | |
@@ -1307,13 +1307,13 @@ discard block |
||
1307 | 1307 | |
1308 | 1308 | // loop through the individual cells in the individual merge |
1309 | 1309 | $r = $fr - 1; |
1310 | - while($r++ < $lr) { |
|
1310 | + while ($r++ < $lr) { |
|
1311 | 1311 | // also, flag this row as a HTML row that is candidate to be omitted |
1312 | 1312 | $candidateSpannedRow[$r] = $r; |
1313 | 1313 | |
1314 | 1314 | $c = $fc - 1; |
1315 | - while($c++ < $lc) { |
|
1316 | - if ( !($c == $fc && $r == $fr) ) { |
|
1315 | + while ($c++ < $lc) { |
|
1316 | + if ( ! ($c == $fc && $r == $fr)) { |
|
1317 | 1317 | // not the upper-left cell (should not be written in HTML) |
1318 | 1318 | $this->_isSpannedCell[$sheetIndex][$r][$c] = array( |
1319 | 1319 | 'baseCell' => array($fr, $fc), |
@@ -1343,17 +1343,17 @@ discard block |
||
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | // For each of the omitted rows we found above, the affected rowspans should be subtracted by 1 |
1346 | - if ( isset($this->_isSpannedRow[$sheetIndex]) ) { |
|
1346 | + if (isset($this->_isSpannedRow[$sheetIndex])) { |
|
1347 | 1347 | foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) { |
1348 | 1348 | $adjustedBaseCells = array(); |
1349 | 1349 | $c = -1; |
1350 | 1350 | $e = $countColumns - 1; |
1351 | - while($c++ < $e) { |
|
1351 | + while ($c++ < $e) { |
|
1352 | 1352 | $baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell']; |
1353 | 1353 | |
1354 | - if ( !in_array($baseCell, $adjustedBaseCells) ) { |
|
1354 | + if ( ! in_array($baseCell, $adjustedBaseCells)) { |
|
1355 | 1355 | // subtract rowspan by 1 |
1356 | - --$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan']; |
|
1356 | + --$this->_isBaseCell[$sheetIndex][$baseCell[0]][$baseCell[1]]['rowspan']; |
|
1357 | 1357 | $adjustedBaseCells[] = $baseCell; |
1358 | 1358 | } |
1359 | 1359 | } |
@@ -315,25 +315,34 @@ |
||
315 | 315 | $html .= '<html>' . PHP_EOL; |
316 | 316 | $html .= ' <head>' . PHP_EOL; |
317 | 317 | $html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL; |
318 | - if ($properties->getTitle() > '') |
|
319 | - $html .= ' <title>' . htmlspecialchars($properties->getTitle()) . '</title>' . PHP_EOL; |
|
320 | - |
|
321 | - if ($properties->getCreator() > '') |
|
322 | - $html .= ' <meta name="author" content="' . htmlspecialchars($properties->getCreator()) . '" />' . PHP_EOL; |
|
323 | - if ($properties->getTitle() > '') |
|
324 | - $html .= ' <meta name="title" content="' . htmlspecialchars($properties->getTitle()) . '" />' . PHP_EOL; |
|
325 | - if ($properties->getDescription() > '') |
|
326 | - $html .= ' <meta name="description" content="' . htmlspecialchars($properties->getDescription()) . '" />' . PHP_EOL; |
|
327 | - if ($properties->getSubject() > '') |
|
328 | - $html .= ' <meta name="subject" content="' . htmlspecialchars($properties->getSubject()) . '" />' . PHP_EOL; |
|
329 | - if ($properties->getKeywords() > '') |
|
330 | - $html .= ' <meta name="keywords" content="' . htmlspecialchars($properties->getKeywords()) . '" />' . PHP_EOL; |
|
331 | - if ($properties->getCategory() > '') |
|
332 | - $html .= ' <meta name="category" content="' . htmlspecialchars($properties->getCategory()) . '" />' . PHP_EOL; |
|
333 | - if ($properties->getCompany() > '') |
|
334 | - $html .= ' <meta name="company" content="' . htmlspecialchars($properties->getCompany()) . '" />' . PHP_EOL; |
|
335 | - if ($properties->getManager() > '') |
|
336 | - $html .= ' <meta name="manager" content="' . htmlspecialchars($properties->getManager()) . '" />' . PHP_EOL; |
|
318 | + if ($properties->getTitle() > '') { |
|
319 | + $html .= ' <title>' . htmlspecialchars($properties->getTitle()) . '</title>' . PHP_EOL; |
|
320 | + } |
|
321 | + |
|
322 | + if ($properties->getCreator() > '') { |
|
323 | + $html .= ' <meta name="author" content="' . htmlspecialchars($properties->getCreator()) . '" />' . PHP_EOL; |
|
324 | + } |
|
325 | + if ($properties->getTitle() > '') { |
|
326 | + $html .= ' <meta name="title" content="' . htmlspecialchars($properties->getTitle()) . '" />' . PHP_EOL; |
|
327 | + } |
|
328 | + if ($properties->getDescription() > '') { |
|
329 | + $html .= ' <meta name="description" content="' . htmlspecialchars($properties->getDescription()) . '" />' . PHP_EOL; |
|
330 | + } |
|
331 | + if ($properties->getSubject() > '') { |
|
332 | + $html .= ' <meta name="subject" content="' . htmlspecialchars($properties->getSubject()) . '" />' . PHP_EOL; |
|
333 | + } |
|
334 | + if ($properties->getKeywords() > '') { |
|
335 | + $html .= ' <meta name="keywords" content="' . htmlspecialchars($properties->getKeywords()) . '" />' . PHP_EOL; |
|
336 | + } |
|
337 | + if ($properties->getCategory() > '') { |
|
338 | + $html .= ' <meta name="category" content="' . htmlspecialchars($properties->getCategory()) . '" />' . PHP_EOL; |
|
339 | + } |
|
340 | + if ($properties->getCompany() > '') { |
|
341 | + $html .= ' <meta name="company" content="' . htmlspecialchars($properties->getCompany()) . '" />' . PHP_EOL; |
|
342 | + } |
|
343 | + if ($properties->getManager() > '') { |
|
344 | + $html .= ' <meta name="manager" content="' . htmlspecialchars($properties->getManager()) . '" />' . PHP_EOL; |
|
345 | + } |
|
337 | 346 | |
338 | 347 | if ($pIncludeStyles) { |
339 | 348 | $html .= $this->generateStyles(true); |