@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | if (is_writable($filename)) { |
| 166 | 166 | @unlink($filename); //if the zip already exists, remove it |
| 167 | 167 | } else { |
| 168 | - throw new XlsxException('Error in '.__CLASS__.'::'.__FUNCTION__.', file is not writeable.'); |
|
| 168 | + throw new XlsxException('Error in ' . __CLASS__ . '::' . __FUNCTION__ . ', file is not writeable.'); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | $zip = new \ZipArchive(); |
| 172 | 172 | if (empty($this->sheets)) { |
| 173 | - throw new XlsxException('Error in '.__CLASS__.'::'.__FUNCTION__.', no worksheets defined.'); |
|
| 173 | + throw new XlsxException('Error in ' . __CLASS__ . '::' . __FUNCTION__ . ', no worksheets defined.'); |
|
| 174 | 174 | } |
| 175 | 175 | if (!$zip->open($filename, \ZipArchive::CREATE)) { |
| 176 | - throw new XlsxException('Error in '.__CLASS__.'::'.__FUNCTION__.', unable to create zip.'); |
|
| 176 | + throw new XlsxException('Error in ' . __CLASS__ . '::' . __FUNCTION__ . ', unable to create zip.'); |
|
| 177 | 177 | } |
| 178 | 178 | $zip->addEmptyDir('docProps/'); |
| 179 | 179 | $zip->addFromString('docProps/app.xml', XlsxBuilder::buildAppXML($this->company)); |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | $zip->addFromString('_rels/.rels', XlsxBuilder::buildRelationshipsXML()); |
| 189 | 189 | $zip->addEmptyDir('xl/worksheets/'); |
| 190 | 190 | foreach ($this->sheets as $sheet) { |
| 191 | - $zip->addFile($sheet->filename, 'xl/worksheets/'.$sheet->xmlname); |
|
| 191 | + $zip->addFile($sheet->filename, 'xl/worksheets/' . $sheet->xmlname); |
|
| 192 | 192 | } |
| 193 | 193 | $zip->addFromString('xl/workbook.xml', XlsxBuilder::buildWorkbookXML($this->sheets)); |
| 194 | - $zip->addFile($this->writeStylesXML(), 'xl/styles.xml'); //$zip->addFromString("xl/styles.xml", self::buildStylesXML() ); |
|
| 194 | + $zip->addFile($this->writeStylesXML(), 'xl/styles.xml'); //$zip->addFromString("xl/styles.xml", self::buildStylesXML() ); |
|
| 195 | 195 | $zip->addFromString('[Content_Types].xml', XlsxBuilder::buildContentTypesXML($this->sheets)); |
| 196 | 196 | $zip->addEmptyDir('xl/_rels/'); |
| 197 | 197 | $zip->addFromString('xl/_rels/workbook.xml.rels', XlsxBuilder::buildWorkbookRelsXML($this->sheets)); |
@@ -213,22 +213,22 @@ discard block |
||
| 213 | 213 | $sheet = $this->getSheet($sheetName); |
| 214 | 214 | if (count($sheet->columns) < count($row)) { |
| 215 | 215 | $defaultColumnTypes = $this->initColumnsTypes(array_fill($from = 0, count($row), 'GENERAL')); //will map to n_auto |
| 216 | - $sheet->columns = array_merge((array) $sheet->columns, $defaultColumnTypes); |
|
| 216 | + $sheet->columns = array_merge((array)$sheet->columns, $defaultColumnTypes); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (!empty($rowOptions)) { |
| 220 | 220 | $ht = isset($rowOptions['height']) ? floatval($rowOptions['height']) : 12.1; |
| 221 | 221 | $customHt = isset($rowOptions['height']) ? true : false; |
| 222 | - $hidden = isset($rowOptions['hidden']) ? (bool) ($rowOptions['hidden']) : false; |
|
| 223 | - $collapsed = isset($rowOptions['collapsed']) ? (bool) ($rowOptions['collapsed']) : false; |
|
| 222 | + $hidden = isset($rowOptions['hidden']) ? (bool)($rowOptions['hidden']) : false; |
|
| 223 | + $collapsed = isset($rowOptions['collapsed']) ? (bool)($rowOptions['collapsed']) : false; |
|
| 224 | 224 | $sheet->fileWriter->write( |
| 225 | - '<row collapsed="'.($collapsed).'" customFormat="false" customHeight="'.($customHt). |
|
| 226 | - '" hidden="'.($hidden).'" ht="'.($ht).'" outlineLevel="0" r="'.($sheet->rowCount + 1).'">' |
|
| 225 | + '<row collapsed="' . ($collapsed) . '" customFormat="false" customHeight="' . ($customHt) . |
|
| 226 | + '" hidden="' . ($hidden) . '" ht="' . ($ht) . '" outlineLevel="0" r="' . ($sheet->rowCount + 1) . '">' |
|
| 227 | 227 | ); |
| 228 | 228 | } else { |
| 229 | 229 | $sheet->fileWriter->write( |
| 230 | - '<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="'. |
|
| 231 | - ($sheet->rowCount + 1).'">' |
|
| 230 | + '<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="' . |
|
| 231 | + ($sheet->rowCount + 1) . '">' |
|
| 232 | 232 | ); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -237,8 +237,7 @@ discard block |
||
| 237 | 237 | foreach ($row as $v) { |
| 238 | 238 | $numberFormat = $sheet->columns[$c]['number_format']; |
| 239 | 239 | $numberFormatType = $sheet->columns[$c]['number_format_type']; |
| 240 | - $cellStyleIdx = empty($style) ? $sheet->columns[$c]['default_cell_style'] : |
|
| 241 | - $this->addCellStyle($numberFormat, json_encode(isset($style[0]) ? $style[$c] : $style)); |
|
| 240 | + $cellStyleIdx = empty($style) ? $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle($numberFormat, json_encode(isset($style[0]) ? $style[$c] : $style)); |
|
| 242 | 241 | $sheet->writeCell($sheet->rowCount, $c, $v, $numberFormatType, $cellStyleIdx); |
| 243 | 242 | ++$c; |
| 244 | 243 | } |
@@ -274,14 +273,14 @@ discard block |
||
| 274 | 273 | |
| 275 | 274 | $temporaryFilename = $this->tempFilename(); |
| 276 | 275 | $file = new XlsxWriterBuffer($temporaryFilename); |
| 277 | - $file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"); |
|
| 276 | + $file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"); |
|
| 278 | 277 | $file->write('<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">'); |
| 279 | - $file->write('<numFmts count="'.count($this->numberFormats).'">'); |
|
| 278 | + $file->write('<numFmts count="' . count($this->numberFormats) . '">'); |
|
| 280 | 279 | foreach ($this->numberFormats as $i => $v) { |
| 281 | - $file->write('<numFmt numFmtId="'.(164 + $i).'" formatCode="'.Support::xmlSpecialChars($v).'" />'); |
|
| 280 | + $file->write('<numFmt numFmtId="' . (164 + $i) . '" formatCode="' . Support::xmlSpecialChars($v) . '" />'); |
|
| 282 | 281 | } |
| 283 | 282 | $file->write('</numFmts>'); |
| 284 | - $file->write('<fonts count="'.(count($fonts)).'">'); |
|
| 283 | + $file->write('<fonts count="' . (count($fonts)) . '">'); |
|
| 285 | 284 | $file->write('<font><name val="Arial"/><charset val="1"/><family val="2"/><sz val="10"/></font>'); |
| 286 | 285 | $file->write('<font><name val="Arial"/><family val="0"/><sz val="10"/></font>'); |
| 287 | 286 | $file->write('<font><name val="Arial"/><family val="0"/><sz val="10"/></font>'); |
@@ -291,10 +290,10 @@ discard block |
||
| 291 | 290 | if (!empty($font)) { //fonts have 4 empty placeholders in array to offset the 4 static xml entries above |
| 292 | 291 | $f = json_decode($font, true); |
| 293 | 292 | $file->write('<font>'); |
| 294 | - $file->write('<name val="'.htmlspecialchars($f['name']).'"/><charset val="1"/><family val="'.intval($f['family']).'"/>'); |
|
| 295 | - $file->write('<sz val="'.intval($f['size']).'"/>'); |
|
| 293 | + $file->write('<name val="' . htmlspecialchars($f['name']) . '"/><charset val="1"/><family val="' . intval($f['family']) . '"/>'); |
|
| 294 | + $file->write('<sz val="' . intval($f['size']) . '"/>'); |
|
| 296 | 295 | if (!empty($f['color'])) { |
| 297 | - $file->write('<color rgb="'.strval($f['color']).'"/>'); |
|
| 296 | + $file->write('<color rgb="' . strval($f['color']) . '"/>'); |
|
| 298 | 297 | } |
| 299 | 298 | if (!empty($f['bold'])) { |
| 300 | 299 | $file->write('<b val="true"/>'); |
@@ -313,23 +312,23 @@ discard block |
||
| 313 | 312 | } |
| 314 | 313 | $file->write('</fonts>'); |
| 315 | 314 | |
| 316 | - $file->write('<fills count="'.(count($fills)).'">'); |
|
| 315 | + $file->write('<fills count="' . (count($fills)) . '">'); |
|
| 317 | 316 | $file->write('<fill><patternFill patternType="none"/></fill>'); |
| 318 | 317 | $file->write('<fill><patternFill patternType="gray125"/></fill>'); |
| 319 | 318 | foreach ($fills as $fill) { |
| 320 | 319 | if (!empty($fill)) { //fills have 2 empty placeholders in array to offset the 2 static xml entries above |
| 321 | - $file->write('<fill><patternFill patternType="solid"><fgColor rgb="'.strval($fill).'"/><bgColor indexed="64"/></patternFill></fill>'); |
|
| 320 | + $file->write('<fill><patternFill patternType="solid"><fgColor rgb="' . strval($fill) . '"/><bgColor indexed="64"/></patternFill></fill>'); |
|
| 322 | 321 | } |
| 323 | 322 | } |
| 324 | 323 | $file->write('</fills>'); |
| 325 | 324 | |
| 326 | - $file->write('<borders count="'.(count($borders)).'">'); |
|
| 325 | + $file->write('<borders count="' . (count($borders)) . '">'); |
|
| 327 | 326 | $file->write('<border diagonalDown="false" diagonalUp="false"><left/><right/><top/><bottom/><diagonal/></border>'); |
| 328 | 327 | foreach ($borders as $border) { |
| 329 | 328 | if (!empty($border)) { //fonts have an empty placeholder in the array to offset the static xml entry above |
| 330 | 329 | $pieces = json_decode($border, true); |
| 331 | 330 | $border_style = !empty($pieces['style']) ? $pieces['style'] : 'hair'; |
| 332 | - $border_color = !empty($pieces['color']) ? '<color rgb="'.strval($pieces['color']).'"/>' : ''; |
|
| 331 | + $border_color = !empty($pieces['color']) ? '<color rgb="' . strval($pieces['color']) . '"/>' : ''; |
|
| 333 | 332 | $file->write('<border diagonalDown="false" diagonalUp="false">'); |
| 334 | 333 | foreach (['left', 'right', 'top', 'bottom'] as $side) { |
| 335 | 334 | $show_side = in_array($side, $pieces['side']) ? true : false; |
@@ -367,7 +366,7 @@ discard block |
||
| 367 | 366 | $file->write('<xf applyAlignment="false" applyBorder="false" applyFont="true" applyProtection="false" borderId="0" fillId="0" fontId="1" numFmtId="9"/>'); |
| 368 | 367 | $file->write('</cellStyleXfs>'); |
| 369 | 368 | |
| 370 | - $file->write('<cellXfs count="'.(count($styleIndexes)).'">'); |
|
| 369 | + $file->write('<cellXfs count="' . (count($styleIndexes)) . '">'); |
|
| 371 | 370 | foreach ($styleIndexes as $v) { |
| 372 | 371 | $applyAlignment = isset($v['alignment']) ? 'true' : 'false'; |
| 373 | 372 | $wrapText = !empty($v['wrap_text']) ? 'true' : 'false'; |
@@ -378,8 +377,8 @@ discard block |
||
| 378 | 377 | $borderIdx = isset($v['border_idx']) ? intval($v['border_idx']) : 0; |
| 379 | 378 | $fillIdx = isset($v['fill_idx']) ? intval($v['fill_idx']) : 0; |
| 380 | 379 | $fontIdx = isset($v['font_idx']) ? intval($v['font_idx']) : 0; |
| 381 | - $file->write('<xf applyAlignment="'.$applyAlignment.'" applyBorder="'.$applyBorder.'" applyFont="'.$applyFont.'" applyProtection="false" borderId="'.($borderIdx).'" fillId="'.($fillIdx).'" fontId="'.($fontIdx).'" numFmtId="'.(164 + $v['num_fmt_idx']).'" xfId="0">'); |
|
| 382 | - $file->write(' <alignment horizontal="'.$horizAlignment.'" vertical="'.$vertAlignment.'" textRotation="0" wrapText="'.$wrapText.'" indent="0" shrinkToFit="false"/>'); |
|
| 380 | + $file->write('<xf applyAlignment="' . $applyAlignment . '" applyBorder="' . $applyBorder . '" applyFont="' . $applyFont . '" applyProtection="false" borderId="' . ($borderIdx) . '" fillId="' . ($fillIdx) . '" fontId="' . ($fontIdx) . '" numFmtId="' . (164 + $v['num_fmt_idx']) . '" xfId="0">'); |
|
| 381 | + $file->write(' <alignment horizontal="' . $horizAlignment . '" vertical="' . $vertAlignment . '" textRotation="0" wrapText="' . $wrapText . '" indent="0" shrinkToFit="false"/>'); |
|
| 383 | 382 | $file->write(' <protection locked="true" hidden="false"/>'); |
| 384 | 383 | $file->write('</xf>'); |
| 385 | 384 | } |
@@ -423,7 +422,7 @@ discard block |
||
| 423 | 422 | return; |
| 424 | 423 | } |
| 425 | 424 | $style = $colOptions; |
| 426 | - $colWidths = isset($colOptions['widths']) ? (array) $colOptions['widths'] : []; |
|
| 425 | + $colWidths = isset($colOptions['widths']) ? (array)$colOptions['widths'] : []; |
|
| 427 | 426 | $this->createSheet($sheetName, $colOptions); |
| 428 | 427 | $sheet = $this->getSheet($sheetName); |
| 429 | 428 | $sheet->initContent($colWidths, $this->isTabSelected()); |
@@ -432,12 +431,11 @@ discard block |
||
| 432 | 431 | $headerRow = array_keys($headerTypes); |
| 433 | 432 | $writer = $sheet->getFileWriter(); |
| 434 | 433 | $writer->write( |
| 435 | - '<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="'. 1 .'">' |
|
| 434 | + '<row collapsed="false" customFormat="false" customHeight="false" hidden="false" ht="12.1" outlineLevel="0" r="' . 1 . '">' |
|
| 436 | 435 | ); |
| 437 | 436 | foreach ($headerRow as $c => $v) { |
| 438 | 437 | $cellStyleIdx = empty($style) ? |
| 439 | - $sheet->columns[$c]['default_cell_style'] : |
|
| 440 | - $this->addCellStyle('GENERAL', json_encode(isset($style[0]) ? $style[$c] : $style)); |
|
| 438 | + $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle('GENERAL', json_encode(isset($style[0]) ? $style[$c] : $style)); |
|
| 441 | 439 | $sheet->writeCell(0, $c, $v, 'n_string', $cellStyleIdx); |
| 442 | 440 | } |
| 443 | 441 | $writer->write('</row>'); |
@@ -455,7 +453,7 @@ discard block |
||
| 455 | 453 | $numberFormat = Support::numberFormatStandardized($numFormat); |
| 456 | 454 | $cellStyleIdx = $this->addCellStyle($numberFormat, $styleString = null); |
| 457 | 455 | $columns[] = [ |
| 458 | - 'number_format' => $numberFormat, //contains excel format like 'YYYY-MM-DD HH:MM:SS' |
|
| 456 | + 'number_format' => $numberFormat, //contains excel format like 'YYYY-MM-DD HH:MM:SS' |
|
| 459 | 457 | 'number_format_type' => Support::determineNumberFormatType($numberFormat, 'function' === $v[0]), //contains friendly format like 'datetime' |
| 460 | 458 | 'default_cell_style' => $cellStyleIdx, |
| 461 | 459 | ]; |
@@ -511,7 +509,7 @@ discard block |
||
| 511 | 509 | protected function createSheet(string $sheetName, array $colOptions = []) |
| 512 | 510 | { |
| 513 | 511 | $sheetFilename = $this->tempFilename(); |
| 514 | - $sheetXmlName = 'sheet'.(count($this->sheets) + 1).'.xml'; |
|
| 512 | + $sheetXmlName = 'sheet' . (count($this->sheets) + 1) . '.xml'; |
|
| 515 | 513 | $autoFilter = isset($colOptions['auto_filter']) ? intval($colOptions['auto_filter']) : false; |
| 516 | 514 | $freezeRows = isset($colOptions['freeze_rows']) ? intval($colOptions['freeze_rows']) : false; |
| 517 | 515 | $freezeColumns = isset($colOptions['freeze_columns']) ? intval($colOptions['freeze_columns']) : false; |
@@ -64,39 +64,39 @@ discard block |
||
| 64 | 64 | $file = $this->getFileWriter(); |
| 65 | 65 | |
| 66 | 66 | if (!is_scalar($value) || '' === $value) { //objects, array, empty |
| 67 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'"/>'); |
|
| 67 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '"/>'); |
|
| 68 | 68 | } elseif (is_string($value) && '=' == $value[0]) { |
| 69 | 69 | // Support Formula |
| 70 | 70 | if ('n_function' === $numFormatType) { |
| 71 | - var_dump('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="s"><f>'. |
|
| 71 | + var_dump('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="s"><f>' . |
|
| 72 | 72 | str_replace('{n}', $rowNumber + 1, substr($value, 1)) |
| 73 | 73 | .'</f></c>'); |
| 74 | 74 | |
| 75 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="s"><f>'. |
|
| 75 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="s"><f>' . |
|
| 76 | 76 | str_replace('{n}', $rowNumber + 1, substr($value, 1)) |
| 77 | 77 | .'</f></c>'); |
| 78 | 78 | } else { |
| 79 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="s"><f>'.Support::xmlSpecialChars($value).'</f></c>'); |
|
| 79 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="s"><f>' . Support::xmlSpecialChars($value) . '</f></c>'); |
|
| 80 | 80 | } |
| 81 | 81 | } else { |
| 82 | 82 | switch ($numFormatType) { |
| 83 | 83 | case 'n_date': |
| 84 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 85 | - intval(Support::convertDateTime($value)).'</v></c>'); |
|
| 84 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 85 | + intval(Support::convertDateTime($value)) . '</v></c>'); |
|
| 86 | 86 | |
| 87 | 87 | break; |
| 88 | 88 | case 'n_datetime': |
| 89 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 90 | - Support::convertDateTime($value).'</v></c>'); |
|
| 89 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 90 | + Support::convertDateTime($value) . '</v></c>'); |
|
| 91 | 91 | |
| 92 | 92 | break; |
| 93 | 93 | case 'n_numeric': |
| 94 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 95 | - Support::xmlSpecialChars($value).'</v></c>'); //int,float,currency |
|
| 94 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 95 | + Support::xmlSpecialChars($value) . '</v></c>'); //int,float,currency |
|
| 96 | 96 | break; |
| 97 | 97 | case 'n_string': |
| 98 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="inlineStr"><is><t>'. |
|
| 99 | - Support::xmlSpecialChars($value).'</t></is></c>'); |
|
| 98 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="inlineStr"><is><t>' . |
|
| 99 | + Support::xmlSpecialChars($value) . '</t></is></c>'); |
|
| 100 | 100 | |
| 101 | 101 | break; |
| 102 | 102 | case 'n_auto': |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | if (!is_string($value) || '0' == $value || ('0' != $value[0] && ctype_digit($value)) || preg_match("/^\-?(0|[1-9][0-9]*)(\.[0-9]+)?$/", $value) |
| 105 | 105 | ) { //int,float,currency |
| 106 | 106 | $file->write( |
| 107 | - '<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 108 | - Support::xmlSpecialChars($value).'</v></c>' |
|
| 107 | + '<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 108 | + Support::xmlSpecialChars($value) . '</v></c>' |
|
| 109 | 109 | ); |
| 110 | 110 | } else { //implied: ($cell_format=='string') |
| 111 | 111 | $file->write( |
| 112 | - '<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="inlineStr"><is><t>'. |
|
| 113 | - Support::xmlSpecialChars($value).'</t></is></c>' |
|
| 112 | + '<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="inlineStr"><is><t>' . |
|
| 113 | + Support::xmlSpecialChars($value) . '</t></is></c>' |
|
| 114 | 114 | ); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | $writer = $this->getFileWriter(); |
| 129 | 129 | $tabSelected = $isTabSelected ? 'true' : 'false'; |
| 130 | 130 | $maxCell = Support::xlsCell(Builder::EXCEL_2007_MAX_ROW, Builder::EXCEL_2007_MAX_COL); //XFE1048577 |
| 131 | - $writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"); |
|
| 131 | + $writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"); |
|
| 132 | 132 | $writer->write( |
| 133 | 133 | <<<'EOF' |
| 134 | 134 | <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheetPr filterMode="false"><pageSetUpPr fitToPage="false"/></sheetPr> |
| 135 | 135 | EOF |
| 136 | 136 | ); |
| 137 | 137 | $this->maxCellTagStart = $this->fileWriter->ftell(); |
| 138 | - $writer->write('<dimension ref="A1:'.$maxCell.'"/>'); |
|
| 138 | + $writer->write('<dimension ref="A1:' . $maxCell . '"/>'); |
|
| 139 | 139 | $this->maxCellTagEnd = $this->fileWriter->ftell(); |
| 140 | 140 | $writer->write('<sheetViews>'); |
| 141 | 141 | $writer->write( |
@@ -157,15 +157,15 @@ discard block |
||
| 157 | 157 | if (!empty($colWidths)) { |
| 158 | 158 | foreach ($colWidths as $colWidth) { |
| 159 | 159 | $writer->write( |
| 160 | - '<col collapsed="false" hidden="false" max="'.($i + 1).'" min="'.($i + 1). |
|
| 161 | - '" style="0" customWidth="true" width="'.floatval($colWidth).'"/>' |
|
| 160 | + '<col collapsed="false" hidden="false" max="' . ($i + 1) . '" min="' . ($i + 1) . |
|
| 161 | + '" style="0" customWidth="true" width="' . floatval($colWidth) . '"/>' |
|
| 162 | 162 | ); |
| 163 | 163 | ++$i; |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | $writer->write( |
| 167 | - '<col collapsed="false" hidden="false" max="1024" min="'.($i + 1). |
|
| 168 | - '" style="0" customWidth="false" width="11.5"/>'.'</cols><sheetData>' |
|
| 167 | + '<col collapsed="false" hidden="false" max="1024" min="' . ($i + 1) . |
|
| 168 | + '" style="0" customWidth="false" width="11.5"/>' . '</cols><sheetData>' |
|
| 169 | 169 | ); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | if (!empty($this->mergeCells)) { |
| 177 | 177 | $this->fileWriter->write('<mergeCells>'); |
| 178 | 178 | foreach ($this->mergeCells as $range) { |
| 179 | - $this->fileWriter->write('<mergeCell ref="'.$range.'"/>'); |
|
| 179 | + $this->fileWriter->write('<mergeCell ref="' . $range . '"/>'); |
|
| 180 | 180 | } |
| 181 | 181 | $this->fileWriter->write('</mergeCells>'); |
| 182 | 182 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $maxCell = Support::xlsCell($this->rowCount - 1, count($this->columns) - 1); |
| 185 | 185 | |
| 186 | 186 | if ($this->autoFilter) { |
| 187 | - $this->fileWriter->write('<autoFilter ref="A1:'.$maxCell.'"/>'); |
|
| 187 | + $this->fileWriter->write('<autoFilter ref="A1:' . $maxCell . '"/>'); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $this->fileWriter->write('<printOptions headings="false" gridLines="false" gridLinesSet="true" horizontalCentered="false" verticalCentered="false"/>'); |
@@ -196,10 +196,10 @@ discard block |
||
| 196 | 196 | $this->fileWriter->write('</headerFooter>'); |
| 197 | 197 | $this->fileWriter->write('</worksheet>'); |
| 198 | 198 | |
| 199 | - $maxCellTag = '<dimension ref="A1:'.$maxCell.'"/>'; |
|
| 199 | + $maxCellTag = '<dimension ref="A1:' . $maxCell . '"/>'; |
|
| 200 | 200 | $paddingLength = $this->maxCellTagEnd - $this->maxCellTagStart - strlen($maxCellTag); |
| 201 | 201 | $this->fileWriter->fseek($this->maxCellTagStart); |
| 202 | - $this->fileWriter->write($maxCellTag.str_repeat(' ', $paddingLength)); |
|
| 202 | + $this->fileWriter->write($maxCellTag . str_repeat(' ', $paddingLength)); |
|
| 203 | 203 | $this->fileWriter->close(); |
| 204 | 204 | $this->finalized = true; |
| 205 | 205 | } |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | $writer = $this->getFileWriter(); |
| 210 | 210 | $writer->write( |
| 211 | - '<pane ySplit="'.$this->freezeRows.'" xSplit="'.$this->freezeColumns. |
|
| 212 | - '" topLeftCell="'.Support::xlsCell($this->freezeRows, $this->freezeColumns). |
|
| 213 | - '" activePane="bottomRight" state="frozen"/>'.'<selection activeCell="'.Support::xlsCell($this->freezeRows, 0). |
|
| 214 | - '" activeCellId="0" pane="topRight" sqref="'.Support::xlsCell($this->freezeRows, 0).'"/>'. |
|
| 215 | - '<selection activeCell="'.Support::xlsCell(0, $this->freezeColumns). |
|
| 216 | - '" activeCellId="0" pane="bottomLeft" sqref="'.Support::xlsCell(0, $this->freezeColumns).'"/>'. |
|
| 217 | - '<selection activeCell="'.Support::xlsCell($this->freezeRows, $this->freezeColumns). |
|
| 218 | - '" activeCellId="0" pane="bottomRight" sqref="'.Support::xlsCell($this->freezeRows, $this->freezeColumns).'"/>' |
|
| 211 | + '<pane ySplit="' . $this->freezeRows . '" xSplit="' . $this->freezeColumns . |
|
| 212 | + '" topLeftCell="' . Support::xlsCell($this->freezeRows, $this->freezeColumns) . |
|
| 213 | + '" activePane="bottomRight" state="frozen"/>' . '<selection activeCell="' . Support::xlsCell($this->freezeRows, 0) . |
|
| 214 | + '" activeCellId="0" pane="topRight" sqref="' . Support::xlsCell($this->freezeRows, 0) . '"/>' . |
|
| 215 | + '<selection activeCell="' . Support::xlsCell(0, $this->freezeColumns) . |
|
| 216 | + '" activeCellId="0" pane="bottomLeft" sqref="' . Support::xlsCell(0, $this->freezeColumns) . '"/>' . |
|
| 217 | + '<selection activeCell="' . Support::xlsCell($this->freezeRows, $this->freezeColumns) . |
|
| 218 | + '" activeCellId="0" pane="bottomRight" sqref="' . Support::xlsCell($this->freezeRows, $this->freezeColumns) . '"/>' |
|
| 219 | 219 | ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | { |
| 224 | 224 | $writer = $this->getFileWriter(); |
| 225 | 225 | $writer->write( |
| 226 | - '<pane ySplit="'.$this->freezeRows.'" topLeftCell="'. |
|
| 227 | - Support::xlsCell($this->freezeRows, 0).'" activePane="bottomLeft" state="frozen"/>'. |
|
| 228 | - '<selection activeCell="'.Support::xlsCell($this->freezeRows, 0). |
|
| 229 | - '" activeCellId="0" pane="bottomLeft" sqref="'.Support::xlsCell($this->freezeRows, 0).'"/>' |
|
| 226 | + '<pane ySplit="' . $this->freezeRows . '" topLeftCell="' . |
|
| 227 | + Support::xlsCell($this->freezeRows, 0) . '" activePane="bottomLeft" state="frozen"/>' . |
|
| 228 | + '<selection activeCell="' . Support::xlsCell($this->freezeRows, 0) . |
|
| 229 | + '" activeCellId="0" pane="bottomLeft" sqref="' . Support::xlsCell($this->freezeRows, 0) . '"/>' |
|
| 230 | 230 | ); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $writer = $this->getFileWriter(); |
| 236 | 236 | $writer->write( |
| 237 | - '<pane xSplit="'.$this->freezeColumns.'" topLeftCell="'. |
|
| 238 | - Support::xlsCell(0, $this->freezeColumns).'" activePane="topRight" state="frozen"/>'. |
|
| 239 | - '<selection activeCell="'.Support::xlsCell(0, $this->freezeColumns). |
|
| 240 | - '" activeCellId="0" pane="topRight" sqref="'.Support::xlsCell(0, $this->freezeColumns).'"/>' |
|
| 237 | + '<pane xSplit="' . $this->freezeColumns . '" topLeftCell="' . |
|
| 238 | + Support::xlsCell(0, $this->freezeColumns) . '" activePane="topRight" state="frozen"/>' . |
|
| 239 | + '<selection activeCell="' . Support::xlsCell(0, $this->freezeColumns) . |
|
| 240 | + '" activeCellId="0" pane="topRight" sqref="' . Support::xlsCell(0, $this->freezeColumns) . '"/>' |
|
| 241 | 241 | ); |
| 242 | 242 | } |
| 243 | 243 | |