Allow nullable theme for Xlsx Style Reader class (#1044)

This commit is contained in:
Mark Baker 2019-07-01 20:59:34 +02:00 committed by GitHub
parent 0e6238c69e
commit d645ed92d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 9 deletions

View File

@ -6,6 +6,7 @@ require __DIR__ . '/../Header.php';
$spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php'; $spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
$helper->log('Write to CSV format'); $helper->log('Write to CSV format');
/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writer */
$writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',') $writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',')
->setEnclosure('"') ->setEnclosure('"')
->setSheetIndex(0); ->setSheetIndex(0);
@ -17,6 +18,7 @@ $helper->logWrite($writer, $filename, $callStartTime);
$helper->log('Read from CSV format'); $helper->log('Read from CSV format');
/** @var \PhpOffice\PhpSpreadsheet\Reader\Csv $reader */
$reader = IOFactory::createReader('Csv')->setDelimiter(',') $reader = IOFactory::createReader('Csv')->setDelimiter(',')
->setEnclosure('"') ->setEnclosure('"')
->setSheetIndex(0); ->setSheetIndex(0);
@ -30,6 +32,7 @@ $helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx']);
// Write CSV // Write CSV
$filenameCSV = $helper->getFilename(__FILE__, 'csv'); $filenameCSV = $helper->getFilename(__FILE__, 'csv');
/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writerCSV */
$writerCSV = IOFactory::createWriter($spreadsheetFromCSV, 'Csv'); $writerCSV = IOFactory::createWriter($spreadsheetFromCSV, 'Csv');
$writerCSV->setExcelCompatibility(true); $writerCSV->setExcelCompatibility(true);

View File

@ -24,6 +24,7 @@ $worksheet->removeRow(1, 2);
// Export to CSV (.csv) // Export to CSV (.csv)
$helper->log('Write to CSV format'); $helper->log('Write to CSV format');
/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writer */
$writer = IOFactory::createWriter($spreadsheet, 'Csv'); $writer = IOFactory::createWriter($spreadsheet, 'Csv');
$filename = $helper->getFilename(__FILE__, 'csv'); $filename = $helper->getFilename(__FILE__, 'csv');
$callStartTime = microtime(true); $callStartTime = microtime(true);

View File

@ -7,13 +7,6 @@ use PhpOffice\PhpSpreadsheet\Settings;
class XmlScanner class XmlScanner
{ {
/**
* Identifies whether the thread-safe libxmlDisableEntityLoader() function is available.
*
* @var bool
*/
private $libxmlDisableEntityLoader = false;
/** /**
* String used to identify risky xml elements. * String used to identify risky xml elements.
* *

View File

@ -32,7 +32,6 @@ use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\Protection; use PhpOffice\PhpSpreadsheet\Style\Protection;
use PhpOffice\PhpSpreadsheet\Style\Style; use PhpOffice\PhpSpreadsheet\Style\Style;
use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column;
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing; use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use SimpleXMLElement; use SimpleXMLElement;

View File

@ -31,7 +31,7 @@ class Styles extends BaseParserClass
$this->styleXml = $styleXml; $this->styleXml = $styleXml;
} }
public function setStyleBaseData(Theme $theme, $styles, $cellStyles) public function setStyleBaseData(Theme $theme = null, $styles = [], $cellStyles = [])
{ {
self::$theme = $theme; self::$theme = $theme;
$this->styles = $styles; $this->styles = $styles;