diff --git a/docs/Examples/Reader/exampleReader02.php b/docs/Examples/Reader/exampleReader02.php index 1e057853..2eccc24d 100644 --- a/docs/Examples/Reader/exampleReader02.php +++ b/docs/Examples/Reader/exampleReader02.php @@ -30,11 +30,11 @@ $inputFileName = './sampleData/example1.xls'; echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using \PhpOffice\PhpSpreadsheet\Reader\Xls
'; $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Excel2003XML(); +// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\SYLK(); +// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\CSV(); +// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); $spreadsheet = $reader->load($inputFileName); echo '
'; diff --git a/docs/Examples/Reader/exampleReader03.php b/docs/Examples/Reader/exampleReader03.php index 49eaad66..50f63bc6 100644 --- a/docs/Examples/Reader/exampleReader03.php +++ b/docs/Examples/Reader/exampleReader03.php @@ -27,11 +27,11 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; -// $inputFileType = 'SYLK'; +// $inputFileType = 'Slk'; // $inputFileType = 'Gnumeric'; -// $inputFileType = 'CSV'; +// $inputFileType = 'Csv'; $inputFileName = './sampleData/example1.xls'; echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
'; diff --git a/docs/Examples/Reader/exampleReader05.php b/docs/Examples/Reader/exampleReader05.php index faeb11dc..fade19e4 100644 --- a/docs/Examples/Reader/exampleReader05.php +++ b/docs/Examples/Reader/exampleReader05.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader06.php b/docs/Examples/Reader/exampleReader06.php index 70cf8e04..ef509648 100644 --- a/docs/Examples/Reader/exampleReader06.php +++ b/docs/Examples/Reader/exampleReader06.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader07.php b/docs/Examples/Reader/exampleReader07.php index 251a5e99..8df59e4c 100644 --- a/docs/Examples/Reader/exampleReader07.php +++ b/docs/Examples/Reader/exampleReader07.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader08.php b/docs/Examples/Reader/exampleReader08.php index 5bc0a63b..4a8375ea 100644 --- a/docs/Examples/Reader/exampleReader08.php +++ b/docs/Examples/Reader/exampleReader08.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader09.php b/docs/Examples/Reader/exampleReader09.php index 45237b81..fbaa90f7 100644 --- a/docs/Examples/Reader/exampleReader09.php +++ b/docs/Examples/Reader/exampleReader09.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader10.php b/docs/Examples/Reader/exampleReader10.php index 45957f29..56295014 100644 --- a/docs/Examples/Reader/exampleReader10.php +++ b/docs/Examples/Reader/exampleReader10.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader11.php b/docs/Examples/Reader/exampleReader11.php index 6e6fa796..05b55e51 100644 --- a/docs/Examples/Reader/exampleReader11.php +++ b/docs/Examples/Reader/exampleReader11.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example2.xls'; @@ -39,7 +39,12 @@ class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter private $_endRow = 0; - /** We expect a list of the rows that we want to read to be passed into the constructor */ + /** + * We expect a list of the rows that we want to read to be passed into the constructor. + * + * @param mixed $startRow + * @param mixed $chunkSize + */ public function __construct($startRow, $chunkSize) { $this->_startRow = $startRow; diff --git a/docs/Examples/Reader/exampleReader12.php b/docs/Examples/Reader/exampleReader12.php index 9dbbd7a0..8ac4de27 100644 --- a/docs/Examples/Reader/exampleReader12.php +++ b/docs/Examples/Reader/exampleReader12.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example2.xls'; @@ -39,7 +39,12 @@ class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter private $_endRow = 0; -/** Set the list of rows that we want to read */ + /** + * Set the list of rows that we want to read. + * + * @param mixed $startRow + * @param mixed $chunkSize + */ public function setRows($startRow, $chunkSize) { $this->_startRow = $startRow; diff --git a/docs/Examples/Reader/exampleReader13.php b/docs/Examples/Reader/exampleReader13.php index 690eebca..45f2c612 100644 --- a/docs/Examples/Reader/exampleReader13.php +++ b/docs/Examples/Reader/exampleReader13.php @@ -25,7 +25,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); /** \PhpOffice\PhpSpreadsheet\IOFactory */ include 'PHPExcel/IOFactory.php'; -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileNames = ['./sampleData/example1.csv', './sampleData/example2.csv']; $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); diff --git a/docs/Examples/Reader/exampleReader14.php b/docs/Examples/Reader/exampleReader14.php index 22d16e12..60136251 100644 --- a/docs/Examples/Reader/exampleReader14.php +++ b/docs/Examples/Reader/exampleReader14.php @@ -20,7 +20,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); /** \PhpOffice\PhpSpreadsheet\IOFactory */ include 'PHPExcel/IOFactory.php'; -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example2.csv'; /** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ @@ -30,7 +30,12 @@ class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter private $_endRow = 0; -/** Set the list of rows that we want to read */ + /** + * Set the list of rows that we want to read. + * + * @param mixed $startRow + * @param mixed $chunkSize + */ public function setRows($startRow, $chunkSize) { $this->_startRow = $startRow; diff --git a/docs/Examples/Reader/exampleReader15.php b/docs/Examples/Reader/exampleReader15.php index 957a571f..7931a073 100644 --- a/docs/Examples/Reader/exampleReader15.php +++ b/docs/Examples/Reader/exampleReader15.php @@ -22,7 +22,7 @@ include 'PHPExcel/IOFactory.php'; \PhpOffice\PhpSpreadsheet\Cell::setValueBinder(new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder()); -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example1.tsv'; $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); diff --git a/docs/Examples/Reader/exampleReader17.php b/docs/Examples/Reader/exampleReader17.php index 454a6b0f..fbcae6b1 100644 --- a/docs/Examples/Reader/exampleReader17.php +++ b/docs/Examples/Reader/exampleReader17.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader18.php b/docs/Examples/Reader/exampleReader18.php index 8890cf16..9c34ec1f 100644 --- a/docs/Examples/Reader/exampleReader18.php +++ b/docs/Examples/Reader/exampleReader18.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/Examples/Reader/exampleReader19.php b/docs/Examples/Reader/exampleReader19.php index 2a43f0af..5378c2ef 100644 --- a/docs/Examples/Reader/exampleReader19.php +++ b/docs/Examples/Reader/exampleReader19.php @@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php'; $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; // $inputFileType = 'Gnumeric'; $inputFileName = './sampleData/example1.xls'; diff --git a/docs/index.md b/docs/index.md index 0e3d6806..430af4e3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1087,14 +1087,14 @@ versions of Microsoft Excel. has some limits regarding to styling cells and handling large spreadsheets via PHP. -### \PhpOffice\PhpSpreadsheet\Reader\Excel2003XML +### \PhpOffice\PhpSpreadsheet\Reader\Xml #### Reading a spreadsheet You can read an Excel 2003 .xml file using the following code: ``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Excel2003XML(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); $spreadsheet = $reader->load("05featuredemo.xml"); ``` @@ -1122,7 +1122,7 @@ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { } -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Excel2003XML(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); $reader->setReadFilter( new MyReadFilter() ); $spreadsheet = $reader->load("06largescale.xml"); ``` @@ -1138,14 +1138,14 @@ applications, such as databases. **SYLK limitations** Please note that SYLK file format has some limits regarding to styling cells and handling large spreadsheets via PHP. -### \PhpOffice\PhpSpreadsheet\Reader\SYLK +### \PhpOffice\PhpSpreadsheet\Reader\Slk #### Reading a spreadsheet You can read an .slk file using the following code: ``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\SYLK(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); $spreadsheet = $reader->load("05featuredemo.slk"); ``` @@ -1173,7 +1173,7 @@ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { } -$reader = new \PhpOffice\PhpSpreadsheet\Reader\SYLK(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); $reader->setReadFilter( new MyReadFilter() ); $spreadsheet = $reader->load("06largescale.slk"); ``` @@ -1232,14 +1232,14 @@ CSV files. **CSV limitations** Please note that CSV file format has some limits regarding to styling cells, number formatting, ... -### \PhpOffice\PhpSpreadsheet\Reader\CSV +### \PhpOffice\PhpSpreadsheet\Reader\Csv #### Reading a CSV file You can read a .csv file using the following code: ``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\CSV(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); $spreadsheet = $reader->load("sample.csv"); ``` @@ -1247,17 +1247,17 @@ $spreadsheet = $reader->load("sample.csv"); Often, CSV files are not really “comma separated”, or use semicolon (;) as a separator. You can instruct -\PhpOffice\PhpSpreadsheet\Reader\CSV some options before reading a CSV +\PhpOffice\PhpSpreadsheet\Reader\Csv some options before reading a CSV file. -Note that \PhpOffice\PhpSpreadsheet\Reader\CSV by default assumes that +Note that \PhpOffice\PhpSpreadsheet\Reader\Csv by default assumes that the loaded CSV file is UTF-8 encoded. If you are reading CSV files that were created in Microsoft Office Excel the correct input encoding may rather be Windows-1252 (CP1252). Always make sure that the input encoding is set appropriately. ``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\CSV(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); $reader->setInputEncoding('CP1252'); $reader->setDelimiter(';'); $reader->setEnclosure(''); @@ -1284,7 +1284,7 @@ CSV file into an existing \$spreadsheet containing some sheets, and imports onto the 6th sheet: ``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\CSV(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); $reader->setDelimiter(';'); $reader->setEnclosure(''); $reader->setLineEnding("\r\n"); @@ -1293,14 +1293,14 @@ $reader->setSheetIndex(5); $reader->loadIntoExisting("05featuredemo.csv", $spreadsheet); ``` -### \PhpOffice\PhpSpreadsheet\Writer\CSV +### \PhpOffice\PhpSpreadsheet\Writer\Csv #### Writing a CSV file You can write a .csv file using the following code: ``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\CSV($spreadsheet); +$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); $writer->save("05featuredemo.csv"); ``` @@ -1308,11 +1308,11 @@ $writer->save("05featuredemo.csv"); Often, CSV files are not really “comma separated”, or use semicolon (;) as a separator. You can instruct -\PhpOffice\PhpSpreadsheet\Writer\CSV some options before writing a CSV +\PhpOffice\PhpSpreadsheet\Writer\Csv some options before writing a CSV file: ``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\CSV($spreadsheet); +$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); $writer->setDelimiter(';'); $writer->setEnclosure(''); $writer->setLineEnding("\r\n"); @@ -1337,7 +1337,7 @@ This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation: ``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\CSV($spreadsheet); +$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); $writer->setPreCalculateFormulas(false); $writer->save("05featuredemo.csv"); ``` @@ -1348,7 +1348,7 @@ A CSV file can be marked as UTF-8 by writing a BOM file header. This can be enabled by using the following code: ``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\CSV($spreadsheet); +$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); $writer->setUseBOM(true); $writer->save("05featuredemo.csv"); ``` @@ -1391,14 +1391,14 @@ extension. **HTML limitations** Please note that HTML file format has some limits regarding to styling cells, number formatting, ... -### \PhpOffice\PhpSpreadsheet\Reader\HTML +### \PhpOffice\PhpSpreadsheet\Reader\Html #### Reading a spreadsheet You can read an .html or .htm file using the following code: ``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\HTML(); +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); $spreadsheet = $reader->load("05featuredemo.html"); ``` @@ -1406,9 +1406,9 @@ $spreadsheet = $reader->load("05featuredemo.html"); **HTML limitations** Please note that HTML reader is still experimental and does not yet support merged cells or nested tables cleanly -### \PhpOffice\PhpSpreadsheet\Writer\HTML +### \PhpOffice\PhpSpreadsheet\Writer\Html -Please note that \PhpOffice\PhpSpreadsheet\Writer\HTML only outputs the +Please note that \PhpOffice\PhpSpreadsheet\Writer\Html only outputs the first worksheet by default. #### Writing a spreadsheet @@ -1416,7 +1416,7 @@ first worksheet by default. You can write a .htm file using the following code: ``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet); +$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); $writer->save("05featuredemo.htm"); ``` @@ -1467,7 +1467,7 @@ This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation: ``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet); +$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); $writer->setPreCalculateFormulas(false); $writer->save("05featuredemo.htm"); @@ -1476,7 +1476,7 @@ $writer->save("05featuredemo.htm"); #### Embedding generated HTML in a web page There might be a situation where you want to embed the generated HTML in -an existing website. \PhpOffice\PhpSpreadsheet\Writer\HTML provides +an existing website. \PhpOffice\PhpSpreadsheet\Writer\Html provides support to generate only specific parts of the HTML code, which allows you to use these parts in your website. @@ -1492,7 +1492,7 @@ them into a resulting HTML page: ``` php generateHTMLHeader(); ?> @@ -1523,7 +1523,7 @@ A HTML file can be marked as UTF-8 by writing a BOM file header. This can be enabled by using the following code: ``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet); +$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); $writer->setUseBOM(true); $writer->save("05featuredemo.htm"); @@ -1531,7 +1531,7 @@ $writer->save("05featuredemo.htm"); #### Decimal and thousands separators -See section \PhpOffice\PhpSpreadsheet\Writer\CSV how to control the +See section \PhpOffice\PhpSpreadsheet\Writer\Csv how to control the appearance of these. ## PDF @@ -1617,7 +1617,7 @@ $writer->save("05featuredemo.pdf"); #### Decimal and thousands separators -See section \PhpOffice\PhpSpreadsheet\Writer\CSV how to control the +See section \PhpOffice\PhpSpreadsheet\Writer\Csv how to control the appearance of these. ## Generating Excel files from templates (read, modify, write) diff --git a/docs/topics/file-formats.md b/docs/topics/file-formats.md index 8a8ced3c..36475be8 100644 --- a/docs/topics/file-formats.md +++ b/docs/topics/file-formats.md @@ -19,7 +19,7 @@ describing the format can be found online at from [as a downloadable PDF](http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5BMS-XLS%5D.pdf). -### Excel2003XML +### Xml Microsoft Excel™ 2003 included options for a file format called SpreadsheetML. This file is a zipped XML document. It is not very @@ -54,7 +54,7 @@ Other information is available from the OpenOffice.org XML File Format web page (), part of the OpenOffice.org project. -### SYLK +### Slk This is the Microsoft Multiplan Symbolic Link Interchange (SYLK) file format. Multiplan was a predecessor to Microsoft Excel™. Files normally @@ -73,7 +73,7 @@ and the file is then compressed using the GNU project's gzip compression library. -### CSV +### Csv Comma Separated Value (CSV) file format is a common structuring strategy for text format files. In CSV flies, each line in the file represents a @@ -109,7 +109,7 @@ instead of a comma, since in some languages the comma is used as the decimal separator. Also, many regional versions of Excel will not be able to deal with Unicode characters in a CSV file. -### HTML +### Html HyperText Markup Language (HTML) is the main markup language for creating web pages and other information that can be displayed in a web diff --git a/docs/topics/reading-files.md b/docs/topics/reading-files.md index 5e4aa781..9cbeabf4 100644 --- a/docs/topics/reading-files.md +++ b/docs/topics/reading-files.md @@ -64,11 +64,11 @@ $inputFileName = './sampleData/example1.xls'; /** Create a new Xls Reader **/ $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Excel2003XML(); +// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\SYLK(); +// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); // $reader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\CSV(); +// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); /** Load $inputFileName to a Spreadsheet Object **/ $spreadsheet = $reader->load($inputFileName); ``` @@ -83,11 +83,11 @@ of the reader that you want instantiating. ``` php $inputFileType = 'Xls'; // $inputFileType = 'Xlsx'; -// $inputFileType = 'Excel2003XML'; +// $inputFileType = 'Xml'; // $inputFileType = 'Ods'; -// $inputFileType = 'SYLK'; +// $inputFileType = 'Slk'; // $inputFileType = 'Gnumeric'; -// $inputFileType = 'CSV'; +// $inputFileType = 'Csv'; $inputFileName = './sampleData/example1.xls'; /** Create a new Reader of the type defined in $inputFileType **/ @@ -161,7 +161,7 @@ Reading Only Data from a Spreadsheet File applies to Readers: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Xml | YES | Ods | YES | SYLK | NO | Gnumeric | YES | CSV | NO | HTML | NO @@ -232,7 +232,7 @@ Reading Only Named WorkSheets from a File applies to Readers: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Xml | YES | Ods | YES | SYLK | NO | Gnumeric | YES | CSV | NO | HTML | NO @@ -380,7 +380,7 @@ Using Read Filters applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Xml | YES | Ods | YES | SYLK | NO | Gnumeric | YES | CSV | YES | HTML | NO | | | @@ -397,7 +397,7 @@ loadIntoExisting() method rather than the load() method to actually read the file into that worksheet. ``` php -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileNames = array('./sampleData/example1.csv', './sampleData/example2.csv' './sampleData/example3.csv' @@ -439,7 +439,7 @@ Combining Multiple Files into a Single Spreadsheet Object applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Xml | NO | Ods | NO | SYLK | YES | Gnumeric | NO | CSV | YES | HTML | NO @@ -457,7 +457,7 @@ and the setSheetIndex() method of the \$reader, we can split the CSV file across several individual worksheets. ``` php -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example2.csv'; @@ -518,7 +518,7 @@ Splitting a single loaded file across multiple worksheets applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Xml | NO | Ods | NO | SYLK | NO | Gnumeric | NO | CSV | YES | HTML | NO @@ -529,7 +529,7 @@ separator, but you can modify this to load tab- or pipe-separated value files using the setDelimiter() method. ``` php -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example1.tsv'; /** Create a new Reader of the type defined in $inputFileType **/ $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); @@ -554,7 +554,7 @@ Setting CSV delimiter applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Xml | NO | Ods | NO | SYLK | NO | Gnumeric | NO | CSV | YES | HTML | NO @@ -591,7 +591,7 @@ loader logic when reading unformatted text files. /** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/ \PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example1.tsv'; $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); @@ -606,7 +606,7 @@ Loading using a Value Binder applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N ----------|:---:|--------|:---:|--------------|:---: -Xlsx | NO | Xls | NO | Excel2003XML | NO +Xlsx | NO | Xls | NO | Xml | NO Ods | NO | SYLK | NO | Gnumeric | NO CSV | YES | HTML | YES @@ -654,7 +654,7 @@ Reading Only Data from a Spreadsheet File applies to Readers: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Xml | YES | Ods | YES | SYLK | NO | Gnumeric | YES | CSV | NO | HTML | NO @@ -725,7 +725,7 @@ Reading Only Named WorkSheets from a File applies to Readers: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Xml | YES | Ods | YES | SYLK | NO | Gnumeric | YES | CSV | NO | HTML | NO @@ -873,7 +873,7 @@ Using Read Filters applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Excel2003XML | YES | +Xlsx | YES | Xls | YES | Xml | YES | Ods | YES | SYLK | NO | Gnumeric | YES | CSV | YES | HTML | NO @@ -890,7 +890,7 @@ loadIntoExisting() method rather than the load() method to actually read the file into that worksheet. ``` php -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileNames = array('./sampleData/example1.csv', './sampleData/example2.csv' './sampleData/example3.csv' @@ -932,7 +932,7 @@ Combining Multiple Files into a Single Spreadsheet Object applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Xml | NO | Ods | NO | SYLK | YES | Gnumeric | NO | CSV | YES | HTML | NO @@ -950,7 +950,7 @@ and the setSheetIndex() method of the \$reader, we can split the CSV file across several individual worksheets. ``` php -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example2.csv'; @@ -1011,7 +1011,7 @@ Splitting a single loaded file across multiple worksheets applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Xml | NO | Ods | NO | SYLK | NO | Gnumeric | NO | CSV | YES | HTML | NO @@ -1022,7 +1022,7 @@ separator, but you can modify this to load tab- or pipe-separated value files using the setDelimiter() method. ``` php -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example1.tsv'; /** Create a new Reader of the type defined in $inputFileType **/ $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); @@ -1047,7 +1047,7 @@ Setting CSV delimiter applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N | ----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Excel2003XML | NO | +Xlsx | NO | Xls | NO | Xml | NO | Ods | NO | SYLK | NO | Gnumeric | NO | CSV | YES | HTML | NO @@ -1084,7 +1084,7 @@ loader logic when reading unformatted text files. /** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/ \PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); -$inputFileType = 'CSV'; +$inputFileType = 'Csv'; $inputFileName = './sampleData/example1.tsv'; $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); @@ -1099,7 +1099,7 @@ Loading using a Value Binder applies to: Reader | Y/N |Reader | Y/N |Reader | Y/N ----------|:---:|--------|:---:|--------------|:---: -Xlsx | NO | Xls | NO | Excel2003XML | NO +Xlsx | NO | Xls | NO | Xml | NO Ods | NO | SYLK | NO | Gnumeric | NO CSV | YES | HTML | YES diff --git a/samples/01_Simple_PCLZip.php b/samples/01_Simple_PCLZip.php index a00c4cb4..b1cb73e6 100644 --- a/samples/01_Simple_PCLZip.php +++ b/samples/01_Simple_PCLZip.php @@ -47,4 +47,4 @@ $helper->log('Write to Xlsx format'); \PhpOffice\PhpSpreadsheet\Settings::setZipClass(\PhpOffice\PhpSpreadsheet\Settings::PCLZIP); // Save -$helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx']); +$helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/16_Csv.php b/samples/16_Csv.php index 1eb8a1d9..63cbd53e 100644 --- a/samples/16_Csv.php +++ b/samples/16_Csv.php @@ -4,7 +4,7 @@ require __DIR__ . '/Header.php'; $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php'; $helper->log('Write to CSV format'); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV')->setDelimiter(',') +$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',') ->setEnclosure('"') ->setSheetIndex(0); @@ -15,20 +15,20 @@ $helper->logWrite($writer, $filename, $callStartTime); $helper->log('Read from CSV format'); -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('CSV')->setDelimiter(',') +$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Csv')->setDelimiter(',') ->setEnclosure('"') ->setSheetIndex(0); $callStartTime = microtime(true); $spreadsheetFromCSV = $reader->load($filename); -$helper->logRead('CSV', $filename, $callStartTime); +$helper->logRead('Csv', $filename, $callStartTime); // Write Xlsx -$helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx' => 'xlsx']); +$helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx']); // Write CSV $filenameCSV = $helper->getFilename(__FILE__, 'csv'); -$writerCSV = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'CSV'); +$writerCSV = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'Csv'); $writerCSV->setExcelCompatibility(true); $callStartTime = microtime(true); diff --git a/samples/17_Html.php b/samples/17_Html.php index eb3b748b..d3dfd5b0 100644 --- a/samples/17_Html.php +++ b/samples/17_Html.php @@ -4,7 +4,7 @@ require __DIR__ . '/Header.php'; $spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php'; $filename = $helper->getFilename(__FILE__, 'html'); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML'); +$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Html'); $callStartTime = microtime(true); $writer->save($filename); diff --git a/samples/20_Read_Excel2003XML.php b/samples/20_Read_Excel2003XML.php index 37169359..e6c1a797 100644 --- a/samples/20_Read_Excel2003XML.php +++ b/samples/20_Read_Excel2003XML.php @@ -5,7 +5,7 @@ require __DIR__ . '/Header.php'; $filename = __DIR__ . '/templates/Excel2003XMLTest.xml'; $callStartTime = microtime(true); $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename); -$helper->logRead('Excel2003XML', $filename, $callStartTime); +$helper->logRead('Xml', $filename, $callStartTime); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/20_Read_Sylk.php b/samples/20_Read_Sylk.php index 0ffa618f..b3baa5a5 100644 --- a/samples/20_Read_Sylk.php +++ b/samples/20_Read_Sylk.php @@ -5,7 +5,7 @@ require __DIR__ . '/Header.php'; $filename = __DIR__ . '/templates/SylkTest.slk'; $callStartTime = microtime(true); $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename); -$helper->logRead('SYLK', $filename, $callStartTime); +$helper->logRead('Slk', $filename, $callStartTime); // Save $helper->write($spreadsheet, __FILE__); diff --git a/samples/21_Pdf_Domdf.php b/samples/21_Pdf_Domdf.php index 44d6e972..bc891d6f 100644 --- a/samples/21_Pdf_Domdf.php +++ b/samples/21_Pdf_Domdf.php @@ -14,4 +14,4 @@ $helper->log("Write to PDF format using {$rendererName}"); \PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName); // Save -$helper->write($spreadsheet, __FILE__, ['Pdf' => 'pdf']); +$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/samples/21_Pdf_TCPDF.php b/samples/21_Pdf_TCPDF.php index 53eda62a..980069fc 100644 --- a/samples/21_Pdf_TCPDF.php +++ b/samples/21_Pdf_TCPDF.php @@ -14,4 +14,4 @@ $helper->log("Write to PDF format using {$rendererName}"); \PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName); // Save -$helper->write($spreadsheet, __FILE__, ['Pdf' => 'pdf']); +$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/samples/21_Pdf_mPDF.php b/samples/21_Pdf_mPDF.php index f2734966..b5327a61 100644 --- a/samples/21_Pdf_mPDF.php +++ b/samples/21_Pdf_mPDF.php @@ -14,4 +14,4 @@ $helper->log("Write to PDF format using {$rendererName}"); \PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName); // Save -$helper->write($spreadsheet, __FILE__, ['Pdf' => 'pdf']); +$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/samples/25_In_memory_image.php b/samples/25_In_memory_image.php index 87746271..aef166f1 100644 --- a/samples/25_In_memory_image.php +++ b/samples/25_In_memory_image.php @@ -34,4 +34,4 @@ $drawing->setHeight(36); $drawing->setWorksheet($spreadsheet->getActiveSheet()); // Save -$helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx', 'HTML' => 'html']); +$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Html']); diff --git a/samples/26_Utf8.php b/samples/26_Utf8.php index 6925f567..105b0f94 100644 --- a/samples/26_Utf8.php +++ b/samples/26_Utf8.php @@ -14,12 +14,12 @@ $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); $spreadsheet = $reader->load(__DIR__ . '/templates/26template.xlsx'); /* at this point, we could do some manipulations with the template, but we skip this step */ -$helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx', 'Xls' => 'xls', 'HTML' => 'html']); +$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']); // Export to PDF (.pdf) $helper->log('Write to PDF format'); \PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName); -$helper->write($spreadsheet, __FILE__, ['Pdf' => 'pdf']); +$helper->write($spreadsheet, __FILE__, ['Pdf']); // Remove first two rows with field headers before exporting to CSV $helper->log('Removing first two heading rows for CSV export'); @@ -28,7 +28,7 @@ $worksheet->removeRow(1, 2); // Export to CSV (.csv) $helper->log('Write to CSV format'); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'CSV'); +$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv'); $filename = $helper->getFilename(__FILE__, 'csv'); $callStartTime = microtime(true); $writer->save($filename); diff --git a/samples/32_Chart_read_write_HTML.php b/samples/32_Chart_read_write_HTML.php index 540e8985..aa697efd 100644 --- a/samples/32_Chart_read_write_HTML.php +++ b/samples/32_Chart_read_write_HTML.php @@ -83,7 +83,7 @@ foreach ($inputFileNames as $inputFileName) { // Save $filename = $helper->getFilename($inputFileName); - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'HTML'); + $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Html'); $writer->setIncludeCharts(true); $callStartTime = microtime(true); $writer->save($filename); diff --git a/samples/42_RichText.php b/samples/42_RichText.php index d65bd8d9..53b1c573 100644 --- a/samples/42_RichText.php +++ b/samples/42_RichText.php @@ -48,7 +48,7 @@ $html4 = 'H2SO4 is the chemical formula for Sulphuric acid $html5 = 'bold, italic, bold+italic'; -$wizard = new \PhpOffice\PhpSpreadsheet\Helper\HTML(); +$wizard = new \PhpOffice\PhpSpreadsheet\Helper\Html(); $richText = $wizard->toRichTextObject($html1); $spreadsheet->getActiveSheet() diff --git a/src/PhpSpreadsheet/Helper/HTML.php b/src/PhpSpreadsheet/Helper/Html.php similarity index 99% rename from src/PhpSpreadsheet/Helper/HTML.php rename to src/PhpSpreadsheet/Helper/Html.php index dfb4acba..7c5df34d 100644 --- a/src/PhpSpreadsheet/Helper/HTML.php +++ b/src/PhpSpreadsheet/Helper/Html.php @@ -29,7 +29,7 @@ use DOMText; * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -class HTML +class Html { protected static $colourMap = [ 'aliceblue' => 'f0f8ff', diff --git a/src/PhpSpreadsheet/Helper/Migrator.php b/src/PhpSpreadsheet/Helper/Migrator.php index 3912e48f..6615c25d 100644 --- a/src/PhpSpreadsheet/Helper/Migrator.php +++ b/src/PhpSpreadsheet/Helper/Migrator.php @@ -133,18 +133,18 @@ class Migrator 'PHPExcel_Chart_Title' => '\\PhpOffice\\PhpSpreadsheet\\Chart\\Title', 'PHPExcel_DocumentProperties' => '\\PhpOffice\\PhpSpreadsheet\\Document\\Properties', 'PHPExcel_DocumentSecurity' => '\\PhpOffice\\PhpSpreadsheet\\Document\\Security', - 'PHPExcel_Helper_HTML' => '\\PhpOffice\\PhpSpreadsheet\\Helper\\HTML', + 'PHPExcel_Helper_HTML' => '\\PhpOffice\\PhpSpreadsheet\\Helper\\Html', 'PHPExcel_Reader_Abstract' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\BaseReader', - 'PHPExcel_Reader_CSV' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\CSV', + 'PHPExcel_Reader_CSV' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Csv', 'PHPExcel_Reader_DefaultReadFilter' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\DefaultReadFilter', - 'PHPExcel_Reader_Excel2003XML' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Excel2003XML', + 'PHPExcel_Reader_Excel2003XML' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Xml', 'PHPExcel_Reader_Exception' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Exception', 'PHPExcel_Reader_Gnumeric' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Gnumeric', - 'PHPExcel_Reader_HTML' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\HTML', + 'PHPExcel_Reader_HTML' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Html', 'PHPExcel_Reader_IReadFilter' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\IReadFilter', 'PHPExcel_Reader_IReader' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\IReader', 'PHPExcel_Reader_OOCalc' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Ods', - 'PHPExcel_Reader_SYLK' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\SYLK', + 'PHPExcel_Reader_SYLK' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Slk', 'PHPExcel_Reader_Excel5' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Xls', 'PHPExcel_Reader_Excel2007' => '\\PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx', 'PHPExcel_RichText_ITextElement' => '\\PhpOffice\\PhpSpreadsheet\\RichText\\ITextElement', @@ -196,9 +196,9 @@ class Migrator 'PHPExcel_Worksheet_RowIterator' => '\\PhpOffice\\PhpSpreadsheet\\Worksheet\\RowIterator', 'PHPExcel_Worksheet_SheetView' => '\\PhpOffice\\PhpSpreadsheet\\Worksheet\\SheetView', 'PHPExcel_Writer_Abstract' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\BaseWriter', - 'PHPExcel_Writer_CSV' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\CSV', + 'PHPExcel_Writer_CSV' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Csv', 'PHPExcel_Writer_Exception' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Exception', - 'PHPExcel_Writer_HTML' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\HTML', + 'PHPExcel_Writer_HTML' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Html', 'PHPExcel_Writer_IWriter' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\IWriter', 'PHPExcel_Writer_OpenDocument' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Ods', 'PHPExcel_Writer_PDF' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Pdf', diff --git a/src/PhpSpreadsheet/Helper/Sample.php b/src/PhpSpreadsheet/Helper/Sample.php index 22b5079f..e6cf1530 100644 --- a/src/PhpSpreadsheet/Helper/Sample.php +++ b/src/PhpSpreadsheet/Helper/Sample.php @@ -5,10 +5,13 @@ namespace PhpOffice\PhpSpreadsheet\Helper; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; +/** + * Helper class to be used in sample code. + */ class Sample { /** - * Returns wether we run on CLI or browser. + * Returns whether we run on CLI or browser. * * @return bool */ @@ -28,7 +31,7 @@ class Sample } /** - * Wether we are executing the index page. + * Whether we are executing the index page. * * @return bool */ @@ -82,24 +85,20 @@ class Sample * * @param Spreadsheet $spreadsheet * @param string $filename - * @param array $writers + * @param string[] $writers */ - public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx' => 'xlsx', 'Xls' => 'xls']) + public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx', 'Xls']) { // Set active sheet index to the first sheet, so Excel opens this as the first sheet $spreadsheet->setActiveSheetIndex(0); // Write documents - foreach ($writers as $format => $extension) { - $path = $this->getFilename($filename, $extension); - if (!is_null($extension)) { - $writer = IOFactory::createWriter($spreadsheet, $format); - $callStartTime = microtime(true); - $writer->save($path); - $this->logWrite($writer, $path, $callStartTime); - } else { - throw new \Exception('Missing extension'); - } + foreach ($writers as $writerType) { + $path = $this->getFilename($filename, mb_strtolower($writerType)); + $writer = IOFactory::createWriter($spreadsheet, $writerType); + $callStartTime = microtime(true); + $writer->save($path); + $this->logWrite($writer, $path, $callStartTime); } $this->logEndingNotes(); diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index 58f3d8ac..650daa7e 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -48,12 +48,12 @@ class IOFactory private static $autoResolveClasses = [ 'Xlsx', 'Xls', - 'Excel2003XML', + 'Xml', 'Ods', - 'SYLK', + 'Slk', 'Gnumeric', - 'HTML', - 'CSV', + 'Html', + 'Csv', ]; /** @@ -119,7 +119,7 @@ class IOFactory * * @return Writer\IWriter */ - public static function createWriter(Spreadsheet $spreadsheet, $writerType = '') + public static function createWriter(Spreadsheet $spreadsheet, $writerType) { // Search type $searchType = 'IWriter'; @@ -247,17 +247,17 @@ class IOFactory $extensionType = 'Ods'; break; case 'slk': - $extensionType = 'SYLK'; + $extensionType = 'Slk'; break; case 'xml': // Excel 2003 SpreadSheetML - $extensionType = 'Excel2003XML'; + $extensionType = 'Xml'; break; case 'gnumeric': $extensionType = 'Gnumeric'; break; case 'htm': case 'html': - $extensionType = 'HTML'; + $extensionType = 'Html'; break; case 'csv': // Do nothing diff --git a/src/PhpSpreadsheet/Reader/CSV.php b/src/PhpSpreadsheet/Reader/Csv.php similarity index 99% rename from src/PhpSpreadsheet/Reader/CSV.php rename to src/PhpSpreadsheet/Reader/Csv.php index 164185da..bd639909 100644 --- a/src/PhpSpreadsheet/Reader/CSV.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -26,7 +26,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -class CSV extends BaseReader implements IReader +class Csv extends BaseReader implements IReader { /** * Input encoding. diff --git a/src/PhpSpreadsheet/Reader/HTML.php b/src/PhpSpreadsheet/Reader/Html.php similarity index 99% rename from src/PhpSpreadsheet/Reader/HTML.php rename to src/PhpSpreadsheet/Reader/Html.php index b9ec0c81..d970b43f 100644 --- a/src/PhpSpreadsheet/Reader/HTML.php +++ b/src/PhpSpreadsheet/Reader/Html.php @@ -31,7 +31,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ /** PhpSpreadsheet root directory */ -class HTML extends BaseReader implements IReader +class Html extends BaseReader implements IReader { /** * Sample size to read to determine if it's HTML or not. diff --git a/src/PhpSpreadsheet/Reader/SYLK.php b/src/PhpSpreadsheet/Reader/Slk.php similarity index 99% rename from src/PhpSpreadsheet/Reader/SYLK.php rename to src/PhpSpreadsheet/Reader/Slk.php index da085e8d..7da5bc7d 100644 --- a/src/PhpSpreadsheet/Reader/SYLK.php +++ b/src/PhpSpreadsheet/Reader/Slk.php @@ -24,7 +24,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader; * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -class SYLK extends BaseReader implements IReader +class Slk extends BaseReader implements IReader { /** * Input encoding. diff --git a/src/PhpSpreadsheet/Reader/Excel2003XML.php b/src/PhpSpreadsheet/Reader/Xml.php similarity index 99% rename from src/PhpSpreadsheet/Reader/Excel2003XML.php rename to src/PhpSpreadsheet/Reader/Xml.php index 6545efb7..aa3d7800 100644 --- a/src/PhpSpreadsheet/Reader/Excel2003XML.php +++ b/src/PhpSpreadsheet/Reader/Xml.php @@ -27,7 +27,11 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -class Excel2003XML extends BaseReader implements IReader + +/** + * Reader for SpreadsheetML, the XML schema for Microsoft Office Excel 2003. + */ +class Xml extends BaseReader implements IReader { /** * Formats. diff --git a/src/PhpSpreadsheet/Shared/StringHelper.php b/src/PhpSpreadsheet/Shared/StringHelper.php index f73b28fd..c6778351 100644 --- a/src/PhpSpreadsheet/Shared/StringHelper.php +++ b/src/PhpSpreadsheet/Shared/StringHelper.php @@ -745,7 +745,7 @@ class StringHelper /** * Set the decimal separator. Only used by \PhpOffice\PhpSpreadsheet\Style\NumberFormat::toFormattedString() - * to format output by \PhpOffice\PhpSpreadsheet\Writer\HTML and \PhpOffice\PhpSpreadsheet\Writer\Pdf. + * to format output by \PhpOffice\PhpSpreadsheet\Writer\Html and \PhpOffice\PhpSpreadsheet\Writer\Pdf. * * @param string $pValue Character for decimal separator */ @@ -778,7 +778,7 @@ class StringHelper /** * Set the thousands separator. Only used by \PhpOffice\PhpSpreadsheet\Style\NumberFormat::toFormattedString() - * to format output by \PhpOffice\PhpSpreadsheet\Writer\HTML and \PhpOffice\PhpSpreadsheet\Writer\Pdf. + * to format output by \PhpOffice\PhpSpreadsheet\Writer\Html and \PhpOffice\PhpSpreadsheet\Writer\Pdf. * * @param string $pValue Character for thousands separator */ @@ -816,7 +816,7 @@ class StringHelper /** * Set the currency code. Only used by \PhpOffice\PhpSpreadsheet\Style\NumberFormat::toFormattedString() - * to format output by \PhpOffice\PhpSpreadsheet\Writer\HTML and \PhpOffice\PhpSpreadsheet\Writer\Pdf. + * to format output by \PhpOffice\PhpSpreadsheet\Writer\Html and \PhpOffice\PhpSpreadsheet\Writer\Pdf. * * @param string $pValue Character for currency code */ diff --git a/src/PhpSpreadsheet/Writer/CSV.php b/src/PhpSpreadsheet/Writer/Csv.php similarity index 99% rename from src/PhpSpreadsheet/Writer/CSV.php rename to src/PhpSpreadsheet/Writer/Csv.php index 84e0e1a2..c40c657e 100644 --- a/src/PhpSpreadsheet/Writer/CSV.php +++ b/src/PhpSpreadsheet/Writer/Csv.php @@ -24,7 +24,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer; * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -class CSV extends BaseWriter implements IWriter +class Csv extends BaseWriter implements IWriter { /** * PhpSpreadsheet object. diff --git a/src/PhpSpreadsheet/Writer/HTML.php b/src/PhpSpreadsheet/Writer/Html.php similarity index 99% rename from src/PhpSpreadsheet/Writer/HTML.php rename to src/PhpSpreadsheet/Writer/Html.php index c95d5ecc..c5335e78 100644 --- a/src/PhpSpreadsheet/Writer/HTML.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -29,7 +29,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; * @copyright Copyright (c) 2006 - 2015 Spreadsheet (https://github.com/PHPOffice/Spreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -class HTML extends BaseWriter implements IWriter +class Html extends BaseWriter implements IWriter { /** * Spreadsheet object. diff --git a/src/PhpSpreadsheet/Writer/Pdf/Core.php b/src/PhpSpreadsheet/Writer/Pdf/Core.php index 91fd7aa1..62ca4667 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/Core.php +++ b/src/PhpSpreadsheet/Writer/Pdf/Core.php @@ -24,7 +24,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Pdf; * @copyright Copyright (c) 2006 - 2015 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL */ -abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\HTML +abstract class Core extends \PhpOffice\PhpSpreadsheet\Writer\Html { /** * Temporary storage directory. diff --git a/tests/PhpSpreadsheetTests/IOFactoryTest.php b/tests/PhpSpreadsheetTests/IOFactoryTest.php index 65aa8c43..51787521 100644 --- a/tests/PhpSpreadsheetTests/IOFactoryTest.php +++ b/tests/PhpSpreadsheetTests/IOFactoryTest.php @@ -25,8 +25,8 @@ class IOFactoryTest extends \PHPUnit_Framework_TestCase ['../samples/templates/GnumericTest.gnumeric', 'Gnumeric'], ['../samples/templates/30template.xls', 'Xls'], ['../samples/templates/OOCalcTest.ods', 'Ods'], - ['../samples/templates/SylkTest.slk', 'SYLK'], - ['../samples/templates/Excel2003XMLTest.xml', 'Excel2003XML'], + ['../samples/templates/SylkTest.slk', 'Slk'], + ['../samples/templates/Excel2003XMLTest.xml', 'Xml'], ]; } diff --git a/tests/PhpSpreadsheetTests/Reader/HTMLTest.php b/tests/PhpSpreadsheetTests/Reader/HTMLTest.php index 96196408..03ad95f9 100644 --- a/tests/PhpSpreadsheetTests/Reader/HTMLTest.php +++ b/tests/PhpSpreadsheetTests/Reader/HTMLTest.php @@ -2,7 +2,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Reader; -use PhpOffice\PhpSpreadsheet\Reader\HTML; +use PhpOffice\PhpSpreadsheet\Reader\Html; class HTMLTest extends \PHPUnit_Framework_TestCase {