| ' . - $cell->getValue() . - ' | ' . PHP_EOL; - } - echo '
| ' . - $objWorksheet->getCellByColumnAndRow($col, $row) - ->getValue() . - ' | ' . PHP_EOL; - } - echo '
| ' . - $objWorksheet->getCell($col . $row) - ->getValue() . - ' | ' . PHP_EOL; - } - echo '
-```
-
-instead of
-
-```html
-
.
-```
-
-You can use the following code to achieve this result:
-
-```php
-$objWriter->setImagesRoot('http://www.example.com');
-```
-
-##### Formula pre-calculation
-
-By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
-
-```php
-$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet);
-$objWriter->setPreCalculateFormulas(false);
-
-$objWriter->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 support to generate only specific parts of the HTML code, which allows you to use these parts in your website.
-
-Supported methods:
-
- - generateHTMLHeader()
- - generateStyles()
- - generateSheetData()
- - generateHTMLFooter()
-
-Here's an example which retrieves all parts independently and merges them into a resulting HTML page:
-
-```php
-generateHTMLHeader();
-?>
-
-
-?>
-
--->
-
-
-generateSheetData();
-echo $objWriter->generateHTMLFooter();
-?>
-```
-
-##### Writing UTF-8 HTML files
-
-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
-$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet);
-$objWriter->setUseBOM(true);
-
-$objWriter->save("05featuredemo.htm");
-```
-
-##### Decimal and thousands separators
-
-See section \PhpOffice\PhpSpreadsheet\Writer\CSV how to control the appearance of these.
-
-### PDF
-
-PhpSpreadsheet allows you to write a spreadsheet into PDF format, for fast distribution of represented data.
-
-__PDF limitations__
-Please note that PDF file format has some limits regarding to styling cells, number formatting, ...
-
-#### \PhpOffice\PhpSpreadsheet\Writer\PDF
-
-PhpSpreadsheet’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering library such as tcPDF, mPDF or DomPDF. You must now install a PDF Rendering library yourself; but PhpSpreadsheet will work with a number of different libraries.
-
-Currently, the following libraries are supported:
-
-Library | Version used for testing | Downloadable from | PhpSpreadsheet Internal Constant
---------|--------------------------|----------------------------------|----------------------------
-tcPDF | 5.9 | http://www.tcpdf.org/ | PDF_RENDERER_TCPDF
-mPDF | 5.4 | http://www.mpdf1.com/mpdf/ | PDF_RENDERER_MPDF
-domPDF | 0.6.0 beta 3 | http://code.google.com/p/dompdf/ | PDF_RENDERER_DOMPDF
-
-The different libraries have different strengths and weaknesses. Some generate better formatted output than others, some are faster or use less memory than others, while some generate smaller .pdf files. It is the developers choice which one they wish to use, appropriate to their own circumstances.
-
-Before instantiating a Writer to generate PDF output, you will need to indicate which Rendering library you are using, and where it is located.
-
-```php
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
-$rendererLibrary = 'mPDF5.4';
-$rendererLibraryPath = dirname(__FILE__).'/../../../libraries/PDF/' . $rendererLibrary;
-
-if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer(
- $rendererName,
- $rendererLibraryPath
- )) {
- die(
- 'Please set the $rendererName and $rendererLibraryPath values' .
- PHP_EOL .
- ' as appropriate for your directory structure'
- );
-}
-```
-
-##### Writing a spreadsheet
-
-Once you have identified the Renderer that you wish to use for PDF generation, you can write a .pdf file using the following code:
-
-```php
-$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\PDF($spreadsheet);
-$objWriter->save("05featuredemo.pdf");
-```
-
-Please note that \PhpOffice\PhpSpreadsheet\Writer\PDF only outputs the first worksheet by default.
-
-##### Write all worksheets
-
-PDF files can contain one or more worksheets. If you want to write all sheets into a single PDF file, use the following code:
-
-```php
-$objWriter->writeAllSheets();
-```
-
-##### Write a specific worksheet
-
-PDF files can contain one or more worksheets. Therefore, you can specify which sheet to write to PDF:
-
-```php
-$objWriter->setSheetIndex(0);
-```
-
-##### Formula pre-calculation
-
-By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
-
-```php
-$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\PDF($spreadsheet);
-$objWriter->setPreCalculateFormulas(false);
-
-$objWriter->save("05featuredemo.pdf");
-```
-
-##### Decimal and thousands separators
-
-See section \PhpOffice\PhpSpreadsheet\Writer\CSV how to control the appearance of these.
-
-### Generating Excel files from templates (read, modify, write)
-
-Readers and writers are the tools that allow you to generate Excel files from templates. This requires less coding effort than generating the Excel file from scratch, especially if your template has many styles, page setup properties, headers etc.
-
-Here is an example how to open a template file, fill in a couple of fields and save it again:
-
-```php
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('template.xlsx');
-
-$objWorksheet = $spreadsheet->getActiveSheet();
-
-$objWorksheet->getCell('A1')->setValue('John');
-$objWorksheet->getCell('A2')->setValue('Smith');
-
-$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
-$objWriter->save('write.xls');
-```
-
-Notice that it is ok to load an xlsx file and generate an xls file.
-
- [21]: http://pear.php.net/package/Spreadsheet_Excel_Writer
- [22]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Credits&referringTitle=Home
diff --git a/docs/Overview/11-Appendices.md b/docs/Overview/11-Appendices.md
deleted file mode 100644
index a777ed48..00000000
--- a/docs/Overview/11-Appendices.md
+++ /dev/null
@@ -1,100 +0,0 @@
-# PhpSpreadsheet Developer Documentation
-
-## Credits
-
-Please refer to the internet page [http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Credits&referringTitle=Home][22] for up-to-date credits.
-
-## Valid array keys for style applyFromArray()
-
-The following table lists the valid array keys for \PhpOffice\PhpSpreadsheet\Style applyFromArray() classes. If the "Maps to property" column maps a key to a setter, the value provided for that key will be applied directly. If the "Maps to property" column maps a key to a getter, the value provided for that key will be applied as another style array.
-
-__\PhpOffice\PhpSpreadsheet\Style__
-
- Array key | Maps to property
- -------------|-------------------
- fill | getFill()
- font | getFont()
- borders | getBorders()
- alignment | getAlignment()
- numberformat | getNumberFormat()
- protection | getProtection()
-
-
-__\PhpOffice\PhpSpreadsheet\Style\Fill__
-
- Array key | Maps to property
- -----------|-------------------
- type | setFillType()
- rotation | setRotation()
- startcolor | getStartColor()
- endcolor | getEndColor()
- color | getStartColor()
-
-
-__\PhpOffice\PhpSpreadsheet\Style\Font__
-
- Array key | Maps to property
- ------------|-------------------
- name | setName()
- bold | setBold()
- italic | setItalic()
- underline | setUnderline()
- strike | setStrikethrough()
- color | getColor()
- size | setSize()
- superScript | setSuperScript()
- subScript | setSubScript()
-
-
-__\PhpOffice\PhpSpreadsheet\Style\Borders__
-
- Array key | Maps to property
- ------------------|-------------------
- allborders | getLeft(); getRight(); getTop(); getBottom()
- left | getLeft()
- right | getRight()
- top | getTop()
- bottom | getBottom()
- diagonal | getDiagonal()
- vertical | getVertical()
- horizontal | getHorizontal()
- diagonaldirection | setDiagonalDirection()
- outline | setOutline()
-
-
-__\PhpOffice\PhpSpreadsheet\Style\Border__
-
- Array key | Maps to property
- ----------|-------------------
- style | setBorderStyle()
- color | getColor()
-
-
-__\PhpOffice\PhpSpreadsheet\Style\Alignment__
-
- Array key | Maps to property
- ------------|-------------------
- horizontal | setHorizontal()
- vertical | setVertical()
- rotation | setTextRotation()
- wrap | setWrapText()
- shrinkToFit | setShrinkToFit()
- indent | setIndent()
-
-
-__\PhpOffice\PhpSpreadsheet\Style\NumberFormat__
-
- Array key | Maps to property
- ----------|-------------------
- code | setFormatCode()
-
-
-__\PhpOffice\PhpSpreadsheet\Style\Protection__
-
- Array key | Maps to property
- ----------|-------------------
- locked | setLocked()
- hidden | setHidden()
-
-
- [22]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Credits&referringTitle=Home
diff --git a/docs/ReadingSpreadsheetFiles/02-Security.md b/docs/ReadingSpreadsheetFiles/02-Security.md
deleted file mode 100644
index 5c31947b..00000000
--- a/docs/ReadingSpreadsheetFiles/02-Security.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# PhpSpreadsheet User Documentation – Reading Spreadsheet Files
-
-
-## Security
-
-XML-based formats such as OfficeOpen XML, Excel2003 XML, OASIS and Gnumeric are susceptible to XML External Entity Processing (XXE) injection attacks (for an explanation of XXE injection see http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html) when reading spreadsheet files. This can lead to:
-
- - Disclosure whether a file is existent
- - Server Side Request Forgery
- - Command Execution (depending on the installed PHP wrappers)
-
-
-To prevent this, PhpSpreadsheet sets `libxml_disable_entity_loader` to `true` for the XML-based Readers by default.
\ No newline at end of file
diff --git a/docs/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md b/docs/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md
deleted file mode 100644
index c3f70110..00000000
--- a/docs/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# PhpSpreadsheet User Documentation – Reading Spreadsheet Files
-
-
-## Loading a Spreadsheet File
-
-The simplest way to load a workbook file is to let PhpSpreadsheet's IO Factory identify the file type and load it, calling the static load() method of the \PhpOffice\PhpSpreadsheet\IOFactory class.
-
-```php
-$inputFileName = './sampleData/example1.xls';
-
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
-```
- > See Examples/Reader/exampleReader01.php for a working example of this code.
-
-The load() method will attempt to identify the file type, and instantiate a loader for that file type; using it to load the file and store the data and any formatting in a `Spreadsheet` object.
-
-The method makes an initial guess at the loader to instantiate based on the file extension; but will test the file before actually executing the load: so if (for example) the file is actually a CSV file or contains HTML markup, but that has been given a .xls extension (quite a common practise), it will reject the Xls loader that it would normally use for a .xls file; and test the file using the other loaders until it finds the appropriate loader, and then use that to read the file.
-
-While easy to implement in your code, and you don't need to worry about the file type; this isn't the most efficient method to load a file; and it lacks the flexibility to configure the loader in any way before actually reading the file into a `Spreadsheet` object.
-
diff --git a/docs/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md b/docs/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md
deleted file mode 100644
index 06a5f6eb..00000000
--- a/docs/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# PhpSpreadsheet User Documentation – Reading Spreadsheet Files
-
-
-## Creating a Reader and Loading a Spreadsheet File
-
-If you know the file type of the spreadsheet file that you need to load, you can instantiate a new reader object for that file type, then use the reader's load() method to read the file to a `Spreadsheet` object. It is possible to instantiate the reader objects for each of the different supported filetype by name. However, you may get unpredictable results if the file isn't of the right type (e.g. it is a CSV with an extension of .xls), although this type of exception should normally be trapped.
-
-```php
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Xls Reader **/
-$objReader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
-// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
-// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Excel2003XML();
-// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Ods();
-// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\SYLK();
-// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric();
-// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\CSV();
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader02.php for a working example of this code.
-
-Alternatively, you can use the IO Factory's createReader() method to instantiate the reader object for you, simply telling it the file type of the reader that you want instantiating.
-
-```php
-$inputFileType = 'Xls';
-// $inputFileType = 'Xlsx';
-// $inputFileType = 'Excel2003XML';
-// $inputFileType = 'Ods';
-// $inputFileType = 'SYLK';
-// $inputFileType = 'Gnumeric';
-// $inputFileType = 'CSV';
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader03.php for a working example of this code.
-
-If you're uncertain of the filetype, you can use the IO Factory's identify() method to identify the reader that you need, before using the createReader() method to instantiate the reader object.
-
-```php
-$inputFileName = './sampleData/example1.xls';
-
-/** Identify the type of $inputFileName **/
-$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($inputFileName);
-/** Create a new Reader of the type that has been identified **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader04.php for a working example of this code.
-
diff --git a/docs/ReadingSpreadsheetFiles/05-Reader-Options.md b/docs/ReadingSpreadsheetFiles/05-Reader-Options.md
deleted file mode 100644
index a1576883..00000000
--- a/docs/ReadingSpreadsheetFiles/05-Reader-Options.md
+++ /dev/null
@@ -1,392 +0,0 @@
-# PhpSpreadsheet User Documentation – Reading Spreadsheet Files
-
-## Spreadsheet Reader Options
-
-Once you have created a reader object for the workbook that you want to load, you have the opportunity to set additional options before executing the load() method.
-
-### Reading Only Data from a Spreadsheet File
-
-If you're only interested in the cell values in a workbook, but don't need any of the cell formatting information, then you can set the reader to read only the data values and any formulae from each cell using the setReadDataOnly() method.
-
-```php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader that we only want to load cell data **/
-$objReader->setReadDataOnly(true);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader05.php for a working example of this code.
-
-It is important to note that Workbooks (and PhpSpreadsheet) store dates and times as simple numeric values: they can only be distinguished from other numeric values by the format mask that is applied to that cell. When setting read data only to true, PhpSpreadsheet doesn't read the cell format masks, so it is not possible to differentiate between dates/times and numbers.
-
-The Gnumeric loader has been written to read the format masks for date values even when read data only has been set to true, so it can differentiate between dates/times and numbers; but this change hasn't yet been implemented for the other readers.
-
-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 |
-Ods | YES | SYLK | NO | Gnumeric | YES |
-CSV | NO | HTML | NO
-
-### Reading Only Named WorkSheets from a File
-
-If your workbook contains a number of worksheets, but you are only interested in reading some of those, then you can use the setLoadSheetsOnly() method to identify those sheets you are interested in reading.
-
-To read a single sheet, you can pass that sheet name as a parameter to the setLoadSheetsOnly() method.
-
-```php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-$sheetname = 'Data Sheet #2';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader of which WorkSheets we want to load **/
-$objReader->setLoadSheetsOnly($sheetname);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader07.php for a working example of this code.
-
-If you want to read more than just a single sheet, you can pass a list of sheet names as an array parameter to the setLoadSheetsOnly() method.
-
-```php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-$sheetnames = array('Data Sheet #1','Data Sheet #3');
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader of which WorkSheets we want to load **/
-$objReader->setLoadSheetsOnly($sheetnames);
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader08.php for a working example of this code.
-
-To reset this option to the default, you can call the setLoadAllSheets() method.
-
-```php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Advise the Reader to load all Worksheets **/
-$objReader->setLoadAllSheets();
-/** Load $inputFileName to a Spreadsheet Object **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader06.php for a working example of this code.
-
-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 |
-Ods | YES | SYLK | NO | Gnumeric | YES |
-CSV | NO | HTML | NO
-
-### Reading Only Specific Columns and Rows from a File (Read Filters)
-
-If you are only interested in reading part of a worksheet, then you can write a filter class that identifies whether or not individual cells should be read by the loader. A read filter must implement the \PhpOffice\PhpSpreadsheet\Reader\IReadFilter interface, and contain a readCell() method that accepts arguments of $column, $row and $worksheetName, and return a boolean true or false that indicates whether a workbook cell identified by those arguments should be read or not.
-
-```php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example1.xls';
-$sheetname = 'Data Sheet #3';
-
-
-/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
-class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
-{
- public function readCell($column, $row, $worksheetName = '') {
- // Read rows 1 to 7 and columns A to E only
- if ($row >= 1 && $row <= 7) {
- if (in_array($column,range('A','E'))) {
- return true;
- }
- }
- return false;
- }
-}
-
-/** Create an Instance of our Read Filter **/
-$filterSubset = new MyReadFilter();
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/** Tell the Reader that we want to use the Read Filter **/
-$objReader->setReadFilter($filterSubset);
-/** Load only the rows and columns that match our filter to Spreadsheet **/
-$spreadsheet = $objReader->load($inputFileName);
-```
- > See Examples/Reader/exampleReader09.php for a working example of this code.
-
-This example is not particularly useful, because it can only be used in a very specific circumstance (when you only want cells in the range A1:E7 from your worksheet. A generic Read Filter would probably be more useful:
-
-```php
-/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
-class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
-{
- private $_startRow = 0;
- private $_endRow = 0;
- private $_columns = array();
-
- /** Get the list of rows and columns to read */
- public function __construct($startRow, $endRow, $columns) {
- $this->_startRow = $startRow;
- $this->_endRow = $endRow;
- $this->_columns = $columns;
- }
-
- public function readCell($column, $row, $worksheetName = '') {
- // Only read the rows and columns that were configured
- if ($row >= $this->_startRow && $row <= $this->_endRow) {
- if (in_array($column,$this->_columns)) {
- return true;
- }
- }
- return false;
- }
-}
-
-/** Create an Instance of our Read Filter, passing in the cell range **/
-$filterSubset = new MyReadFilter(9,15,range('G','K'));
-```
- > See Examples/Reader/exampleReader10.php for a working example of this code.
-
-This can be particularly useful for conserving memory, by allowing you to read and process a large workbook in “chunks”: an example of this usage might be when transferring data from an Excel worksheet to a database.
-
-```php
-$inputFileType = 'Xls';
-$inputFileName = './sampleData/example2.xls';
-
-
-/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
-class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
-{
- private $_startRow = 0;
- private $_endRow = 0;
-
- /** Set the list of rows that we want to read */
- public function setRows($startRow, $chunkSize) {
- $this->_startRow = $startRow;
- $this->_endRow = $startRow + $chunkSize;
- }
-
- public function readCell($column, $row, $worksheetName = '') {
- // Only read the heading row, and the configured rows
- if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
- return true;
- }
- return false;
- }
-}
-
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-
-
-/** Define how many rows we want to read for each "chunk" **/
-$chunkSize = 2048;
-/** Create a new Instance of our Read Filter **/
-$chunkFilter = new chunkReadFilter();
-
-/** Tell the Reader that we want to use the Read Filter **/
-$objReader->setReadFilter($chunkFilter);
-
-/** Loop to read our worksheet in "chunk size" blocks **/
-for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) {
- /** Tell the Read Filter which rows we want this iteration **/
- $chunkFilter->setRows($startRow,$chunkSize);
- /** Load only the rows that match our filter **/
- $spreadsheet = $objReader->load($inputFileName);
- // Do some processing here
-}
-```
- > See Examples/Reader/exampleReader12.php for a working example of this code.
-
-Using Read Filters applies to:
-
-Reader | Y/N |Reader | Y/N |Reader | Y/N |
-----------|:---:|--------|:---:|--------------|:---:|
-Xlsx | YES | Xls | YES | Excel2003XML | YES |
-Ods | YES | SYLK | NO | Gnumeric | YES |
-CSV | YES | HTML | NO
-
-### Combining Multiple Files into a Single Spreadsheet Object
-
-While you can limit the number of worksheets that are read from a workbook file using the setLoadSheetsOnly() method, certain readers also allow you to combine several individual "sheets" from different files into a single `Spreadsheet` object, where each individual file is a single worksheet within that workbook. For each file that you read, you need to indicate which worksheet index it should be loaded into using the setSheetIndex() method of the $objReader, then use the loadIntoExisting() method rather than the load() method to actually read the file into that worksheet.
-
-```php
-$inputFileType = 'CSV';
-$inputFileNames = array('./sampleData/example1.csv',
- './sampleData/example2.csv'
- './sampleData/example3.csv'
-);
-
-/** Create a new Reader of the type defined in $inputFileType **/
-$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-
-
-/** Extract the first named file from the array list **/
-$inputFileName = array_shift($inputFileNames);
-/** Load the initial file to the first worksheet in a `Spreadsheet` Object **/
-$spreadsheet = $objReader->load($inputFileName);
-/** Set the worksheet title (to the filename that we've loaded) **/
-$spreadsheet->getActiveSheet()
- ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
-
-
-/** Loop through all the remaining files in the list **/
-foreach($inputFileNames as $sheet => $inputFileName) {
- /** Increment the worksheet index pointer for the Reader **/
- $objReader->setSheetIndex($sheet+1);
- /** Load the current file into a new worksheet in Spreadsheet **/
- $objReader->loadIntoExisting($inputFileName,$spreadsheet);
- /** Set the worksheet title (to the filename that we've loaded) **/
- $spreadsheet->getActiveSheet()
- ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
-}
-```
- > See Examples/Reader/exampleReader13.php for a working example of this code.
-
-Note that using the same sheet index for multiple sheets won't append files into the same sheet, but overwrite the results of the previous load. You cannot load multiple CSV files into the same worksheet.
-
-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 |
-Ods | NO | SYLK | YES | Gnumeric | NO |
-CSV | YES | HTML | NO
-
-### Combining Read Filters with the setSheetIndex() method to split a large CSV file across multiple Worksheets
-
-An Xls BIFF .xls file is limited to 65536 rows in a worksheet, while the Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to 1,048,576 rows in a worksheet; but a CSV file is not limited other than by available disk space. This means that we wouldn’t ordinarily be able to read all the rows from a very large CSV file that exceeded those limits, and save it as an Xls or Xlsx file. However, by using Read Filters to read the CSV file in “chunks” (using the chunkReadFilter Class that we defined in section REF _Ref275604563 \r \p 5.3 above), and the setSheetIndex() method of the $objReader, we can split the CSV file across several individual worksheets.
-
-```php
-$inputFileType = 'CSV';
-$inputFileName = './sampleData/example2.csv';
-
-
-echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'| ' . + $cell->getValue() . + ' | ' . PHP_EOL; + } + echo '
| ' . + $objWorksheet->getCellByColumnAndRow($col, $row) + ->getValue() . + ' | ' . PHP_EOL; + } + echo '
| ' . + $objWorksheet->getCell($col . $row) + ->getValue() . + ' | ' . PHP_EOL; + } + echo '
+```
+
+instead of
+
+```html
+
.
+```
+
+You can use the following code to achieve this result:
+
+```php
+$objWriter->setImagesRoot('http://www.example.com');
+```
+
+#### Formula pre-calculation
+
+By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
+
+```php
+$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet);
+$objWriter->setPreCalculateFormulas(false);
+
+$objWriter->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 support to generate only specific parts of the HTML code, which allows you to use these parts in your website.
+
+Supported methods:
+
+ - generateHTMLHeader()
+ - generateStyles()
+ - generateSheetData()
+ - generateHTMLFooter()
+
+Here's an example which retrieves all parts independently and merges them into a resulting HTML page:
+
+```php
+generateHTMLHeader();
+?>
+
+
+?>
+
+-->
+
+
+generateSheetData();
+echo $objWriter->generateHTMLFooter();
+?>
+```
+
+#### Writing UTF-8 HTML files
+
+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
+$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\HTML($spreadsheet);
+$objWriter->setUseBOM(true);
+
+$objWriter->save("05featuredemo.htm");
+```
+
+#### Decimal and thousands separators
+
+See section \PhpOffice\PhpSpreadsheet\Writer\CSV how to control the appearance of these.
+
+## PDF
+
+PhpSpreadsheet allows you to write a spreadsheet into PDF format, for fast distribution of represented data.
+
+__PDF limitations__
+Please note that PDF file format has some limits regarding to styling cells, number formatting, ...
+
+### \PhpOffice\PhpSpreadsheet\Writer\PDF
+
+PhpSpreadsheet’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering library such as tcPDF, mPDF or DomPDF. You must now install a PDF Rendering library yourself; but PhpSpreadsheet will work with a number of different libraries.
+
+Currently, the following libraries are supported:
+
+Library | Version used for testing | Downloadable from | PhpSpreadsheet Internal Constant
+--------|--------------------------|----------------------------------|----------------------------
+tcPDF | 5.9 | http://www.tcpdf.org/ | PDF_RENDERER_TCPDF
+mPDF | 5.4 | http://www.mpdf1.com/mpdf/ | PDF_RENDERER_MPDF
+domPDF | 0.6.0 beta 3 | http://code.google.com/p/dompdf/ | PDF_RENDERER_DOMPDF
+
+The different libraries have different strengths and weaknesses. Some generate better formatted output than others, some are faster or use less memory than others, while some generate smaller .pdf files. It is the developers choice which one they wish to use, appropriate to their own circumstances.
+
+Before instantiating a Writer to generate PDF output, you will need to indicate which Rendering library you are using, and where it is located.
+
+```php
+$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
+$rendererLibrary = 'mPDF5.4';
+$rendererLibraryPath = dirname(__FILE__).'/../../../libraries/PDF/' . $rendererLibrary;
+
+if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'Please set the $rendererName and $rendererLibraryPath values' .
+ PHP_EOL .
+ ' as appropriate for your directory structure'
+ );
+}
+```
+
+#### Writing a spreadsheet
+
+Once you have identified the Renderer that you wish to use for PDF generation, you can write a .pdf file using the following code:
+
+```php
+$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\PDF($spreadsheet);
+$objWriter->save("05featuredemo.pdf");
+```
+
+Please note that \PhpOffice\PhpSpreadsheet\Writer\PDF only outputs the first worksheet by default.
+
+#### Write all worksheets
+
+PDF files can contain one or more worksheets. If you want to write all sheets into a single PDF file, use the following code:
+
+```php
+$objWriter->writeAllSheets();
+```
+
+#### Write a specific worksheet
+
+PDF files can contain one or more worksheets. Therefore, you can specify which sheet to write to PDF:
+
+```php
+$objWriter->setSheetIndex(0);
+```
+
+#### Formula pre-calculation
+
+By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
+
+```php
+$objWriter = new \PhpOffice\PhpSpreadsheet\Writer\PDF($spreadsheet);
+$objWriter->setPreCalculateFormulas(false);
+
+$objWriter->save("05featuredemo.pdf");
+```
+
+#### Decimal and thousands separators
+
+See section \PhpOffice\PhpSpreadsheet\Writer\CSV how to control the appearance of these.
+
+## Generating Excel files from templates (read, modify, write)
+
+Readers and writers are the tools that allow you to generate Excel files from templates. This requires less coding effort than generating the Excel file from scratch, especially if your template has many styles, page setup properties, headers etc.
+
+Here is an example how to open a template file, fill in a couple of fields and save it again:
+
+```php
+$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('template.xlsx');
+
+$objWorksheet = $spreadsheet->getActiveSheet();
+
+$objWorksheet->getCell('A1')->setValue('John');
+$objWorksheet->getCell('A2')->setValue('Smith');
+
+$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$objWriter->save('write.xls');
+```
+
+Notice that it is ok to load an xlsx file and generate an xls file.
+
+
+# Credits
+
+Please refer to the internet page [contributor list](https://github.com/PHPOffice/PhpSpreadsheet/graphs/contributors) for up-to-date credits.
diff --git a/docs/Functions/Features-cross-reference.md b/docs/references/features-cross-reference.md
similarity index 100%
rename from docs/Functions/Features-cross-reference.md
rename to docs/references/features-cross-reference.md
diff --git a/docs/Functions/Function-list-by-category.md b/docs/references/function-list-by-category.md
similarity index 100%
rename from docs/Functions/Function-list-by-category.md
rename to docs/references/function-list-by-category.md
diff --git a/docs/Functions/Function-list-by-name.md b/docs/references/function-list-by-name.md
similarity index 100%
rename from docs/Functions/Function-list-by-name.md
rename to docs/references/function-list-by-name.md
diff --git a/docs/topics/autofilters.md b/docs/topics/autofilters.md
new file mode 100644
index 00000000..1fc0495e
--- /dev/null
+++ b/docs/topics/autofilters.md
@@ -0,0 +1,433 @@
+# AutoFilter Reference
+
+
+## Introduction
+
+Each worksheet in an Excel Workbook can contain a single autoFilter range. Filtered data displays only the rows that meet criteria that you specify and hides rows that you do not want displayed. You can filter by more than one column: filters are additive, which means that each additional filter is based on the current filter and further reduces the subset of data.
+
+
+
+When an AutoFilter is applied to a range of cells, the first row in an autofilter range will be the heading row, which displays the autoFilter dropdown icons. It is not part of the actual autoFiltered data. All subsequent rows are the autoFiltered data. So an AutoFilter range should always contain the heading row and one or more data rows (one data row is pretty meaningless), but PhpSpreadsheet won't actually stop you specifying a meaningless range: it's up to you as a developer to avoid such errors.
+
+To determine if a filter is applied, note the icon in the column heading. A drop-down arrow () means that filtering is enabled but not applied. In MS Excel, when you hover over the heading of a column with filtering enabled but not applied, a screen tip displays the cell text for the first row in that column, and the message "(Showing All)".
+
+
+
+
+A Filter button () means that a filter is applied. When you hover over the heading of a filtered column, a screen tip displays the filter that has been applied to that column, such as "Equals a red cell color" or "Larger than 150".
+
+
+
+
+## Setting an AutoFilter area on a worksheet
+
+To set an autoFilter on a range of cells.
+
+```php
+$spreadsheet->getActiveSheet()->setAutoFilter('A1:E20');
+```
+
+The first row in an autofilter range will be the heading row, which displays the autoFilter dropdown icons. It is not part of the actual autoFiltered data. All subsequent rows are the autoFiltered data. So an AutoFilter range should always contain the heading row and one or more data rows (one data row is pretty meaningless, but PhpSpreadsheet won't actually stop you specifying a meaningless range: it's up to you as a developer to avoid such errors.
+
+If you want to set the whole worksheet as an autofilter region
+
+```php
+$spreadsheet->getActiveSheet()->setAutoFilter(
+ $spreadsheet->getActiveSheet()
+ ->calculateWorksheetDimension()
+);
+```
+
+This enables filtering, but does not actually apply any filters.
+
+
+## Autofilter Expressions
+
+PHPEXcel 1.7.8 introduced the ability to actually create, read and write filter expressions; initially only for Xlsx files, but later releases will extend this to other formats.
+
+To apply a filter expression to an autoFilter range, you first need to identify which column you're going to be applying this filter to.
+
+```php
+$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter();
+$columnFilter = $autoFilter->getColumn('C');
+```
+
+This returns an autoFilter column object, and you can then apply filter expressions to that column.
+
+There are a number of different types of autofilter expressions. The most commonly used are:
+
+ - Simple Filters
+ - DateGroup Filters
+ - Custom filters
+ - Dynamic Filters
+ - Top Ten Filters
+
+These different types are mutually exclusive within any single column. You should not mix the different types of filter in the same column. PhpSpreadsheet will not actively prevent you from doing this, but the results are unpredictable.
+
+Other filter expression types (such as cell colour filters) are not yet supported.
+
+
+### Simple filters
+
+In MS Excel, Simple Filters are a dropdown list of all values used in that column, and the user can select which ones they want to display and which ones they want to hide by ticking and unticking the checkboxes alongside each option. When the filter is applied, rows containing the checked entries will be displayed, rows that don't contain those values will be hidden.
+
+
+
+To create a filter expression, we need to start by identifying the filter type. In this case, we're just going to specify that this filter is a standard filter.
+
+```php
+$columnFilter->setFilterType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER
+);
+```
+
+Now we've identified the filter type, we can create a filter rule and set the filter values:
+
+When creating a simple filter in PhpSpreadsheet, you only need to specify the values for "checked" columns: you do this by creating a filter rule for each value.
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'France'
+ );
+
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'Germany'
+ );
+```
+
+This creates two filter rules: the column will be filtered by values that match “France” OR “Germany”. For Simple Filters, you can create as many rules as you want
+
+Simple filters are always a comparison match of EQUALS, and multiple standard filters are always treated as being joined by an OR condition.
+
+#### Matching Blanks
+
+If you want to create a filter to select blank cells, you would use:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ ''
+ );
+```
+
+### DateGroup Filters
+
+In MS Excel, DateGroup filters provide a series of dropdown filter selectors for date values, so you can specify entire years, or months within a year, or individual days within each month.
+
+
+
+DateGroup filters are still applied as a Standard Filter type.
+
+```php
+$columnFilter->setFilterType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER
+);
+```
+
+Creating a dateGroup filter in PhpSpreadsheet, you specify the values for "checked" columns as an associative array of year. month, day, hour minute and second. To select a year and month, you need to create a DateGroup rule identifying the selected year and month:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ array(
+ 'year' => 2012,
+ 'month' => 1
+ )
+ )
+ ->setRuleType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP
+ );
+```
+
+The key values for the associative array are:
+
+ - year
+ - month
+ - day
+ - hour
+ - minute
+ - second
+
+Like Standard filters, DateGroup filters are always a match of EQUALS, and multiple standard filters are always treated as being joined by an OR condition.
+
+Note that we alse specify a ruleType: to differentiate this from a standard filter, we explicitly set the Rule's Type to AUTOFILTER_RULETYPE_DATEGROUP. As with standard filters, we can create any number of DateGroup Filters.
+
+
+### Custom filters
+
+In MS Excel, Custom filters allow us to select more complex conditions using an operator as well as a value. Typical examples might be values that fall within a range (e.g. between -20 and +20), or text values with wildcards (e.g. beginning with the letter U). To handle this, they
+
+
+
+
+
+Custom filters are limited to 2 rules, and these can be joined using either an AND or an OR.
+
+We start by specifying a Filter type, this time a CUSTOMFILTER.
+
+```php
+$columnFilter->setFilterType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER
+);
+```
+
+And then define our rules.
+
+The following shows a simple wildcard filter to show all column entries beginning with the letter 'U'.
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'U*'
+ )
+ ->setRuleType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
+ );
+```
+
+MS Excel uses \* as a wildcard to match any number of characters, and ? as a wildcard to match a single character. 'U\*' equates to "begins with a 'U'"; '\*U' equates to "ends with a 'U'"; and '\*U\*' equates to "contains a 'U'"
+
+If you want to match explicitly against a \* or a ? character, you can escape it with a tilde (~), so ?~\*\* would explicitly match for a \* character as the second character in the cell value, followed by any number of other characters. The only other character that needs escaping is the ~ itself.
+
+To create a "between" condition, we need to define two rules:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
+ -20
+ )
+ ->setRuleType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
+ );
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
+ 20
+ )
+ ->setRuleType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
+ );
+```
+
+We also set the rule type to CUSTOMFILTER.
+
+This defined two rules, filtering numbers that are >= -20 OR <= 20, so we also need to modify the join condition to reflect AND rather than OR.
+
+```php
+$columnFilter->setAndOr(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_ANDOR_AND
+);
+```
+
+The valid set of operators for Custom Filters are defined in the \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule class, and comprise:
+
+Operator Constant | Value
+------------------------------------------|----------------------
+AUTOFILTER_COLUMN_RULE_EQUAL | 'equal'
+AUTOFILTER_COLUMN_RULE_NOTEQUAL | 'notEqual'
+AUTOFILTER_COLUMN_RULE_GREATERTHAN | 'greaterThan'
+AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL | 'greaterThanOrEqual'
+AUTOFILTER_COLUMN_RULE_LESSTHAN | 'lessThan'
+AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL | 'lessThanOrEqual'
+
+
+### Dynamic Filters
+
+Dynamic Filters are based on a dynamic comparison condition, where the value we're comparing against the cell values is variable, such as 'today'; or when we're testing against an aggregate of the cell data (e.g. 'aboveAverage'). Only a single dynamic filter can be applied to a column at a time.
+
+
+
+Again, we start by specifying a Filter type, this time a DYNAMICFILTER.
+
+```php
+$columnFilter->setFilterType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER
+);
+```
+
+When defining the rule for a dynamic filter, we don't define a value (we can simply set that to NULL) but we do specify the dynamic filter category.
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ NULL,
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
+ )
+ ->setRuleType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER
+ );
+```
+
+We also set the rule type to DYNAMICFILTER.
+
+The valid set of dynamic filter categories is defined in the \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule class, and comprises:
+
+Operator Constant | Value
+-----------------------------------------|----------------
+AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY | 'yesterday'
+AUTOFILTER_RULETYPE_DYNAMIC_TODAY | 'today'
+AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW | 'tomorrow'
+AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE | 'yearToDate'
+AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR | 'thisYear'
+AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER | 'thisQuarter'
+AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH | 'thisMonth'
+AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK | 'thisWeek'
+AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR | 'lastYear'
+AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER | 'lastQuarter'
+AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH | 'lastMonth'
+AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK | 'lastWeek'
+AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR | 'nextYear'
+AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER | 'nextQuarter'
+AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH | 'nextMonth'
+AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK | 'nextWeek'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 | 'M1'
+AUTOFILTER_RULETYPE_DYNAMIC_JANUARY | 'M1'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 | 'M2'
+AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY | 'M2'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 | 'M3'
+AUTOFILTER_RULETYPE_DYNAMIC_MARCH | 'M3'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 | 'M4'
+AUTOFILTER_RULETYPE_DYNAMIC_APRIL | 'M4'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 | 'M5'
+AUTOFILTER_RULETYPE_DYNAMIC_MAY | 'M5'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 | 'M6'
+AUTOFILTER_RULETYPE_DYNAMIC_JUNE | 'M6'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 | 'M7'
+AUTOFILTER_RULETYPE_DYNAMIC_JULY | 'M7'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 | 'M8'
+AUTOFILTER_RULETYPE_DYNAMIC_AUGUST | 'M8'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 | 'M9'
+AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER | 'M9'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 | 'M10'
+AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER | 'M10'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 | 'M11'
+AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER | 'M11'
+AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 | 'M12'
+AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER | 'M12'
+AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 | 'Q1'
+AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 | 'Q2'
+AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 | 'Q3'
+AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 | 'Q4'
+AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE | 'aboveAverage'
+AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE | 'belowAverage'
+
+We can only apply a single Dynamic Filter rule to a column at a time.
+
+
+### Top Ten Filters
+
+Top Ten Filters are similar to Dynamic Filters in that they are based on a summarisation of the actual data values in the cells. However, unlike Dynamic Filters where you can only select a single option, Top Ten Filters allow you to select based on a number of criteria:
+
+
+
+
+
+You can identify whether you want the top (highest) or bottom (lowest) values.You can identify how many values you wish to select in the filterYou can identify whether this should be a percentage or a number of items.
+
+Like Dynamic Filters, only a single Top Ten filter can be applied to a column at a time.
+
+We start by specifying a Filter type, this time a DYNAMICFILTER.
+
+```php
+$columnFilter->setFilterType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER
+);
+```
+
+Then we create the rule:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
+ 5,
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP
+ )
+ ->setRuleType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_TOPTENFILTER
+ );
+```
+
+This will filter the Top 5 percent of values in the column.
+
+To specify the lowest (bottom 2 values), we would specify a rule of:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
+ 5,
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
+ )
+ ->setRuleType(
+ \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_TOPTENFILTER
+ );
+```
+
+The option values for TopTen Filters top/bottom value/percent are all defined in the \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule class, and comprise:
+
+Operator Constant | Value
+---------------------------------------|-------------
+AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE | 'byValue'
+AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT | 'byPercent'
+
+and
+
+Operator Constant | Value
+-------------------------------------|----------
+AUTOFILTER_COLUMN_RULE_TOPTEN_TOP | 'top'
+AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM | 'bottom'
+
+## Executing an AutoFilter
+
+When an autofilter is applied in MS Excel, it sets the row hidden/visible flags for each row of the autofilter area based on the selected criteria, so that only those rows that match the filter criteria are displayed.
+
+PhpSpreadsheet will not execute the equivalent function automatically when you set or change a filter expression, but only when the file is saved.
+
+### Applying the Filter
+
+If you wish to execute your filter from within a script, you need to do this manually. You can do this using the autofilters showHideRows() method.
+
+```php
+$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter();
+$autoFilter->showHideRows();
+```
+
+This will set all rows that match the filter criteria to visible, while hiding all other rows within the autofilter area.
+
+### Displaying Filtered Rows
+
+Simply looping through the rows in an autofilter area will still access ever row, whether it matches the filter criteria or not. To selectively access only the filtered rows, you need to test each row’s visibility settings.
+
+```php
+foreach ($spreadsheet->getActiveSheet()->getRowIterator() as $row) {
+ if ($spreadsheet->getActiveSheet()
+ ->getRowDimension($row->getRowIndex())->getVisible()) {
+ echo ' Row number - ' , $row->getRowIndex() , ' ';
+ echo $spreadsheet->getActiveSheet()
+ ->getCell(
+ 'C'.$row->getRowIndex()
+ )
+ ->getValue(), ' ';
+ echo $spreadsheet->getActiveSheet()
+ ->getCell(
+ 'D'.$row->getRowIndex()
+ )->getFormattedValue(), ' ';
+ echo EOL;
+ }
+}
+```
+
+## AutoFilter Sorting
+
+In MS Excel, Autofiltering also allows the rows to be sorted. This feature is ***not*** supported by PhpSpreadsheet.
+
diff --git a/docs/topics/calculation-engine.md b/docs/topics/calculation-engine.md
new file mode 100644
index 00000000..f97d40d0
--- /dev/null
+++ b/docs/topics/calculation-engine.md
@@ -0,0 +1,1792 @@
+# Calculation Engine
+
+## Using the PhpSpreadsheet calculation engine
+
+### Performing formula calculations
+
+As PhpSpreadsheet represents an in-memory spreadsheet, it also offers formula calculation capabilities. A cell can be of a value type (containing a number or text), or a formula type (containing a formula which can be evaluated). For example, the formula "=SUM(A1:A10)" evaluates to the sum of values in A1, A2, ..., A10.
+
+To calculate a formula, you can call the cell containing the formula’s method getCalculatedValue(), for example:
+
+```php
+$spreadsheet->getActiveSheet()->getCell('E11')->getCalculatedValue();
+```
+If you write the following line of code in the invoice demo included with PhpSpreadsheet, it evaluates to the value "64":
+
+
+
+Another nice feature of PhpSpreadsheet's formula parser, is that it can automatically adjust a formula when inserting/removing rows/columns. Here's an example:
+
+
+
+You see that the formula contained in cell E11 is "SUM(E4:E9)". Now, when I write the following line of code, two new product lines are added:
+
+```php
+$spreadsheet->getActiveSheet()->insertNewRowBefore(7, 2);
+```
+
+
+
+Did you notice? The formula in the former cell E11 (now E13, as I inserted 2 new rows), changed to "SUM(E4:E11)". Also, the inserted cells duplicate style information of the previous cell, just like Excel's behaviour. Note that you can both insert rows and columns.
+
+## Known limitations
+
+There are some known limitations to the PhpSpreadsheet calculation engine. Most of them are due to the fact that an Excel formula is converted into PHP code before being executed. This means that Excel formula calculation is subject to PHP's language characteristics.
+
+### Function that are not Supported in Xls
+
+Not all functions are supported, for a comprehensive list, read the [function list by name](../references/function-list-by-name.md).
+
+#### Operator precedence
+
+In Excel '+' wins over '&', just like '*' wins over '+' in ordinary algebra. The former rule is not what one finds using the calculation engine shipped with PhpSpreadsheet.
+
+Reference for operator precedence in Excel: [http://support.microsoft.com/kb/25189](http://support.microsoft.com/kb/25189)
+
+Reference for operator precedence in PHP: [http://www.php.net/operators](http://www.php.net/operators)
+
+#### Formulas involving numbers and text
+
+Formulas involving numbers and text may produce unexpected results or even unreadable file contents. For example, the formula '=3+"Hello "' is expected to produce an error in Excel (#VALUE!). Due to the fact that PHP converts “Hello” to a numeric value (zero), the result of this formula is evaluated as 3 instead of evaluating as an error. This also causes the Excel document being generated as containing unreadable content.
+
+Reference for this behaviour in PHP: [http://php.net/manual/en/language.types.string.php#language.types.string.conversion](http://php.net/manual/en/language.types.string.php#language.types.string.conversion)
+
+#### Formulas don’t seem to be calculated in Excel2003 using compatibility pack?
+
+This is normal behaviour of the compatibility pack, Xlsx displays this correctly. Use \PhpOffice\PhpSpreadsheet\Writer\Xls if you really need calculated values, or force recalculation in Excel2003.
+
+
+## Handling Date and Time Values
+
+### Excel functions that return a Date and Time value
+
+Any of the Date and Time functions that return a date value in Excel can return either an Excel timestamp or a PHP timestamp or date object.
+
+It is possible for scripts to change the data type used for returning date values by calling the \PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType() method:
+
+```php
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($returnDateType);
+```
+
+where the following constants can be used for $returnDateType
+
+ - `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC`
+ - `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_OBJECT`
+ - `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL`
+
+The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in for the return date type).
+
+The \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType() method can be used to determine the current value of this setting:
+
+```php
+$returnDateType = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType();
+```
+
+The default is RETURNDATE_PHP_NUMERIC.
+
+#### PHP Timestamps
+
+If RETURNDATE_PHP_NUMERIC is set for the Return Date Type, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be an integer value that represents the number of seconds from the PHP/Unix base date. The PHP/Unix base date (0) is 00:00 UST on 1st January 1970. This value can be positive or negative: so a value of -3600 would be 23:00 hrs on 31st December 1969; while a value of +3600 would be 01:00 hrs on 1st January 1970. This gives PHP a date range of between 14th December 1901 and 19th January 2038.
+
+#### PHP DateTime Objects
+
+If the Return Date Type is set for RETURNDATE_PHP_NUMERIC, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be a PHP date/time object.
+
+#### Excel Timestamps
+
+If RETURNDATE_EXCEL is set for the Return Date Type, then the returned date value by any access to the Date and Time functions in Excel will be a floating point value that represents a number of days from the Excel base date. The Excel base date is determined by which calendar Excel uses: the Windows 1900 or the Mac 1904 calendar. 1st January 1900 is the base date for the Windows 1900 calendar while 1st January 1904 is the base date for the Mac 1904 calendar.
+
+It is possible for scripts to change the calendar used for calculating Excel date values by calling the \PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar() method:
+
+```php
+\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar($baseDate);
+```
+
+where the following constants can be used for $baseDate
+
+ - \PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900
+ - \PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_MAC_1904
+
+The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in).
+
+The \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar() method can be used to determine the current value of this setting:
+
+```php
+$baseDate = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar();
+```
+The default is CALENDAR_WINDOWS_1900.
+
+#### Functions that return a Date/Time Value
+
+ - DATE
+ - DATEVALUE
+ - EDATE
+ - EOMONTH
+ - NOW
+ - TIME
+ - TIMEVALUE
+ - TODAY
+
+### Excel functions that accept Date and Time values as parameters
+
+Date values passed in as parameters to a function can be an Excel timestamp or a PHP timestamp; or date object; or a string containing a date value (e.g. '1-Jan-2009'). PhpSpreadsheet will attempt to identify their type based on the PHP datatype:
+
+An integer numeric value will be treated as a PHP/Unix timestamp. A real (floating point) numeric value will be treated as an Excel date/timestamp. Any PHP DateTime object will be treated as a DateTime object. Any string value (even one containing straight numeric data) will be converted to a date/time object for validation as a date value based on the server locale settings, so passing through an ambiguous value of '07/08/2008' will be treated as 7th August 2008 if your server settings are UK, but as 8th July 2008 if your server settings are US. However, if you pass through a value such as '31/12/2008' that would be considered an error by a US-based server, but which is not ambiguous, then PhpSpreadsheet will attempt to correct this to 31st December 2008. If the content of the string doesn’t match any of the formats recognised by the php date/time object implementation of strtotime() (which can handle a wider range of formats than the normal strtotime() function), then the function will return a '#VALUE' error. However, Excel recommends that you should always use date/timestamps for your date functions, and the recommendation for PhpSpreadsheet is the same: avoid strings because the result is not predictable.
+
+The same principle applies when data is being written to Excel. Cells containing date actual values (rather than Excel functions that return a date value) are always written as Excel dates, converting where necessary. If a cell formatted as a date contains an integer or date/time object value, then it is converted to an Excel value for writing: if a cell formatted as a date contains a real value, then no conversion is required. Note that string values are written as strings rather than converted to Excel date timestamp values.
+
+#### Functions that expect a Date/Time Value
+
+ - DATEDIF
+ - DAY
+ - DAYS360
+ - EDATE
+ - EOMONTH
+ - HOUR
+ - MINUTE
+ - MONTH
+ - NETWORKDAYS
+ - SECOND
+ - WEEKDAY
+ - WEEKNUM
+ - WORKDAY
+ - YEAR
+ - YEARFRAC
+
+### Helper Methods
+
+In addition to the setExcelCalendar() and getExcelCalendar() methods, a number of other methods are available in the \PhpOffice\PhpSpreadsheet\Shared\Date class that can help when working with dates:
+
+#### \PhpOffice\PhpSpreadsheet\Shared\Date::ExcelToPHP($excelDate)
+
+Converts a date/time from an Excel date timestamp to return a PHP serialized date/timestamp.
+
+Note that this method does not trap for Excel dates that fall outside of the valid range for a PHP date timestamp.
+
+#### \PhpOffice\PhpSpreadsheet\Shared\Date::ExcelToPHPObject($excelDate)
+
+Converts a date from an Excel date/timestamp to return a PHP DateTime object.
+
+#### \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDate)
+
+Converts a PHP serialized date/timestamp or a PHP DateTime object to return an Excel date timestamp.
+
+#### \PhpOffice\PhpSpreadsheet\Shared\Date::FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0)
+
+Takes year, month and day values (and optional hour, minute and second values) and returns an Excel date timestamp value.
+
+
+## Function Reference
+
+### Database Functions
+
+#### DAVERAGE
+
+The DAVERAGE function returns the average value of the cells in a column of a list or database that match conditions you specify.
+
+##### Syntax
+
+```
+DAVERAGE (database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The average value of the matching cells.
+
+This is the statistical mean.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 12
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DCOUNT
+
+The DCOUNT function returns the count of cells that contain a number in a column of a list or database matching conditions that you specify.
+
+##### Syntax
+
+```
+DCOUNT(database, [field], criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The count of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DCOUNT(A4:E10,"Height",A1:B3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+
+// $retVal = 3
+```
+
+##### Notes
+
+In MS Excel, The field argument is optional. If field is omitted, DCOUNT counts all records in the database that match the criteria. This logic has not yet been implemented in PhpSpreadsheet.
+
+#### DCOUNTA
+
+The DCOUNT function returns the count of cells that aren’t blank in a column of a list or database and that match conditions that you specify.
+
+##### Syntax
+
+```
+DCOUNTA(database, [field], criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The count of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DCOUNTA(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+
+// $retVal = 5
+```
+
+##### Notes
+
+In MS Excel, The field argument is optional. If field is omitted, DCOUNTA counts all records in the database that match the criteria. This logic has not yet been implemented in PhpSpreadsheet.
+
+#### DGET
+
+The DGET function extracts a single value from a column of a list or database that matches conditions that you specify.
+
+##### Syntax
+
+```
+DGET(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**mixed** The value from the selected column of the matching row.
+
+#### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 14
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DMAX
+
+The DMAX function returns the largest number in a column of a list or database that matches conditions you specify.
+
+##### Syntax
+
+```
+DMAX(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The maximum value of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DMAX(A4:E10,"Profit",A1:B2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 105
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DMIN
+
+The DMIN function returns the smallest number in a column of a list or database that matches conditions you specify.
+
+##### Syntax
+
+```
+DMIN(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The minimum value of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 6
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DPRODUCT
+
+The DPRODUCT function multiplies the values in a column of a list or database that match conditions that you specify.
+
+##### Syntax
+
+```
+DPRODUCT(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The product of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 140
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DSTDEV
+
+The DSTDEV function estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.
+
+##### Syntax
+
+```
+DSTDEV(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The estimated standard deviation of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 2.97
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DSTDEVP
+
+The DSTDEVP function calculates the standard deviation of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.
+
+##### Syntax
+
+```
+DSTDEVP(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The estimated standard deviation of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 2.65
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DSUM
+
+The DSUM function adds the numbers in a column of a list or database that matches conditions you specify.
+
+##### Syntax
+
+```
+DSUM(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The total value of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Profit",A1:A2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 225
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DVAR
+
+Not yet documented.
+
+#### DVARP
+
+Not yet documented.
+
+
+
+### Date and Time Functions
+
+Excel provides a number of functions for the manipulation of dates and times, and calculations based on date/time values. it is worth spending some time reading the section titled "Date and Time Values" on passing date parameters and returning date values to understand how PhpSpreadsheet reconciles the differences between dates and times in Excel and in PHP.
+
+#### DATE
+
+The DATE function returns an Excel timestamp or a PHP timestamp or date object representing the date that is referenced by the parameters.
+
+##### Syntax
+
+```
+DATE(year, month, day)
+```
+
+##### Parameters
+
+**year** The year number.
+
+If this value is between 0 (zero) and 1899 inclusive (for the Windows 1900 calendar), or between 4 and 1903 inclusive (for the Mac 1904), then PhpSpreadsheet adds it to the Calendar base year, so a value of 108 will interpret the year as 2008 when using the Windows 1900 calendar, or 2012 when using the Mac 1904 calendar.
+
+**month** The month number.
+
+If this value is greater than 12, the DATE function adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns a value representing February 2, 2009.
+
+If the value of __month__ is less than 1, then that value will be adjusted by -1, and that will then be subtracted from the first month of the year specified. For example, DATE(2008,0,2) returns a value representing December 2, 2007; while DATE(2008,-1,2) returns a value representing November 2, 2007.
+
+**day** The day number.
+
+If this value is greater than the number of days in the month (and year) specified, the DATE function adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns a value representing February 4, 2008.
+
+If the value of __day__ is less than 1, then that value will be adjusted by -1, and that will then be subtracted from the first month of the year specified. For example, DATE(2008,3,0) returns a value representing February 29, 2008; while DATE(2008,3,-2) returns a value representing February 27, 2008.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the given date.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Year')
+ ->setCellValue('A2', 'Month')
+ ->setCellValue('A3', 'Day');
+
+$worksheet->setCellValue('B1', 2008)
+ ->setCellValue('B2', 12)
+ ->setCellValue('B3', 31);
+
+$worksheet->setCellValue('D1', '=DATE(B1,B2,B3)');
+
+$retVal = $worksheet->getCell('D1')->getCalculatedValue();
+// $retVal = 1230681600
+```
+
+```php
+// We're going to be calling the same cell calculation multiple times,
+// and expecting different return values, so disable calculation cacheing
+\PhpOffice\PhpSpreadsheet\Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
+
+$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType();
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'),
+ array(2008, 12, 31)
+);
+// $retVal = 39813.0
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC
+);
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'),
+ array(2008, 12, 31)
+);
+// $retVal = 1230681600
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($saveFormat);
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DATEDIF
+
+The DATEDIF function computes the difference between two dates in a variety of different intervals, such number of years, months, or days.
+
+##### Syntax
+
+```
+DATEDIF(date1, date2 [, unit])
+```
+
+##### Parameters
+
+**date1** First Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**date2** Second Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**unit** The interval type to use for the calculation
+
+This is a string, comprising one of the values listed below:
+
+Unit | Meaning | Description
+-----|---------------------------------|--------------------------------
+m | Months | Complete calendar months between the dates.
+d | Days | Number of days between the dates.
+y | Years | Complete calendar years between the dates.
+ym | Months Excluding Years | Complete calendar months between the dates as if they were of the same year.
+yd | Days Excluding Years | Complete calendar days between the dates as if they were of the same year.
+md | Days Excluding Years And Months | Complete calendar days between the dates as if they were of the same month and same year.
+
+The unit value is not case sensitive, and defaults to "d".
+
+##### Return Value
+
+**integer** An integer value that reflects the difference between the two dates.
+
+This could be the number of full days, months or years between the two dates, depending on the interval unit value passed into the function as the third parameter.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Year')
+ ->setCellValue('A2', 'Month')
+ ->setCellValue('A3', 'Day');
+
+$worksheet->setCellValue('B1', 2001)
+ ->setCellValue('C1', 2009)
+ ->setCellValue('B2', 7)
+ ->setCellValue('C2', 12)
+ ->setCellValue('B3', 1)
+ ->setCellValue('C3', 31);
+
+$worksheet->setCellValue('D1', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"d")')
+ ->setCellValue('D2', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"m")')
+ ->setCellValue('D3', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"y")')
+ ->setCellValue('D4', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"ym")')
+ ->setCellValue('D5', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"yd")')
+ ->setCellValue('D6', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"md")');
+
+$retVal = $worksheet->getCell('D1')->getCalculatedValue();
+// $retVal = 3105
+
+$retVal = $worksheet->getCell('D2')->getCalculatedValue();
+// $retVal = 101
+
+$retVal = $worksheet->getCell('D3')->getCalculatedValue();
+// $retVal = 8
+
+$retVal = $worksheet->getCell('D4')->getCalculatedValue();
+// $retVal = 5
+
+$retVal = $worksheet->getCell('D5')->getCalculatedValue();
+// $retVal = 183
+
+$retVal = $worksheet->getCell('D6')->getCalculatedValue();
+// $retVal = 30
+```
+
+```php
+$date1 = 1193317015; // PHP timestamp for 25-Oct-2007
+$date2 = 1449579415; // PHP timestamp for 8-Dec-2015
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
+ array($date1, $date2, 'd')
+);
+// $retVal = 2966
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
+ array($date1, $date2, 'm')
+);
+// $retVal = 97
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
+ array($date1, $date2, 'y')
+);
+// $retVal = 8
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
+ array($date1, $date2, 'ym')
+);
+// $retVal = 1
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
+ array($date1, $date2, 'yd')
+);
+// $retVal = 44
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
+ array($date1, $date2, 'md')
+);
+// $retVal = 13
+```
+
+##### Notes
+
+If Date1 is later than Date2, DATEDIF will return a #NUM! error.
+
+#### DATEVALUE
+
+The DATEVALUE function returns the date represented by a date formatted as a text string. Use DATEVALUE to convert a date represented by text to a serial number.
+
+##### Syntax
+
+```
+DATEVALUE(dateString)
+```
+
+##### Parameters
+
+**date** Date String.
+
+A string, representing a date value.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the given date.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String');
+ ->setCellValue('A2', '31-Dec-2008')
+ ->setCellValue('A3', '31/12/2008')
+ ->setCellValue('A4', '12-31-2008');
+
+$worksheet->setCellValue('B2', '=DATEVALUE(A2)')
+ ->setCellValue('B3', '=DATEVALUE(A3)')
+ ->setCellValue('B4', '=DATEVALUE(A4)');
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL
+);
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 39813.0 for all cases
+```
+
+```php
+// We're going to be calling the same cell calculation multiple times,
+// and expecting different return values, so disable calculation cacheing
+\PhpOffice\PhpSpreadsheet\Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
+
+$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType();
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'),
+ array('31-Dec-2008')
+);
+// $retVal = 39813.0
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC
+);
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'),
+ array('31-Dec-2008')
+);
+// $retVal = 1230681600
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($saveFormat);
+```
+
+##### Notes
+
+DATEVALUE uses the php date/time object implementation of strtotime() (which can handle a wider range of formats than the normal strtotime() function), and it is also called for any date parameter passed to other date functions (such as DATEDIF) when the parameter value is a string.
+
+__WARNING:-__ PhpSpreadsheet accepts a wider range of date formats than MS Excel, so it is entirely possible that Excel will return a #VALUE! error when passed a date string that it can’t interpret, while PhpSpreadsheet is able to translate that same string into a correct date value.
+
+Care should be taken in workbooks that use string formatted dates in calculations when writing to Xls or Xlsx.
+
+#### DAY
+
+The DAY function returns the day of a date. The day is given as an integer ranging from 1 to 31.
+
+##### Syntax
+
+```
+DAY(datetime)
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the day of the month.
+
+This is an integer ranging from 1 to 31.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '31-Dec-2008')
+ ->setCellValue('A3', '14-Feb-2008');
+
+$worksheet->setCellValue('B2', '=DAY(A2)')
+ ->setCellValue('B3', '=DAY(A3)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 31
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 14
+```
+
+```php
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYOFMONTH'),
+ array('25-Dec-2008')
+);
+// $retVal = 25
+```
+
+##### Notes
+
+Note that the PhpSpreadsheet function is \PhpOffice\PhpSpreadsheet\Calculation\Functions::DAYOFMONTH() when the method is called statically.
+
+#### DAYS360
+
+The DAYS360 function computes the difference between two dates based on a 360 day year (12 equal periods of 30 days each) used by some accounting systems.
+
+##### Syntax
+
+```
+DAYS360(date1, date2 [, method])
+```
+
+#### Parameters
+
+**date1** First Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**date2** Second Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**method** A boolean flag (TRUE or FALSE)
+
+This is a flag that determines which method to use in the calculation, based on the values listed below:
+
+method | Description
+-------|------------
+FALSE | U.S. (NASD) method. If the starting date is the last day of a month, it becomes equal to the 30th of the same month. If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month.
+TRUE | European method. Starting dates and ending dates that occur on the 31st of a month become equal to the 30th of the same month.
+
+The method value defaults to FALSE.
+
+##### Return Value
+
+**integer** An integer value that reflects the difference between the two dates.
+
+This is the number of full days between the two dates, based on a 360 day year.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('B1', 'Start Date')
+ ->setCellValue('C1', 'End Date')
+ ->setCellValue('A2', 'Year')
+ ->setCellValue('A3', 'Month')
+ ->setCellValue('A4', 'Day');
+
+$worksheet->setCellValue('B2', 2003)
+ ->setCellValue('B3', 2)
+ ->setCellValue('B4', 3);
+
+$worksheet->setCellValue('C2', 2007)
+ ->setCellValue('C3', 5)
+ ->setCellValue('C4', 31);
+
+$worksheet->setCellValue('E2', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4))')
+ ->setCellValue('E4', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4),FALSE)');
+
+$retVal = $worksheet->getCell('E2')->getCalculatedValue();
+// $retVal = 1558
+
+$retVal = $worksheet->getCell('E4')->getCalculatedValue();
+// $retVal = 1557
+```
+
+```php
+$date1 = 37655.0; // Excel timestamp for 25-Oct-2007
+$date2 = 39233.0; // Excel timestamp for 8-Dec-2015
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'),
+ array($date1, $date2)
+);
+// $retVal = 1558
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'),
+ array($date1, $date2, TRUE)
+);
+// $retVal = 1557
+```
+
+##### Notes
+
+__WARNING:-__ This function does not currently work with the Xls Writer when a PHP Boolean is used for the third (optional) parameter (as shown in the example above), and the writer will generate and error. It will work if a numeric 0 or 1 is used for the method parameter; or if the Excel TRUE() and FALSE() functions are used instead.
+
+#### EDATE
+
+The EDATE function returns an Excel timestamp or a PHP timestamp or date object representing the date that is the indicated number of months before or after a specified date (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.
+
+##### Syntax
+
+```
+EDATE(baseDate, months)
+```
+
+##### Parameters
+
+**baseDate** Start Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**months** Number of months to add.
+
+An integer value indicating the number of months before or after baseDate. A positive value for months yields a future date; a negative value yields a past date.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the basedate + months.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '1-Jan-2008')
+ ->setCellValue('A3', '29-Feb-2008');
+
+$worksheet->setCellValue('B2', '=EDATE(A2,5)')
+ ->setCellValue('B3', '=EDATE(A3,-12)');
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL
+);
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 39600.0 (1-Jun-2008)
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 39141.0 (28-Feb-2007)
+```
+
+```php
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EDATE'),
+ array('31-Oct-2008',25)
+);
+// $retVal = 40512.0 (30-Nov-2010)
+```
+
+###### Notes
+
+__WARNING:-__ This function is currently not supported by the Xls Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
+
+#### EOMONTH
+
+The EOMONTH function returns an Excel timestamp or a PHP timestamp or date object representing the date of the last day of the month that is the indicated number of months before or after a specified date (the start_date). Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
+
+##### Syntax
+
+```
+EOMONTH(baseDate, months)
+```
+
+##### Parameters
+
+**baseDate** Start Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**months** Number of months to add.
+
+An integer value indicating the number of months before or after baseDate. A positive value for months yields a future date; a negative value yields a past date.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the last day of basedate + months.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '1-Jan-2000')
+ ->setCellValue('A3', '14-Feb-2009');
+
+$worksheet->setCellValue('B2', '=EOMONTH(A2,5)')
+ ->setCellValue('B3', '=EOMONTH(A3,-12)');
+
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL);
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 39629.0 (30-Jun-2008)
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 39507.0 (29-Feb-2008)
+```
+
+```php
+\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(
+ \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EOMONTH'),
+ array('31-Oct-2008',13)
+);
+// $retVal = 40147.0 (30-Nov-2010)
+```
+
+##### Notes
+
+__WARNING:-__ This function is currently not supported by the Xls Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
+
+#### HOUR
+
+The HOUR function returns the hour of a time value. The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
+
+##### Syntax
+
+```
+HOUR(datetime)
+```
+
+##### Parameters
+
+**datetime** Time.
+
+An Excel date/time value, PHP date timestamp, PHP date object, or a date/time represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the hour of the day.
+
+This is an integer ranging from 0 to 23.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Time String')
+ ->setCellValue('A2', '31-Dec-2008 17:30')
+ ->setCellValue('A3', '14-Feb-2008 4:20 AM')
+ ->setCellValue('A4', '14-Feb-2008 4:20 PM');
+
+$worksheet->setCellValue('B2', '=HOUR(A2)')
+ ->setCellValue('B3', '=HOUR(A3)')
+ ->setCellValue('B4', '=HOUR(A4)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 17
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 4
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 16
+```
+
+```php
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'HOUROFDAY'),
+ array('09:30')
+);
+// $retVal = 9
+```
+
+##### Notes
+
+Note that the PhpSpreadsheet function is \PhpOffice\PhpSpreadsheet\Calculation\Functions::HOUROFDAY() when the method is called statically.
+
+#### MINUTE
+
+The MINUTE function returns the minutes of a time value. The minute is given as an integer, ranging from 0 to 59.
+
+##### Syntax
+
+```
+MINUTE(datetime)
+```
+
+##### Parameters
+
+**datetime** Time.
+
+An Excel date/time value, PHP date timestamp, PHP date object, or a date/time represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the minutes within the hour.
+
+This is an integer ranging from 0 to 59.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Time String')
+ ->setCellValue('A2', '31-Dec-2008 17:30')
+ ->setCellValue('A3', '14-Feb-2008 4:20 AM')
+ ->setCellValue('A4', '14-Feb-2008 4:45 PM');
+
+$worksheet->setCellValue('B2', '=MINUTE(A2)')
+ ->setCellValue('B3', '=MINUTE(A3)')
+ ->setCellValue('B4', '=MINUTE(A4)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 30
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 20
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 45
+```
+
+```php
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MINUTE'),
+ array('09:30')
+);
+// $retVal = 30
+```
+
+##### Notes
+
+Note that the PhpSpreadsheet function is \PhpOffice\PhpSpreadsheet\Calculation\Functions::MINUTE() when the method is called statically.
+
+#### MONTH
+
+The MONTH function returns the month of a date. The month is given as an integer ranging from 1 to 12.
+
+##### Syntax
+
+```
+MONTH(datetime)
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the month of the year.
+
+This is an integer ranging from 1 to 12.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String');
+$worksheet->setCellValue('A2', '31-Dec-2008');
+$worksheet->setCellValue('A3', '14-Feb-2008');
+
+$worksheet->setCellValue('B2', '=MONTH(A2)');
+$worksheet->setCellValue('B3', '=MONTH(A3)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 12
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 2
+```
+
+```php
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MONTHOFYEAR'),
+ array('14-July-2008')
+);
+// $retVal = 7
+```
+
+#### Notes
+
+Note that the PhpSpreadsheet function is \PhpOffice\PhpSpreadsheet\Calculation\Functions::MONTHOFYEAR() when the method is called statically.
+
+#### NETWORKDAYS
+
+The NETWORKDAYS function returns the number of whole working days between a *start date* and an *end date*. Working days exclude weekends and any dates identified in *holidays*. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.
+
+##### Syntax
+
+```
+NETWORKDAYS(startDate, endDate [, holidays])
+```
+
+##### Parameters
+
+**startDate** Start Date of the period.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**endDate** End Date of the period.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**holidays** Optional array of Holiday dates.
+
+An optional range of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays.
+
+The list can be either a range of cells that contains the dates or an array constant of Excel date values, PHP date timestamps, PHP date objects, or dates represented as strings.
+
+##### Return Value
+
+**integer** Number of working days.
+
+The number of working days between startDate and endDate.
+
+##### Examples
+
+```php
+```
+
+```php
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### NOW
+
+The NOW function returns the current date and time.
+
+##### Syntax
+
+```
+NOW()
+```
+
+##### Parameters
+
+There are now parameters for the NOW() function.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the current date and time.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
+
+##### Examples
+
+```php
+```
+
+```php
+```
+
+##### Notes
+
+Note that the PhpSpreadsheet function is \PhpOffice\PhpSpreadsheet\Calculation\Functions::DATETIMENOW() when the method is called statically.
+
+#### SECOND
+
+The SECOND function returns the seconds of a time value. The second is given as an integer, ranging from 0 to 59.
+
+##### Syntax
+
+```
+SECOND(datetime)
+```
+
+##### Parameters
+
+**datetime** Time.
+
+An Excel date/time value, PHP date timestamp, PHP date object, or a date/time represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the seconds within the minute.
+
+This is an integer ranging from 0 to 59.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Time String')
+ ->setCellValue('A2', '31-Dec-2008 17:30:20')
+ ->setCellValue('A3', '14-Feb-2008 4:20 AM')
+ ->setCellValue('A4', '14-Feb-2008 4:45:59 PM');
+
+$worksheet->setCellValue('B2', '=SECOND(A2)')
+ ->setCellValue('B3', '=SECOND(A3)');
+ ->setCellValue('B4', '=SECOND(A4)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 20
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 0
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 59
+```
+
+```php
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'SECOND'),
+ array('09:30:17')
+);
+// $retVal = 17
+```
+
+##### Notes
+
+Note that the PhpSpreadsheet function is \PhpOffice\PhpSpreadsheet\Calculation\Functions::SECOND() when the method is called statically.
+
+#### TIME
+
+Not yet documented.
+
+#### TIMEVALUE
+
+Not yet documented.
+
+#### TODAY
+
+Not yet documented.
+
+#### WEEKDAY
+
+The WEEKDAY function returns the day of the week for a given date. The day is given as an integer ranging from 1 to 7, although this can be modified to return a value between 0 and 6.
+
+##### Syntax
+
+```
+WEEKDAY(datetime [, method])
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**method** An integer flag (values 0, 1 or 2)
+
+This is a flag that determines which method to use in the calculation, based on the values listed below:
+
+ method | Description
+ :-----:|------------------------------------------
+ 0 | Returns 1 (Sunday) through 7 (Saturday).
+ 1 | Returns 1 (Monday) through 7 (Sunday).
+ 2 | Returns 0 (Monday) through 6 (Sunday).
+
+The method value defaults to 1.
+
+##### Return Value
+
+**integer** An integer value that reflects the day of the week.
+
+This is an integer ranging from 1 to 7, or 0 to 6, depending on the value of method.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '31-Dec-2008')
+ ->setCellValue('A3', '14-Feb-2008');
+
+$worksheet->setCellValue('B2', '=WEEKDAY(A2)')
+ ->setCellValue('B3', '=WEEKDAY(A3,0)')
+ ->setCellValue('B4', '=WEEKDAY(A3,2)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 12
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 2
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 2
+```
+
+```php
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'WEEKDAY'),
+ array('14-July-2008')
+);
+// $retVal = 7
+```
+
+##### Notes
+
+Note that the PhpSpreadsheet function is \PhpOffice\PhpSpreadsheet\Calculation\Functions::WEEKDAY() when the method is called statically.
+
+#### WEEKNUM
+
+Not yet documented.
+
+#### WORKDAY
+
+Not yet documented.
+
+#### YEAR
+
+The YEAR function returns the year of a date.
+
+##### Syntax
+
+```
+YEAR(datetime)
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the month of the year.
+
+This is an integer year value.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '17-Jul-1982')
+ ->setCellValue('A3', '16-Apr-2009');
+
+$worksheet->setCellValue('B2', '=YEAR(A2)')
+ ->setCellValue('B3', '=YEAR(A3)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 1982
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 2009
+```
+
+```php
+$retVal = call_user_func_array(
+ array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'YEAR'),
+ array('14-July-2001')
+);
+// $retVal = 2001
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+### YEARFRAC
+
+Not yet documented.
+
diff --git a/docs/ReadingSpreadsheetFiles/01-File-Formats.md b/docs/topics/file-formats.md
similarity index 75%
rename from docs/ReadingSpreadsheetFiles/01-File-Formats.md
rename to docs/topics/file-formats.md
index 38c021b9..7b7b55f4 100644
--- a/docs/ReadingSpreadsheetFiles/01-File-Formats.md
+++ b/docs/topics/file-formats.md
@@ -1,27 +1,24 @@
-# PhpSpreadsheet User Documentation – Reading Spreadsheet Files
+# File Formats
-
-## Spreadsheet File Formats
-
-PhpSpreadsheet can read a number of different spreadsheet and file formats, although not all features are supported by all of the readers. Check the Functionality Cross-Reference document (Functionality Cross-Reference.xls) for a list that identifies which features are supported by which readers.
+PhpSpreadsheet can read a number of different spreadsheet and file formats, although not all features are supported by all of the readers. Check the [features cross reference](../references/features-cross-reference.md) for a list that identifies which features are supported by which readers.
Currently, PhpSpreadsheet supports the following File Types for Reading:
### Xls
-The Microsoft Excel™ Binary file format (BIFF5 and BIFF8) is a binary file format that was used by Microsoft Excel™ between versions 95 and 2003. The format is supported (to various extents) by most spreadsheet programs. BIFF files normally have an extension of .xls. Documentation describing the format can be found online at [http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx][1] or from [http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/[MS-XLS].pdf][2] (as a downloadable PDF).
+The Microsoft Excel™ Binary file format (BIFF5 and BIFF8) is a binary file format that was used by Microsoft Excel™ between versions 95 and 2003. The format is supported (to various extents) by most spreadsheet programs. BIFF files normally have an extension of .xls. Documentation describing the format can be found online at [http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx](http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx) or from [as a downloadable PDF](http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/[MS-XLS].pdf).
### Excel2003XML
-Microsoft Excel™ 2003 included options for a file format called SpreadsheetML. This file is a zipped XML document. It is not very common, but its core features are supported. Documentation for the format can be found at [http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx][3] though it’s sadly rather sparse in its detail.
+Microsoft Excel™ 2003 included options for a file format called SpreadsheetML. This file is a zipped XML document. It is not very common, but its core features are supported. Documentation for the format can be found at [http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx](http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx) though it’s sadly rather sparse in its detail.
### Xlsx
-Microsoft Excel™ 2007 shipped with a new file format, namely Microsoft Office Open XML SpreadsheetML, and Excel 2010 extended this still further with its new features such as sparklines. These files typically have an extension of .xlsx. This format is based around a zipped collection of eXtensible Markup Language (XML) files. Microsoft Office Open XML SpreadsheetML is mostly standardized in ECMA 376 ([http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm][4]) and ISO 29500.
+Microsoft Excel™ 2007 shipped with a new file format, namely Microsoft Office Open XML SpreadsheetML, and Excel 2010 extended this still further with its new features such as sparklines. These files typically have an extension of .xlsx. This format is based around a zipped collection of eXtensible Markup Language (XML) files. Microsoft Office Open XML SpreadsheetML is mostly standardized in ECMA 376 ([http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm](http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm)) and ISO 29500.
### Ods
-aka Open Document Format (ODF) or OASIS, this is the OpenOffice.org XML File Format for spreadsheets. It comprises a zip archive including several components all of which are text files, most of these with markup in the eXtensible Markup Language (XML). It is the standard file format for OpenOffice.org Calc and StarCalc, and files typically have an extension of .ods. The published specification for the file format is available from the OASIS Open Office XML Format Technical Committee web page ([http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#technical][5]). Other information is available from the OpenOffice.org XML File Format web page ([http://xml.openoffice.org/general.html][6]), part of the OpenOffice.org project.
+aka Open Document Format (ODF) or OASIS, this is the OpenOffice.org XML File Format for spreadsheets. It comprises a zip archive including several components all of which are text files, most of these with markup in the eXtensible Markup Language (XML). It is the standard file format for OpenOffice.org Calc and StarCalc, and files typically have an extension of .ods. The published specification for the file format is available from the OASIS Open Office XML Format Technical Committee web page ([http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#technical](http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#technical)). Other information is available from the OpenOffice.org XML File Format web page ([http://xml.openoffice.org/general.html](http://xml.openoffice.org/general.html)), part of the OpenOffice.org project.
### SYLK
@@ -29,17 +26,18 @@ This is the Microsoft Multiplan Symbolic Link Interchange (SYLK) file format. Mu
### Gnumeric
-The Gnumeric file format is used by the Gnome Gnumeric spreadsheet application, and typically files have an extension of .gnumeric. The file contents are stored using eXtensible Markup Language (XML) markup, and the file is then compressed using the GNU project's gzip compression library. [http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml][7]
+The Gnumeric file format is used by the Gnome Gnumeric spreadsheet application, and typically files have an extension of .gnumeric. The file contents are stored using eXtensible Markup Language (XML) markup, and the file is then compressed using the GNU project's gzip compression library. [http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml](http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml)
### 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 row of data and (within each line of the file) the different data fields (or columns) are separated from one another using a comma (","). If a data field contains a comma, then it should be enclosed (typically in quotation marks ("). Sometimes tabs "\t", or the pipe symbol ("|"), or a semi-colon (";") are used as separators instead of a comma, although other symbols can be used. Because CSV is a text-only format, it doesn't support any data formatting options.
"CSV" is not a single, well-defined format (although see RFC 4180 for one definition that is commonly used). Rather, in practice the term "CSV" refers to any file that:
- - is plain text using a character set such as ASCII, Unicode, EBCDIC, or Shift JIS,
- - consists of records (typically one record per line),
- - with the records divided into fields separated by delimiters (typically a single reserved character such as comma, semicolon, or tab,
- - where every record has the same sequence of fields.
+
+- is plain text using a character set such as ASCII, Unicode, EBCDIC, or Shift JIS,
+- consists of records (typically one record per line),
+- with the records divided into fields separated by delimiters (typically a single reserved character such as comma, semicolon, or tab,
+- where every record has the same sequence of fields.
Within these general constraints, many variations are in use. Therefore "CSV" files are not entirely portable. Nevertheless, the variations are fairly small, and many implementations allow users to glance at the file (which is feasible because it is plain text), and then specify the delimiter character(s), quoting rules, etc.
@@ -49,12 +47,3 @@ Within these general constraints, many variations are in use. Therefore "CSV" fi
HyperText Markup Language (HTML) is the main markup language for creating web pages and other information that can be displayed in a web browser. Files typically have an extension of .html or .htm. HTML markup provides a means to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, links, quotes and other items. Since 1996, the HTML specifications have been maintained, with input from commercial software vendors, by the World Wide Web Consortium (W3C). However, in 2000, HTML also became an international standard (ISO/IEC 15445:2000). HTML 4.01 was published in late 1999, with further errata published through 2001. In 2004 development began on HTML5 in the Web Hypertext Application Technology Working Group (WHATWG), which became a joint deliverable with the W3C in 2008.
-
-
- [1]: http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx
- [2]: http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5bMS-XLS%5d.pdf
- [3]: http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx
- [4]: http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm
- [5]: http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office
- [6]: http://xml.openoffice.org/general.html
- [7]: http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml
diff --git a/docs/Features/Autofilters/images/01-01-autofilter.png b/docs/topics/images/01-01-autofilter.png
similarity index 100%
rename from docs/Features/Autofilters/images/01-01-autofilter.png
rename to docs/topics/images/01-01-autofilter.png
diff --git a/docs/Features/Autofilters/images/01-02-autofilter.png b/docs/topics/images/01-02-autofilter.png
similarity index 100%
rename from docs/Features/Autofilters/images/01-02-autofilter.png
rename to docs/topics/images/01-02-autofilter.png
diff --git a/docs/Features/Autofilters/images/01-03-filter-icon-1.png b/docs/topics/images/01-03-filter-icon-1.png
similarity index 100%
rename from docs/Features/Autofilters/images/01-03-filter-icon-1.png
rename to docs/topics/images/01-03-filter-icon-1.png
diff --git a/docs/Features/Autofilters/images/01-03-filter-icon-2.png b/docs/topics/images/01-03-filter-icon-2.png
similarity index 100%
rename from docs/Features/Autofilters/images/01-03-filter-icon-2.png
rename to docs/topics/images/01-03-filter-icon-2.png
diff --git a/docs/Features/Autofilters/images/01-04-autofilter.png b/docs/topics/images/01-04-autofilter.png
similarity index 100%
rename from docs/Features/Autofilters/images/01-04-autofilter.png
rename to docs/topics/images/01-04-autofilter.png
diff --git a/docs/Features/Autofilters/images/04-01-simple-autofilter.png b/docs/topics/images/04-01-simple-autofilter.png
similarity index 100%
rename from docs/Features/Autofilters/images/04-01-simple-autofilter.png
rename to docs/topics/images/04-01-simple-autofilter.png
diff --git a/docs/Features/Autofilters/images/04-02-dategroup-autofilter.png b/docs/topics/images/04-02-dategroup-autofilter.png
similarity index 100%
rename from docs/Features/Autofilters/images/04-02-dategroup-autofilter.png
rename to docs/topics/images/04-02-dategroup-autofilter.png
diff --git a/docs/Features/Autofilters/images/04-03-custom-autofilter-1.png b/docs/topics/images/04-03-custom-autofilter-1.png
similarity index 100%
rename from docs/Features/Autofilters/images/04-03-custom-autofilter-1.png
rename to docs/topics/images/04-03-custom-autofilter-1.png
diff --git a/docs/Features/Autofilters/images/04-03-custom-autofilter-2.png b/docs/topics/images/04-03-custom-autofilter-2.png
similarity index 100%
rename from docs/Features/Autofilters/images/04-03-custom-autofilter-2.png
rename to docs/topics/images/04-03-custom-autofilter-2.png
diff --git a/docs/Features/Autofilters/images/04-04-dynamic-autofilter.png b/docs/topics/images/04-04-dynamic-autofilter.png
similarity index 100%
rename from docs/Features/Autofilters/images/04-04-dynamic-autofilter.png
rename to docs/topics/images/04-04-dynamic-autofilter.png
diff --git a/docs/Features/Autofilters/images/04-05-topten-autofilter-1.png b/docs/topics/images/04-05-topten-autofilter-1.png
similarity index 100%
rename from docs/Features/Autofilters/images/04-05-topten-autofilter-1.png
rename to docs/topics/images/04-05-topten-autofilter-1.png
diff --git a/docs/Features/Autofilters/images/04-05-topten-autofilter-2.png b/docs/topics/images/04-05-topten-autofilter-2.png
similarity index 100%
rename from docs/Features/Autofilters/images/04-05-topten-autofilter-2.png
rename to docs/topics/images/04-05-topten-autofilter-2.png
diff --git a/docs/Overview/images/08-cell-comment.png b/docs/topics/images/08-cell-comment.png
similarity index 100%
rename from docs/Overview/images/08-cell-comment.png
rename to docs/topics/images/08-cell-comment.png
diff --git a/docs/Overview/images/08-column-width.png b/docs/topics/images/08-column-width.png
similarity index 100%
rename from docs/Overview/images/08-column-width.png
rename to docs/topics/images/08-column-width.png
diff --git a/docs/Overview/images/08-page-setup-margins.png b/docs/topics/images/08-page-setup-margins.png
similarity index 100%
rename from docs/Overview/images/08-page-setup-margins.png
rename to docs/topics/images/08-page-setup-margins.png
diff --git a/docs/Overview/images/08-page-setup-scaling-options.png b/docs/topics/images/08-page-setup-scaling-options.png
similarity index 100%
rename from docs/Overview/images/08-page-setup-scaling-options.png
rename to docs/topics/images/08-page-setup-scaling-options.png
diff --git a/docs/Overview/images/08-styling-border-options.png b/docs/topics/images/08-styling-border-options.png
similarity index 100%
rename from docs/Overview/images/08-styling-border-options.png
rename to docs/topics/images/08-styling-border-options.png
diff --git a/docs/Overview/images/09-command-line-calculation.png b/docs/topics/images/09-command-line-calculation.png
similarity index 100%
rename from docs/Overview/images/09-command-line-calculation.png
rename to docs/topics/images/09-command-line-calculation.png
diff --git a/docs/Overview/images/09-formula-in-cell-1.png b/docs/topics/images/09-formula-in-cell-1.png
similarity index 100%
rename from docs/Overview/images/09-formula-in-cell-1.png
rename to docs/topics/images/09-formula-in-cell-1.png
diff --git a/docs/Overview/images/09-formula-in-cell-2.png b/docs/topics/images/09-formula-in-cell-2.png
similarity index 100%
rename from docs/Overview/images/09-formula-in-cell-2.png
rename to docs/topics/images/09-formula-in-cell-2.png
diff --git a/docs/Migration-from-PHPExcel.md b/docs/topics/migration-from-PHPExcel.md
similarity index 100%
rename from docs/Migration-from-PHPExcel.md
rename to docs/topics/migration-from-PHPExcel.md
diff --git a/docs/topics/reading-files.md b/docs/topics/reading-files.md
new file mode 100644
index 00000000..3de87614
--- /dev/null
+++ b/docs/topics/reading-files.md
@@ -0,0 +1,934 @@
+# Reading Files
+
+
+## Security
+
+XML-based formats such as OfficeOpen XML, Excel2003 XML, OASIS and Gnumeric are susceptible to XML External Entity Processing (XXE) injection attacks (for an explanation of XXE injection see http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html) when reading spreadsheet files. This can lead to:
+
+ - Disclosure whether a file is existent
+ - Server Side Request Forgery
+ - Command Execution (depending on the installed PHP wrappers)
+
+
+To prevent this, PhpSpreadsheet sets `libxml_disable_entity_loader` to `true` for the XML-based Readers by default.
+
+## Loading a Spreadsheet File
+
+The simplest way to load a workbook file is to let PhpSpreadsheet's IO Factory identify the file type and load it, calling the static load() method of the \PhpOffice\PhpSpreadsheet\IOFactory class.
+
+```php
+$inputFileName = './sampleData/example1.xls';
+
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
+```
+ > See Examples/Reader/exampleReader01.php for a working example of this code.
+
+The load() method will attempt to identify the file type, and instantiate a loader for that file type; using it to load the file and store the data and any formatting in a `Spreadsheet` object.
+
+The method makes an initial guess at the loader to instantiate based on the file extension; but will test the file before actually executing the load: so if (for example) the file is actually a CSV file or contains HTML markup, but that has been given a .xls extension (quite a common practise), it will reject the Xls loader that it would normally use for a .xls file; and test the file using the other loaders until it finds the appropriate loader, and then use that to read the file.
+
+While easy to implement in your code, and you don't need to worry about the file type; this isn't the most efficient method to load a file; and it lacks the flexibility to configure the loader in any way before actually reading the file into a `Spreadsheet` object.
+
+
+## Creating a Reader and Loading a Spreadsheet File
+
+If you know the file type of the spreadsheet file that you need to load, you can instantiate a new reader object for that file type, then use the reader's load() method to read the file to a `Spreadsheet` object. It is possible to instantiate the reader objects for each of the different supported filetype by name. However, you may get unpredictable results if the file isn't of the right type (e.g. it is a CSV with an extension of .xls), although this type of exception should normally be trapped.
+
+```php
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Xls Reader **/
+$objReader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
+// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
+// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Excel2003XML();
+// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Ods();
+// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\SYLK();
+// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric();
+// $objReader = new \PhpOffice\PhpSpreadsheet\Reader\CSV();
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader02.php for a working example of this code.
+
+Alternatively, you can use the IO Factory's createReader() method to instantiate the reader object for you, simply telling it the file type of the reader that you want instantiating.
+
+```php
+$inputFileType = 'Xls';
+// $inputFileType = 'Xlsx';
+// $inputFileType = 'Excel2003XML';
+// $inputFileType = 'Ods';
+// $inputFileType = 'SYLK';
+// $inputFileType = 'Gnumeric';
+// $inputFileType = 'CSV';
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader03.php for a working example of this code.
+
+If you're uncertain of the filetype, you can use the IO Factory's identify() method to identify the reader that you need, before using the createReader() method to instantiate the reader object.
+
+```php
+$inputFileName = './sampleData/example1.xls';
+
+/** Identify the type of $inputFileName **/
+$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($inputFileName);
+/** Create a new Reader of the type that has been identified **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader04.php for a working example of this code.
+
+## Spreadsheet Reader Options
+
+Once you have created a reader object for the workbook that you want to load, you have the opportunity to set additional options before executing the load() method.
+
+### Reading Only Data from a Spreadsheet File
+
+If you're only interested in the cell values in a workbook, but don't need any of the cell formatting information, then you can set the reader to read only the data values and any formulae from each cell using the setReadDataOnly() method.
+
+```php
+$inputFileType = 'Xls';
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+/** Advise the Reader that we only want to load cell data **/
+$objReader->setReadDataOnly(true);
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader05.php for a working example of this code.
+
+It is important to note that Workbooks (and PhpSpreadsheet) store dates and times as simple numeric values: they can only be distinguished from other numeric values by the format mask that is applied to that cell. When setting read data only to true, PhpSpreadsheet doesn't read the cell format masks, so it is not possible to differentiate between dates/times and numbers.
+
+The Gnumeric loader has been written to read the format masks for date values even when read data only has been set to true, so it can differentiate between dates/times and numbers; but this change hasn't yet been implemented for the other readers.
+
+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 |
+Ods | YES | SYLK | NO | Gnumeric | YES |
+CSV | NO | HTML | NO
+
+### Reading Only Named WorkSheets from a File
+
+If your workbook contains a number of worksheets, but you are only interested in reading some of those, then you can use the setLoadSheetsOnly() method to identify those sheets you are interested in reading.
+
+To read a single sheet, you can pass that sheet name as a parameter to the setLoadSheetsOnly() method.
+
+```php
+$inputFileType = 'Xls';
+$inputFileName = './sampleData/example1.xls';
+$sheetname = 'Data Sheet #2';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+/** Advise the Reader of which WorkSheets we want to load **/
+$objReader->setLoadSheetsOnly($sheetname);
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader07.php for a working example of this code.
+
+If you want to read more than just a single sheet, you can pass a list of sheet names as an array parameter to the setLoadSheetsOnly() method.
+
+```php
+$inputFileType = 'Xls';
+$inputFileName = './sampleData/example1.xls';
+$sheetnames = array('Data Sheet #1','Data Sheet #3');
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+/** Advise the Reader of which WorkSheets we want to load **/
+$objReader->setLoadSheetsOnly($sheetnames);
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader08.php for a working example of this code.
+
+To reset this option to the default, you can call the setLoadAllSheets() method.
+
+```php
+$inputFileType = 'Xls';
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+/** Advise the Reader to load all Worksheets **/
+$objReader->setLoadAllSheets();
+/** Load $inputFileName to a Spreadsheet Object **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader06.php for a working example of this code.
+
+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 |
+Ods | YES | SYLK | NO | Gnumeric | YES |
+CSV | NO | HTML | NO
+
+### Reading Only Specific Columns and Rows from a File (Read Filters)
+
+If you are only interested in reading part of a worksheet, then you can write a filter class that identifies whether or not individual cells should be read by the loader. A read filter must implement the \PhpOffice\PhpSpreadsheet\Reader\IReadFilter interface, and contain a readCell() method that accepts arguments of $column, $row and $worksheetName, and return a boolean true or false that indicates whether a workbook cell identified by those arguments should be read or not.
+
+```php
+$inputFileType = 'Xls';
+$inputFileName = './sampleData/example1.xls';
+$sheetname = 'Data Sheet #3';
+
+
+/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
+class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
+{
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read rows 1 to 7 and columns A to E only
+ if ($row >= 1 && $row <= 7) {
+ if (in_array($column,range('A','E'))) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+/** Create an Instance of our Read Filter **/
+$filterSubset = new MyReadFilter();
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+/** Tell the Reader that we want to use the Read Filter **/
+$objReader->setReadFilter($filterSubset);
+/** Load only the rows and columns that match our filter to Spreadsheet **/
+$spreadsheet = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader09.php for a working example of this code.
+
+This example is not particularly useful, because it can only be used in a very specific circumstance (when you only want cells in the range A1:E7 from your worksheet. A generic Read Filter would probably be more useful:
+
+```php
+/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
+class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
+{
+ private $_startRow = 0;
+ private $_endRow = 0;
+ private $_columns = array();
+
+ /** Get the list of rows and columns to read */
+ public function __construct($startRow, $endRow, $columns) {
+ $this->_startRow = $startRow;
+ $this->_endRow = $endRow;
+ $this->_columns = $columns;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Only read the rows and columns that were configured
+ if ($row >= $this->_startRow && $row <= $this->_endRow) {
+ if (in_array($column,$this->_columns)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+/** Create an Instance of our Read Filter, passing in the cell range **/
+$filterSubset = new MyReadFilter(9,15,range('G','K'));
+```
+ > See Examples/Reader/exampleReader10.php for a working example of this code.
+
+This can be particularly useful for conserving memory, by allowing you to read and process a large workbook in “chunks”: an example of this usage might be when transferring data from an Excel worksheet to a database.
+
+```php
+$inputFileType = 'Xls';
+$inputFileName = './sampleData/example2.xls';
+
+
+/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
+class chunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
+{
+ private $_startRow = 0;
+ private $_endRow = 0;
+
+ /** Set the list of rows that we want to read */
+ public function setRows($startRow, $chunkSize) {
+ $this->_startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Only read the heading row, and the configured rows
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+ return false;
+ }
+}
+
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+
+
+/** Define how many rows we want to read for each "chunk" **/
+$chunkSize = 2048;
+/** Create a new Instance of our Read Filter **/
+$chunkFilter = new chunkReadFilter();
+
+/** Tell the Reader that we want to use the Read Filter **/
+$objReader->setReadFilter($chunkFilter);
+
+/** Loop to read our worksheet in "chunk size" blocks **/
+for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) {
+ /** Tell the Read Filter which rows we want this iteration **/
+ $chunkFilter->setRows($startRow,$chunkSize);
+ /** Load only the rows that match our filter **/
+ $spreadsheet = $objReader->load($inputFileName);
+ // Do some processing here
+}
+```
+ > See Examples/Reader/exampleReader12.php for a working example of this code.
+
+Using Read Filters applies to:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Xlsx | YES | Xls | YES | Excel2003XML | YES |
+Ods | YES | SYLK | NO | Gnumeric | YES |
+CSV | YES | HTML | NO
+
+### Combining Multiple Files into a Single Spreadsheet Object
+
+While you can limit the number of worksheets that are read from a workbook file using the setLoadSheetsOnly() method, certain readers also allow you to combine several individual "sheets" from different files into a single `Spreadsheet` object, where each individual file is a single worksheet within that workbook. For each file that you read, you need to indicate which worksheet index it should be loaded into using the setSheetIndex() method of the $objReader, then use the loadIntoExisting() method rather than the load() method to actually read the file into that worksheet.
+
+```php
+$inputFileType = 'CSV';
+$inputFileNames = array('./sampleData/example1.csv',
+ './sampleData/example2.csv'
+ './sampleData/example3.csv'
+);
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+
+
+/** Extract the first named file from the array list **/
+$inputFileName = array_shift($inputFileNames);
+/** Load the initial file to the first worksheet in a `Spreadsheet` Object **/
+$spreadsheet = $objReader->load($inputFileName);
+/** Set the worksheet title (to the filename that we've loaded) **/
+$spreadsheet->getActiveSheet()
+ ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
+
+
+/** Loop through all the remaining files in the list **/
+foreach($inputFileNames as $sheet => $inputFileName) {
+ /** Increment the worksheet index pointer for the Reader **/
+ $objReader->setSheetIndex($sheet+1);
+ /** Load the current file into a new worksheet in Spreadsheet **/
+ $objReader->loadIntoExisting($inputFileName,$spreadsheet);
+ /** Set the worksheet title (to the filename that we've loaded) **/
+ $spreadsheet->getActiveSheet()
+ ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
+}
+```
+ > See Examples/Reader/exampleReader13.php for a working example of this code.
+
+Note that using the same sheet index for multiple sheets won't append files into the same sheet, but overwrite the results of the previous load. You cannot load multiple CSV files into the same worksheet.
+
+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 |
+Ods | NO | SYLK | YES | Gnumeric | NO |
+CSV | YES | HTML | NO
+
+### Combining Read Filters with the setSheetIndex() method to split a large CSV file across multiple Worksheets
+
+An Xls BIFF .xls file is limited to 65536 rows in a worksheet, while the Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to 1,048,576 rows in a worksheet; but a CSV file is not limited other than by available disk space. This means that we wouldn’t ordinarily be able to read all the rows from a very large CSV file that exceeded those limits, and save it as an Xls or Xlsx file. However, by using Read Filters to read the CSV file in “chunks” (using the chunkReadFilter Class that we defined in section REF _Ref275604563 \r \p 5.3 above), and the setSheetIndex() method of the $objReader, we can split the CSV file across several individual worksheets.
+
+```php
+$inputFileType = 'CSV';
+$inputFileName = './sampleData/example2.csv';
+
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'