@@ -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>'); |
@@ -453,7 +451,7 @@ discard block |
||
| 453 | 451 | $numberFormat = Support::numberFormatStandardized($v); |
| 454 | 452 | $cellStyleIdx = $this->addCellStyle($numberFormat, $styleString = null); |
| 455 | 453 | $columns[] = [ |
| 456 | - 'number_format' => $numberFormat, //contains excel format like 'YYYY-MM-DD HH:MM:SS' |
|
| 454 | + 'number_format' => $numberFormat, //contains excel format like 'YYYY-MM-DD HH:MM:SS' |
|
| 457 | 455 | 'number_format_type' => Support::determineNumberFormatType($numberFormat), //contains friendly format like 'datetime' |
| 458 | 456 | 'default_cell_style' => $cellStyleIdx, |
| 459 | 457 | ]; |
@@ -509,7 +507,7 @@ discard block |
||
| 509 | 507 | protected function createSheet(string $sheetName, array $colOptions = []) |
| 510 | 508 | { |
| 511 | 509 | $sheetFilename = $this->tempFilename(); |
| 512 | - $sheetXmlName = 'sheet'.(count($this->sheets) + 1).'.xml'; |
|
| 510 | + $sheetXmlName = 'sheet' . (count($this->sheets) + 1) . '.xml'; |
|
| 513 | 511 | $autoFilter = isset($colOptions['auto_filter']) ? intval($colOptions['auto_filter']) : false; |
| 514 | 512 | $freezeRows = isset($colOptions['freeze_rows']) ? intval($colOptions['freeze_rows']) : false; |
| 515 | 513 | $freezeColumns = isset($colOptions['freeze_columns']) ? intval($colOptions['freeze_columns']) : false; |
@@ -64,31 +64,31 @@ 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 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="s"><f>'. |
|
| 70 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="s"><f>' . |
|
| 71 | 71 | str_replace('{n}', $rowNumber + 1, substr(Support::xmlSpecialChars($value), 1)) |
| 72 | 72 | .'</f></c>'); |
| 73 | 73 | } else { |
| 74 | 74 | switch ($numFormatType) { |
| 75 | 75 | case 'n_date': |
| 76 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 77 | - intval(Support::convertDateTime($value)).'</v></c>'); |
|
| 76 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 77 | + intval(Support::convertDateTime($value)) . '</v></c>'); |
|
| 78 | 78 | |
| 79 | 79 | break; |
| 80 | 80 | case 'n_datetime': |
| 81 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 82 | - Support::convertDateTime($value).'</v></c>'); |
|
| 81 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 82 | + Support::convertDateTime($value) . '</v></c>'); |
|
| 83 | 83 | |
| 84 | 84 | break; |
| 85 | 85 | case 'n_numeric': |
| 86 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 87 | - Support::xmlSpecialChars($value).'</v></c>'); //int,float,currency |
|
| 86 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 87 | + Support::xmlSpecialChars($value) . '</v></c>'); //int,float,currency |
|
| 88 | 88 | break; |
| 89 | 89 | case 'n_string': |
| 90 | - $file->write('<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="inlineStr"><is><t>'. |
|
| 91 | - Support::xmlSpecialChars($value).'</t></is></c>'); |
|
| 90 | + $file->write('<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="inlineStr"><is><t>' . |
|
| 91 | + Support::xmlSpecialChars($value) . '</t></is></c>'); |
|
| 92 | 92 | |
| 93 | 93 | break; |
| 94 | 94 | case 'n_auto': |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | if (!is_string($value) || '0' == $value || ('0' != $value[0] && ctype_digit($value)) || preg_match("/^\-?(0|[1-9][0-9]*)(\.[0-9]+)?$/", $value) |
| 97 | 97 | ) { //int,float,currency |
| 98 | 98 | $file->write( |
| 99 | - '<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="n"><v>'. |
|
| 100 | - Support::xmlSpecialChars($value).'</v></c>' |
|
| 99 | + '<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="n"><v>' . |
|
| 100 | + Support::xmlSpecialChars($value) . '</v></c>' |
|
| 101 | 101 | ); |
| 102 | 102 | } else { //implied: ($cell_format=='string') |
| 103 | 103 | $file->write( |
| 104 | - '<c r="'.$cellName.'" s="'.$cellStyleIdx.'" t="inlineStr"><is><t>'. |
|
| 105 | - Support::xmlSpecialChars($value).'</t></is></c>' |
|
| 104 | + '<c r="' . $cellName . '" s="' . $cellStyleIdx . '" t="inlineStr"><is><t>' . |
|
| 105 | + Support::xmlSpecialChars($value) . '</t></is></c>' |
|
| 106 | 106 | ); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | $writer = $this->getFileWriter(); |
| 121 | 121 | $tabSelected = $isTabSelected ? 'true' : 'false'; |
| 122 | 122 | $maxCell = Support::xlsCell(Builder::EXCEL_2007_MAX_ROW, Builder::EXCEL_2007_MAX_COL); //XFE1048577 |
| 123 | - $writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"); |
|
| 123 | + $writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"); |
|
| 124 | 124 | $writer->write( |
| 125 | 125 | <<<'EOF' |
| 126 | 126 | <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> |
| 127 | 127 | EOF |
| 128 | 128 | ); |
| 129 | 129 | $this->maxCellTagStart = $this->fileWriter->ftell(); |
| 130 | - $writer->write('<dimension ref="A1:'.$maxCell.'"/>'); |
|
| 130 | + $writer->write('<dimension ref="A1:' . $maxCell . '"/>'); |
|
| 131 | 131 | $this->maxCellTagEnd = $this->fileWriter->ftell(); |
| 132 | 132 | $writer->write('<sheetViews>'); |
| 133 | 133 | $writer->write( |
@@ -149,15 +149,15 @@ discard block |
||
| 149 | 149 | if (!empty($colWidths)) { |
| 150 | 150 | foreach ($colWidths as $colWidth) { |
| 151 | 151 | $writer->write( |
| 152 | - '<col collapsed="false" hidden="false" max="'.($i + 1).'" min="'.($i + 1). |
|
| 153 | - '" style="0" customWidth="true" width="'.floatval($colWidth).'"/>' |
|
| 152 | + '<col collapsed="false" hidden="false" max="' . ($i + 1) . '" min="' . ($i + 1) . |
|
| 153 | + '" style="0" customWidth="true" width="' . floatval($colWidth) . '"/>' |
|
| 154 | 154 | ); |
| 155 | 155 | ++$i; |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | $writer->write( |
| 159 | - '<col collapsed="false" hidden="false" max="1024" min="'.($i + 1). |
|
| 160 | - '" style="0" customWidth="false" width="11.5"/>'.'</cols><sheetData>' |
|
| 159 | + '<col collapsed="false" hidden="false" max="1024" min="' . ($i + 1) . |
|
| 160 | + '" style="0" customWidth="false" width="11.5"/>' . '</cols><sheetData>' |
|
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | if (!empty($this->mergeCells)) { |
| 169 | 169 | $this->fileWriter->write('<mergeCells>'); |
| 170 | 170 | foreach ($this->mergeCells as $range) { |
| 171 | - $this->fileWriter->write('<mergeCell ref="'.$range.'"/>'); |
|
| 171 | + $this->fileWriter->write('<mergeCell ref="' . $range . '"/>'); |
|
| 172 | 172 | } |
| 173 | 173 | $this->fileWriter->write('</mergeCells>'); |
| 174 | 174 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $maxCell = Support::xlsCell($this->rowCount - 1, count($this->columns) - 1); |
| 177 | 177 | |
| 178 | 178 | if ($this->autoFilter) { |
| 179 | - $this->fileWriter->write('<autoFilter ref="A1:'.$maxCell.'"/>'); |
|
| 179 | + $this->fileWriter->write('<autoFilter ref="A1:' . $maxCell . '"/>'); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $this->fileWriter->write('<printOptions headings="false" gridLines="false" gridLinesSet="true" horizontalCentered="false" verticalCentered="false"/>'); |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | $this->fileWriter->write('</headerFooter>'); |
| 189 | 189 | $this->fileWriter->write('</worksheet>'); |
| 190 | 190 | |
| 191 | - $maxCellTag = '<dimension ref="A1:'.$maxCell.'"/>'; |
|
| 191 | + $maxCellTag = '<dimension ref="A1:' . $maxCell . '"/>'; |
|
| 192 | 192 | $paddingLength = $this->maxCellTagEnd - $this->maxCellTagStart - strlen($maxCellTag); |
| 193 | 193 | $this->fileWriter->fseek($this->maxCellTagStart); |
| 194 | - $this->fileWriter->write($maxCellTag.str_repeat(' ', $paddingLength)); |
|
| 194 | + $this->fileWriter->write($maxCellTag . str_repeat(' ', $paddingLength)); |
|
| 195 | 195 | $this->fileWriter->close(); |
| 196 | 196 | $this->finalized = true; |
| 197 | 197 | } |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | { |
| 201 | 201 | $writer = $this->getFileWriter(); |
| 202 | 202 | $writer->write( |
| 203 | - '<pane ySplit="'.$this->freezeRows.'" xSplit="'.$this->freezeColumns. |
|
| 204 | - '" topLeftCell="'.Support::xlsCell($this->freezeRows, $this->freezeColumns). |
|
| 205 | - '" activePane="bottomRight" state="frozen"/>'.'<selection activeCell="'.Support::xlsCell($this->freezeRows, 0). |
|
| 206 | - '" activeCellId="0" pane="topRight" sqref="'.Support::xlsCell($this->freezeRows, 0).'"/>'. |
|
| 207 | - '<selection activeCell="'.Support::xlsCell(0, $this->freezeColumns). |
|
| 208 | - '" activeCellId="0" pane="bottomLeft" sqref="'.Support::xlsCell(0, $this->freezeColumns).'"/>'. |
|
| 209 | - '<selection activeCell="'.Support::xlsCell($this->freezeRows, $this->freezeColumns). |
|
| 210 | - '" activeCellId="0" pane="bottomRight" sqref="'.Support::xlsCell($this->freezeRows, $this->freezeColumns).'"/>' |
|
| 203 | + '<pane ySplit="' . $this->freezeRows . '" xSplit="' . $this->freezeColumns . |
|
| 204 | + '" topLeftCell="' . Support::xlsCell($this->freezeRows, $this->freezeColumns) . |
|
| 205 | + '" activePane="bottomRight" state="frozen"/>' . '<selection activeCell="' . Support::xlsCell($this->freezeRows, 0) . |
|
| 206 | + '" activeCellId="0" pane="topRight" sqref="' . Support::xlsCell($this->freezeRows, 0) . '"/>' . |
|
| 207 | + '<selection activeCell="' . Support::xlsCell(0, $this->freezeColumns) . |
|
| 208 | + '" activeCellId="0" pane="bottomLeft" sqref="' . Support::xlsCell(0, $this->freezeColumns) . '"/>' . |
|
| 209 | + '<selection activeCell="' . Support::xlsCell($this->freezeRows, $this->freezeColumns) . |
|
| 210 | + '" activeCellId="0" pane="bottomRight" sqref="' . Support::xlsCell($this->freezeRows, $this->freezeColumns) . '"/>' |
|
| 211 | 211 | ); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | $writer = $this->getFileWriter(); |
| 217 | 217 | $writer->write( |
| 218 | - '<pane ySplit="'.$this->freezeRows.'" topLeftCell="'. |
|
| 219 | - Support::xlsCell($this->freezeRows, 0).'" activePane="bottomLeft" state="frozen"/>'. |
|
| 220 | - '<selection activeCell="'.Support::xlsCell($this->freezeRows, 0). |
|
| 221 | - '" activeCellId="0" pane="bottomLeft" sqref="'.Support::xlsCell($this->freezeRows, 0).'"/>' |
|
| 218 | + '<pane ySplit="' . $this->freezeRows . '" topLeftCell="' . |
|
| 219 | + Support::xlsCell($this->freezeRows, 0) . '" activePane="bottomLeft" state="frozen"/>' . |
|
| 220 | + '<selection activeCell="' . Support::xlsCell($this->freezeRows, 0) . |
|
| 221 | + '" activeCellId="0" pane="bottomLeft" sqref="' . Support::xlsCell($this->freezeRows, 0) . '"/>' |
|
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | $writer = $this->getFileWriter(); |
| 228 | 228 | $writer->write( |
| 229 | - '<pane xSplit="'.$this->freezeColumns.'" topLeftCell="'. |
|
| 230 | - Support::xlsCell(0, $this->freezeColumns).'" activePane="topRight" state="frozen"/>'. |
|
| 231 | - '<selection activeCell="'.Support::xlsCell(0, $this->freezeColumns). |
|
| 232 | - '" activeCellId="0" pane="topRight" sqref="'.Support::xlsCell(0, $this->freezeColumns).'"/>' |
|
| 229 | + '<pane xSplit="' . $this->freezeColumns . '" topLeftCell="' . |
|
| 230 | + Support::xlsCell(0, $this->freezeColumns) . '" activePane="topRight" state="frozen"/>' . |
|
| 231 | + '<selection activeCell="' . Support::xlsCell(0, $this->freezeColumns) . |
|
| 232 | + '" activeCellId="0" pane="topRight" sqref="' . Support::xlsCell(0, $this->freezeColumns) . '"/>' |
|
| 233 | 233 | ); |
| 234 | 234 | } |
| 235 | 235 | |