Standardize writers and readers name to be the format most common extension in CamelCase
This commit is contained in:
parent
1cdc8531b8
commit
031af1e9d2
|
@ -30,11 +30,11 @@ $inputFileName = './sampleData/example1.xls';
|
|||
echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using \PhpOffice\PhpSpreadsheet\Reader\Xls<br />';
|
||||
$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 '<hr />';
|
||||
|
|
|
@ -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,'<br />';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -27,7 +27,7 @@ include 'PHPExcel/IOFactory.php';
|
|||
|
||||
$inputFileType = 'Xls';
|
||||
// $inputFileType = 'Xlsx';
|
||||
// $inputFileType = 'Excel2003XML';
|
||||
// $inputFileType = 'Xml';
|
||||
// $inputFileType = 'Ods';
|
||||
// $inputFileType = 'Gnumeric';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
|
|
|
@ -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
|
||||
<?php
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet);
|
||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet);
|
||||
echo $writer->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)
|
||||
|
|
|
@ -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 (<http://xml.openoffice.org/general.html>), 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.
|
||||
<http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml>
|
||||
|
||||
### 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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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__);
|
||||
|
|
|
@ -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__);
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -48,7 +48,7 @@ $html4 = 'H<sub>2</sub>SO<sub>4</sub> is the chemical formula for Sulphuric acid
|
|||
|
||||
$html5 = '<strong>bold</strong>, <em>italic</em>, <strong><em>bold+italic</em></strong>';
|
||||
|
||||
$wizard = new \PhpOffice\PhpSpreadsheet\Helper\HTML();
|
||||
$wizard = new \PhpOffice\PhpSpreadsheet\Helper\Html();
|
||||
$richText = $wizard->toRichTextObject($html1);
|
||||
|
||||
$spreadsheet->getActiveSheet()
|
||||
|
|
|
@ -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',
|
|
@ -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',
|
||||
|
|
|
@ -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);
|
||||
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);
|
||||
} else {
|
||||
throw new \Exception('Missing extension');
|
||||
}
|
||||
}
|
||||
|
||||
$this->logEndingNotes();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
|
@ -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.
|
|
@ -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.
|
|
@ -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.
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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.
|
|
@ -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.
|
|
@ -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.
|
||||
|
|
|
@ -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'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheetTests\Reader;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Reader\HTML;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
||||
|
||||
class HTMLTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue