@@ -31,18 +31,18 @@ |
||
31 | 31 | $inputFileName = './sampleData/example1.xls'; |
32 | 32 | $sheetnames = ['Data Sheet #1', 'Data Sheet #3']; |
33 | 33 | |
34 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
34 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
35 | 35 | $reader = IOFactory::createReader($inputFileType); |
36 | -echo 'Loading Sheet',((count($sheetnames) == 1) ? '' : 's'),' "',implode('" and "', $sheetnames),'" only<br />'; |
|
36 | +echo 'Loading Sheet', ((count($sheetnames) == 1) ? '' : 's'), ' "', implode('" and "', $sheetnames), '" only<br />'; |
|
37 | 37 | $reader->setLoadSheetsOnly($sheetnames); |
38 | 38 | $spreadsheet = $reader->load($inputFileName); |
39 | 39 | |
40 | 40 | echo '<hr />'; |
41 | 41 | |
42 | -echo $spreadsheet->getSheetCount(),' worksheet',(($spreadsheet->getSheetCount() == 1) ? '' : 's'),' loaded<br /><br />'; |
|
42 | +echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded<br /><br />'; |
|
43 | 43 | $loadedSheetNames = $spreadsheet->getSheetNames(); |
44 | 44 | foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { |
45 | - echo $sheetIndex,' -> ',$loadedSheetName,'<br />'; |
|
45 | + echo $sheetIndex, ' -> ', $loadedSheetName, '<br />'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | ?> |
@@ -30,7 +30,7 @@ |
||
30 | 30 | // $inputFileType = 'Gnumeric'; |
31 | 31 | $inputFileName = './sampleData/example1.xls'; |
32 | 32 | |
33 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
33 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' information using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
34 | 34 | |
35 | 35 | $reader = IOFactory::createReader($inputFileType); |
36 | 36 | $worksheetNames = $reader->listWorksheetNames($inputFileName); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | // $inputFileType = 'Gnumeric'; |
31 | 31 | $inputFileName = './sampleData/example1.xls'; |
32 | 32 | |
33 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
33 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
34 | 34 | $reader = IOFactory::createReader($inputFileType); |
35 | 35 | echo 'Turning Formatting off for Load<br />'; |
36 | 36 | $reader->setReadDataOnly(true); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | // $inputFileType = 'Gnumeric'; |
31 | 31 | $inputFileName = './sampleData/example1.xls'; |
32 | 32 | |
33 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
33 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
34 | 34 | $reader = IOFactory::createReader($inputFileType); |
35 | 35 | echo 'Loading all WorkSheets<br />'; |
36 | 36 | $reader->setLoadAllSheets(); |
@@ -60,9 +60,9 @@ |
||
60 | 60 | |
61 | 61 | $filterSubset = new MyReadFilter(9, 15, range('G', 'K')); |
62 | 62 | |
63 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
63 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
64 | 64 | $reader = IOFactory::createReader($inputFileType); |
65 | -echo 'Loading Sheet "',$sheetname,'" only<br />'; |
|
65 | +echo 'Loading Sheet "', $sheetname, '" only<br />'; |
|
66 | 66 | $reader->setLoadSheetsOnly($sheetname); |
67 | 67 | echo 'Loading Sheet using configurable filter<br />'; |
68 | 68 | $reader->setReadFilter($filterSubset); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
60 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
61 | 61 | /* Create a new Reader of the type defined in $inputFileType **/ |
62 | 62 | $reader = IOFactory::createReader($inputFileType); |
63 | 63 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | require_once __DIR__ . '/../../../src/Bootstrap.php'; |
26 | 26 | |
27 | 27 | $inputFileName = './sampleData/example_1.xls'; |
28 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format<br />'; |
|
28 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory to identify the format<br />'; |
|
29 | 29 | try { |
30 | 30 | $spreadsheet = IOFactory::load($inputFileName); |
31 | 31 | } catch (InvalidArgumentException $e) { |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | $inputFileName = './sampleData/example1.xls'; |
27 | 27 | |
28 | -echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using \PhpOffice\PhpSpreadsheet\Reader\Xls<br />'; |
|
28 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using \PhpOffice\PhpSpreadsheet\Reader\Xls<br />'; |
|
29 | 29 | $reader = new Xls(); |
30 | 30 | // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); |
31 | 31 | // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); |
@@ -443,22 +443,22 @@ |
||
443 | 443 | $this->processDomElement($child, $sheet, $row, $column, $cellContent); |
444 | 444 | |
445 | 445 | // add color styles (background & text) from dom element,currently support : td & th, using ONLY inline css style with RGB color |
446 | - if (isset($attributeArray['style'])){ |
|
447 | - $styles = explode(';',$attributeArray['style']); |
|
446 | + if (isset($attributeArray['style'])) { |
|
447 | + $styles = explode(';', $attributeArray['style']); |
|
448 | 448 | foreach ($styles as $st) { |
449 | 449 | $value = explode(':', $st); |
450 | 450 | if (!empty($value[0])) { |
451 | - if(trim($value[0])=="background-color" || trim($value[0])=="color" ) { |
|
451 | + if (trim($value[0]) == "background-color" || trim($value[0]) == "color") { |
|
452 | 452 | $style_color = null; |
453 | 453 | //check if has #, so we can get clean hex |
454 | - if ( substr(trim($value[1]), 0, 1) == "#" ) { |
|
454 | + if (substr(trim($value[1]), 0, 1) == "#") { |
|
455 | 455 | $style_color = substr(trim($value[1]), 1); |
456 | 456 | } |
457 | - if($style_color) { |
|
457 | + if ($style_color) { |
|
458 | 458 | if (trim($value[0]) == "background-color") { |
459 | - $sheet->getStyle($column . $row)->applyFromArray( ['fill' => ['type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,'color' => ['rgb' => "{$style_color}" ],], ] ); |
|
459 | + $sheet->getStyle($column . $row)->applyFromArray(['fill' => ['type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'color' => ['rgb' => "{$style_color}"], ], ]); |
|
460 | 460 | } elseif (trim($value[0]) == "color") { |
461 | - $sheet->getStyle($column . $row)->applyFromArray( ['font' => ['color' => [ 'rgb' => "$style_color}" ]], ]); |
|
461 | + $sheet->getStyle($column . $row)->applyFromArray(['font' => ['color' => ['rgb' => "$style_color}"]], ]); |
|
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |