diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000..2557290f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,29 @@
+This is:
+
+- [ ] a bug report
+- [ ] a feature request
+- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
+
+### What is the expected behavior?
+
+
+### What is the current behavior?
+
+
+### What are the steps to reproduce?
+
+Please provide a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) of code that exhibits the issue without relying on an external Excel file or a web server:
+
+```php
+migrate();
diff --git a/docs/Examples/Calculations/Database/DAVERAGE.php b/docs/Examples/Calculations/Database/DAVERAGE.php
index b54a7d1d..be87d3ef 100644
--- a/docs/Examples/Calculations/Database/DAVERAGE.php
+++ b/docs/Examples/Calculations/Database/DAVERAGE.php
@@ -1,79 +1,78 @@
-
';
+ $loadedSheetNames = $spreadsheet->getSheetNames();
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo $sheetIndex, ' -> ', $loadedSheetName, ' ';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader09.php b/docs/Examples/Reader/exampleReader09.php
index e2464447..1c5c4147 100644
--- a/docs/Examples/Reader/exampleReader09.php
+++ b/docs/Examples/Reader/exampleReader09.php
@@ -1,64 +1,61 @@
-
-
+
+
-PhpSpreadsheet Reader Example #09
+ PhpSpreadsheet Reader Example #09
-
-
+
+
-
PhpSpreadsheet Reader Example #09
-
Simple File Reader Using a Read Filter
-PhpSpreadsheet Reader Example #09
+
Simple File Reader Using a Read Filter
+ = 1 && $row <= 7) {
+ if (in_array($column, range('A', 'E'))) {
+ return true;
+ }
+ }
-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;
}
+
}
- return false;
- }
-}
+ $filterSubset = new MyReadFilter();
-$filterSubset = new MyReadFilter();
+ echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, ' ';
+ $reader = IOFactory::createReader($inputFileType);
+ echo 'Loading Sheet "', $sheetname, '" only ';
+ $reader->setLoadSheetsOnly($sheetname);
+ echo 'Loading Sheet using filter ';
+ $reader->setReadFilter($filterSubset);
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,' ';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-echo 'Loading Sheet "',$sheetname,'" only ';
-$reader->setLoadSheetsOnly($sheetname);
-echo 'Loading Sheet using filter ';
-$reader->setReadFilter($filterSubset);
-$spreadsheet = $reader->load($inputFileName);
+ echo '';
-echo '';
-
-$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
-var_dump($sheetData);
-
-?>
-
+ $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
+ var_dump($sheetData);
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader10.php b/docs/Examples/Reader/exampleReader10.php
index 965a1bb2..6d4517eb 100644
--- a/docs/Examples/Reader/exampleReader10.php
+++ b/docs/Examples/Reader/exampleReader10.php
@@ -1,76 +1,72 @@
-
-
+
+
-PhpSpreadsheet Reader Example #10
+ PhpSpreadsheet Reader Example #10
-
-
+
+
-
PhpSpreadsheet Reader Example #10
-
Simple File Reader Using a Configurable Read Filter
-PhpSpreadsheet Reader Example #10
+
Simple File Reader Using a Configurable Read Filter
+ _startRow = $startRow;
- $this->_endRow = $endRow;
- $this->_columns = $columns;
- }
-
- public function readCell($column, $row, $worksheetName = '')
- {
- if ($row >= $this->_startRow && $row <= $this->_endRow) {
- if (in_array($column, $this->_columns)) {
- return true;
+ public function __construct($startRow, $endRow, $columns)
+ {
+ $this->_startRow = $startRow;
+ $this->_endRow = $endRow;
+ $this->_columns = $columns;
}
+
+ public function readCell($column, $row, $worksheetName = '')
+ {
+ if ($row >= $this->_startRow && $row <= $this->_endRow) {
+ if (in_array($column, $this->_columns)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
}
- return false;
- }
-}
+ $filterSubset = new MyReadFilter(9, 15, range('G', 'K'));
-$filterSubset = new MyReadFilter(9, 15, range('G', 'K'));
+ echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, ' ';
+ $reader = IOFactory::createReader($inputFileType);
+ echo 'Loading Sheet "', $sheetname, '" only ';
+ $reader->setLoadSheetsOnly($sheetname);
+ echo 'Loading Sheet using configurable filter ';
+ $reader->setReadFilter($filterSubset);
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,' ';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-echo 'Loading Sheet "',$sheetname,'" only ';
-$reader->setLoadSheetsOnly($sheetname);
-echo 'Loading Sheet using configurable filter ';
-$reader->setReadFilter($filterSubset);
-$spreadsheet = $reader->load($inputFileName);
+ echo '';
-echo '';
-
-$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
-var_dump($sheetData);
-
-?>
-
+ $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
+ var_dump($sheetData);
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader11.php b/docs/Examples/Reader/exampleReader11.php
index 5435629a..67c9ec4d 100644
--- a/docs/Examples/Reader/exampleReader11.php
+++ b/docs/Examples/Reader/exampleReader11.php
@@ -1,89 +1,86 @@
-
-
+
+
-PhpSpreadsheet Reader Example #11
+ PhpSpreadsheet Reader Example #11
-
-
+
+
-
PhpSpreadsheet Reader Example #11
-
Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 1)
-PhpSpreadsheet Reader Example #11
+
Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 1)
+ _startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
- /**
- * We expect a list of the rows that we want to read to be passed into the constructor.
- *
- * @param mixed $startRow
- * @param mixed $chunkSize
- */
- public function __construct($startRow, $chunkSize)
- {
- $this->_startRow = $startRow;
- $this->_endRow = $startRow + $chunkSize;
- }
+ public function readCell($column, $row, $worksheetName = '')
+ {
+ // Only read the heading row, and the rows that were configured in the constructor
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+
+ return false;
+ }
- public function readCell($column, $row, $worksheetName = '')
- {
- // Only read the heading row, and the rows that were configured in the constructor
- if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
- return true;
}
- return false;
- }
-}
+ echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, ' ';
+ /* Create a new Reader of the type defined in $inputFileType * */
+ $reader = IOFactory::createReader($inputFileType);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,' ';
-/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ echo '';
-echo '';
+ /* Define how many rows we want for each "chunk" * */
+ $chunkSize = 20;
-/* Define how many rows we want for each "chunk" **/
-$chunkSize = 20;
+ /* Loop to read our worksheet in "chunk size" blocks * */
+ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
+ echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ', $startRow, ' to ', ($startRow + $chunkSize - 1), ' ';
+ /* Create a new Instance of our Read Filter, passing in the limits on which rows we want to read * */
+ $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
+ /* Tell the Reader that we want to use the new Read Filter that we've just Instantiated * */
+ $reader->setReadFilter($chunkFilter);
+ /* Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object * */
+ $spreadsheet = $reader->load($inputFileName);
-/* Loop to read our worksheet in "chunk size" blocks **/
-for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
- echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow + $chunkSize - 1),' ';
- /* Create a new Instance of our Read Filter, passing in the limits on which rows we want to read **/
- $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
- /* Tell the Reader that we want to use the new Read Filter that we've just Instantiated **/
- $reader->setReadFilter($chunkFilter);
- /* Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object **/
- $spreadsheet = $reader->load($inputFileName);
+ // Do some processing here
- // Do some processing here
-
- $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
- var_dump($sheetData);
- echo '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader12.php b/docs/Examples/Reader/exampleReader12.php
index 673b2f14..f9055ae1 100644
--- a/docs/Examples/Reader/exampleReader12.php
+++ b/docs/Examples/Reader/exampleReader12.php
@@ -1,92 +1,89 @@
-
-
+
+
-PhpSpreadsheet Reader Example #12
+ PhpSpreadsheet Reader Example #12
-
-
+
+
-
PhpSpreadsheet Reader Example #12
-
Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 2)
-PhpSpreadsheet Reader Example #12
+
Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 2)
+ _startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
- /**
- * Set the list of rows that we want to read.
- *
- * @param mixed $startRow
- * @param mixed $chunkSize
- */
- 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 rows that are configured in $this->_startRow and $this->_endRow
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+
+ return false;
+ }
- public function readCell($column, $row, $worksheetName = '')
- {
- // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
- if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
- return true;
}
- return false;
- }
-}
+ echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, ' ';
+ /* Create a new Reader of the type defined in $inputFileType * */
+ $reader = IOFactory::createReader($inputFileType);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,' ';
-/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ echo '';
-echo '';
+ /* Define how many rows we want to read for each "chunk" * */
+ $chunkSize = 20;
+ /* Create a new Instance of our Read Filter * */
+ $chunkFilter = new chunkReadFilter();
-/* Define how many rows we want to read for each "chunk" **/
-$chunkSize = 20;
-/* Create a new Instance of our Read Filter **/
-$chunkFilter = new chunkReadFilter();
+ /* Tell the Reader that we want to use the Read Filter that we've Instantiated * */
+ $reader->setReadFilter($chunkFilter);
-/* Tell the Reader that we want to use the Read Filter that we've Instantiated **/
-$reader->setReadFilter($chunkFilter);
+ /* Loop to read our worksheet in "chunk size" blocks * */
+ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
+ echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ', $startRow, ' to ', ($startRow + $chunkSize - 1), ' ';
+ /* Tell the Read Filter, the limits on which rows we want to read this iteration * */
+ $chunkFilter->setRows($startRow, $chunkSize);
+ /* Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object * */
+ $spreadsheet = $reader->load($inputFileName);
-/* Loop to read our worksheet in "chunk size" blocks **/
-for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
- echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ', $startRow, ' to ', ($startRow + $chunkSize - 1), ' ';
- /* Tell the Read Filter, the limits on which rows we want to read this iteration **/
- $chunkFilter->setRows($startRow, $chunkSize);
- /* Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object **/
- $spreadsheet = $reader->load($inputFileName);
+ // Do some processing here
- // Do some processing here
-
- $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
- var_dump($sheetData);
- echo '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader14.php b/docs/Examples/Reader/exampleReader14.php
index 933be4ac..98ab0b65 100644
--- a/docs/Examples/Reader/exampleReader14.php
+++ b/docs/Examples/Reader/exampleReader14.php
@@ -1,108 +1,110 @@
-
-
+
+
-PhpSpreadsheet Reader Example #14
+ PhpSpreadsheet Reader Example #14
-
-
+
+
-
PhpSpreadsheet Reader Example #14
-
Reading a Large CSV file in "Chunks" to split across multiple Worksheets
-PhpSpreadsheet Reader Example #14
+
Reading a Large CSV file in "Chunks" to split across multiple Worksheets
+ _startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
- /**
- * Set the list of rows that we want to read.
- *
- * @param mixed $startRow
- * @param mixed $chunkSize
- */
- 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 rows that are configured in $this->_startRow and $this->_endRow
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+
+ return false;
+ }
- public function readCell($column, $row, $worksheetName = '')
- {
- // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
- if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
- return true;
}
- return false;
- }
-}
+ echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with a defined reader type of ', $inputFileType, ' ';
+ /* Create a new Reader of the type defined in $inputFileType * */
+ $reader = IOFactory::createReader($inputFileType);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,' ';
-/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ echo '';
-echo '';
+ /* Define how many rows we want to read for each "chunk" * */
+ $chunkSize = 100;
+ /* Create a new Instance of our Read Filter * */
+ $chunkFilter = new chunkReadFilter();
-/* Define how many rows we want to read for each "chunk" **/
-$chunkSize = 100;
-/* Create a new Instance of our Read Filter **/
-$chunkFilter = new chunkReadFilter();
+ /* Tell the Reader that we want to use the Read Filter that we've Instantiated * */
+ /* and that we want to store it in contiguous rows/columns * */
+ $reader->setReadFilter($chunkFilter)
+ ->setContiguous(true);
-/* Tell the Reader that we want to use the Read Filter that we've Instantiated **/
-/* and that we want to store it in contiguous rows/columns **/
-$reader->setReadFilter($chunkFilter)
- ->setContiguous(true);
+ /* Instantiate a new PhpSpreadsheet object manually * */
+ $spreadsheet = new Spreadsheet();
-/* Instantiate a new PhpSpreadsheet object manually **/
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+ /* Set a sheet index * */
+ $sheet = 0;
+ /* Loop to read our worksheet in "chunk size" blocks * */
+ /** $startRow is set to 2 initially because we always read the headings in row #1 * */
+ for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
+ echo 'Loading WorkSheet #', ($sheet + 1), ' using configurable filter for headings row 1 and for rows ', $startRow, ' to ', ($startRow + $chunkSize - 1), ' ';
+ /* Tell the Read Filter, the limits on which rows we want to read this iteration * */
+ $chunkFilter->setRows($startRow, $chunkSize);
-/* Set a sheet index **/
-$sheet = 0;
-/* Loop to read our worksheet in "chunk size" blocks **/
-/** $startRow is set to 2 initially because we always read the headings in row #1 **/
-for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
- echo 'Loading WorkSheet #', ($sheet + 1), ' using configurable filter for headings row 1 and for rows ', $startRow, ' to ', ($startRow + $chunkSize - 1), ' ';
- /* Tell the Read Filter, the limits on which rows we want to read this iteration **/
- $chunkFilter->setRows($startRow, $chunkSize);
+ /* Increment the worksheet index pointer for the Reader * */
+ $reader->setSheetIndex($sheet);
+ /* Load only the rows that match our filter into a new worksheet in the PhpSpreadsheet Object * */
+ $reader->loadIntoExisting($inputFileName, $spreadsheet);
+ /* Set the worksheet title (to reference the "sheet" of data that we've loaded) * */
+ /* and increment the sheet index as well * */
+ $spreadsheet->getActiveSheet()->setTitle('Country Data #' . ( ++$sheet));
+ }
- /* Increment the worksheet index pointer for the Reader **/
- $reader->setSheetIndex($sheet);
- /* Load only the rows that match our filter into a new worksheet in the PhpSpreadsheet Object **/
- $reader->loadIntoExisting($inputFileName, $spreadsheet);
- /* Set the worksheet title (to reference the "sheet" of data that we've loaded) **/
- /* and increment the sheet index as well **/
- $spreadsheet->getActiveSheet()->setTitle('Country Data #' . (++$sheet));
-}
+ echo '';
-echo '';
-
-echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
Simple File Reader Loading Several Named WorkSheets
-PhpSpreadsheet Reader Example #17
+
Simple File Reader Loading Several Named WorkSheets
+ ';
+ $reader = IOFactory::createReader($inputFileType);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,' ';
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ /* Read the list of Worksheet Names from the Workbook file * */
+ echo 'Read the list of Worksheets in the WorkBook ';
+ $worksheetNames = $reader->listWorksheetNames($inputFileName);
-/* Read the list of Worksheet Names from the Workbook file **/
-echo 'Read the list of Worksheets in the WorkBook ';
-$worksheetNames = $reader->listWorksheetNames($inputFileName);
-
-echo 'There are ',count($worksheetNames),' worksheet',((count($worksheetNames) == 1) ? '' : 's'),' in the workbook
';
-foreach ($worksheetNames as $worksheetName) {
- echo $worksheetName,' ';
-}
-
-?>
-
+ echo 'There are ', count($worksheetNames), ' worksheet', ((count($worksheetNames) == 1) ? '' : 's'), ' in the workbook
';
+ foreach ($worksheetNames as $worksheetName) {
+ echo $worksheetName, ' ';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader18.php b/docs/Examples/Reader/exampleReader18.php
index 6688e481..68a478bb 100644
--- a/docs/Examples/Reader/exampleReader18.php
+++ b/docs/Examples/Reader/exampleReader18.php
@@ -1,45 +1,40 @@
-
-
+
+
-PhpSpreadsheet Reader Example #18
+ PhpSpreadsheet Reader Example #18
-
-
+
+
-
PhpSpreadsheet Reader Example #18
-
Reading list of WorkSheets without loading entire file
-PhpSpreadsheet Reader Example #18
+
Reading list of WorkSheets without loading entire file
+ ';
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,' ';
+ $reader = IOFactory::createReader($inputFileType);
+ $worksheetNames = $reader->listWorksheetNames($inputFileName);
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-$worksheetNames = $reader->listWorksheetNames($inputFileName);
-
-echo '
';
+ }
+ echo '';
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader19.php b/docs/Examples/Reader/exampleReader19.php
index 5ad3e5ba..dea2dd06 100644
--- a/docs/Examples/Reader/exampleReader19.php
+++ b/docs/Examples/Reader/exampleReader19.php
@@ -1,48 +1,43 @@
-
-
+
+
-PhpSpreadsheet Reader Example #19
+ PhpSpreadsheet Reader Example #19
-
-
+
+
-
PhpSpreadsheet Reader Example #19
-
Reading WorkSheet information without loading entire file
-PhpSpreadsheet Reader Example #19
+
Reading WorkSheet information without loading entire file
+ ';
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,' ';
+ $reader = IOFactory::createReader($inputFileType);
+ $worksheetData = $reader->listWorksheetInfo($inputFileName);
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-$worksheetData = $reader->listWorksheetInfo($inputFileName);
-
-echo '
';
+ }
+ echo '';
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
index aa9bddd7..9085b394 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
@@ -1,86 +1,85 @@
-
-
+
+
-PhpSpreadsheet Reading WorkBook Data Example #01
+ PhpSpreadsheet Reading WorkBook Data Example #01
-
-
+
+
-
PhpSpreadsheet Reading WorkBook Data Example #01
-
Read the WorkBook Properties
-PhpSpreadsheet Reading WorkBook Data Example #01
+
Read the WorkBook Properties
+ load($inputFileName);
-/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/* Load $inputFileName to a PhpSpreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
+ echo '';
-echo '';
+ /* Read the document's creator property * */
+ $creator = $spreadsheet->getProperties()->getCreator();
+ echo 'Document Creator: ', $creator, ' ';
-/* Read the document's creator property **/
-$creator = $spreadsheet->getProperties()->getCreator();
-echo 'Document Creator: ',$creator,' ';
+ /* Read the Date when the workbook was created (as a PHP timestamp value) * */
+ $creationDatestamp = $spreadsheet->getProperties()->getCreated();
+ /* Format the date and time using the standard PHP date() function * */
+ $creationDate = date('l, d<\s\up>S\s\up> F Y', $creationDatestamp);
+ $creationTime = date('g:i A', $creationDatestamp);
+ echo 'Created On: ', $creationDate, ' at ', $creationTime, ' ';
-/* Read the Date when the workbook was created (as a PHP timestamp value) **/
-$creationDatestamp = $spreadsheet->getProperties()->getCreated();
-/* Format the date and time using the standard PHP date() function **/
-$creationDate = date('l, d<\s\up>S\s\up> F Y', $creationDatestamp);
-$creationTime = date('g:i A', $creationDatestamp);
-echo 'Created On: ',$creationDate,' at ',$creationTime,' ';
+ /* Read the name of the last person to modify this workbook * */
+ $modifiedBy = $spreadsheet->getProperties()->getLastModifiedBy();
+ echo 'Last Modified By: ', $modifiedBy, ' ';
-/* Read the name of the last person to modify this workbook **/
-$modifiedBy = $spreadsheet->getProperties()->getLastModifiedBy();
-echo 'Last Modified By: ',$modifiedBy,' ';
+ /* Read the Date when the workbook was last modified (as a PHP timestamp value) * */
+ $modifiedDatestamp = $spreadsheet->getProperties()->getModified();
+ /* Format the date and time using the standard PHP date() function * */
+ $modifiedDate = date('l, d<\s\up>S\s\up> F Y', $modifiedDatestamp);
+ $modifiedTime = date('g:i A', $modifiedDatestamp);
+ echo 'Last Modified On: ', $modifiedDate, ' at ', $modifiedTime, ' ';
-/* Read the Date when the workbook was last modified (as a PHP timestamp value) **/
-$modifiedDatestamp = $spreadsheet->getProperties()->getModified();
-/* Format the date and time using the standard PHP date() function **/
-$modifiedDate = date('l, d<\s\up>S\s\up> F Y', $modifiedDatestamp);
-$modifiedTime = date('g:i A', $modifiedDatestamp);
-echo 'Last Modified On: ',$modifiedDate,' at ',$modifiedTime,' ';
+ /* Read the workbook title property * */
+ $workbookTitle = $spreadsheet->getProperties()->getTitle();
+ echo 'Title: ', $workbookTitle, ' ';
-/* Read the workbook title property **/
-$workbookTitle = $spreadsheet->getProperties()->getTitle();
-echo 'Title: ',$workbookTitle,' ';
+ /* Read the workbook description property * */
+ $description = $spreadsheet->getProperties()->getDescription();
+ echo 'Description: ', $description, ' ';
-/* Read the workbook description property **/
-$description = $spreadsheet->getProperties()->getDescription();
-echo 'Description: ',$description,' ';
+ /* Read the workbook subject property * */
+ $subject = $spreadsheet->getProperties()->getSubject();
+ echo 'Subject: ', $subject, ' ';
-/* Read the workbook subject property **/
-$subject = $spreadsheet->getProperties()->getSubject();
-echo 'Subject: ',$subject,' ';
+ /* Read the workbook keywords property * */
+ $keywords = $spreadsheet->getProperties()->getKeywords();
+ echo 'Keywords: ', $keywords, ' ';
-/* Read the workbook keywords property **/
-$keywords = $spreadsheet->getProperties()->getKeywords();
-echo 'Keywords: ',$keywords,' ';
+ /* Read the workbook category property * */
+ $category = $spreadsheet->getProperties()->getCategory();
+ echo 'Category: ', $category, ' ';
-/* Read the workbook category property **/
-$category = $spreadsheet->getProperties()->getCategory();
-echo 'Category: ',$category,' ';
+ /* Read the workbook company property * */
+ $company = $spreadsheet->getProperties()->getCompany();
+ echo 'Company: ', $company, ' ';
-/* Read the workbook company property **/
-$company = $spreadsheet->getProperties()->getCompany();
-echo 'Company: ',$company,' ';
-
-/* Read the workbook manager property **/
-$manager = $spreadsheet->getProperties()->getManager();
-echo 'Manager: ',$manager,' ';
-
-?>
-
+ /* Read the workbook manager property * */
+ $manager = $spreadsheet->getProperties()->getManager();
+ echo 'Manager: ', $manager, ' ';
+ ?>
+
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
index c021728c..b643f74b 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
@@ -1,44 +1,43 @@
-
-
+
+
-PhpSpreadsheet Reading WorkBook Data Example #02
+ PhpSpreadsheet Reading WorkBook Data Example #02
-
-
+
+
-
PhpSpreadsheet Reading WorkBook Data Example #02
-
Read a list of Custom Properties for a WorkBook
-PhpSpreadsheet Reading WorkBook Data Example #02
+
Read a list of Custom Properties for a WorkBook
+ load($inputFileName);
-/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/* Load $inputFileName to a PhpSpreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
+ echo '';
-echo '';
+ /* Read an array list of any custom properties for this document * */
+ $customPropertyList = $spreadsheet->getProperties()->getCustomProperties();
-/* Read an array list of any custom properties for this document **/
-$customPropertyList = $spreadsheet->getProperties()->getCustomProperties();
-
-echo 'Custom Property names: ';
-foreach ($customPropertyList as $customPropertyName) {
- echo $customPropertyName, ' ';
-}
-
-?>
-
+ echo 'Custom Property names: ';
+ foreach ($customPropertyList as $customPropertyName) {
+ echo $customPropertyName, ' ';
+ }
+ ?>
+
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
index c02f51bd..432099aa 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
@@ -1,72 +1,71 @@
-
-
+
+
-PhpSpreadsheet Reading WorkBook Data Example #03
+ PhpSpreadsheet Reading WorkBook Data Example #03
-
-
+
+
-
PhpSpreadsheet Reading WorkBook Data Example #03
-
Read Custom Property Values for a WorkBook
-PhpSpreadsheet Reading WorkBook Data Example #03
+
Read Custom Property Values for a WorkBook
+ load($inputFileName);
-/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/* Load $inputFileName to a PhpSpreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
+ echo '';
-echo '';
+ /* Read an array list of any custom properties for this document * */
+ $customPropertyList = $spreadsheet->getProperties()->getCustomProperties();
-/* Read an array list of any custom properties for this document **/
-$customPropertyList = $spreadsheet->getProperties()->getCustomProperties();
+ echo 'Custom Properties: ';
+ /* Loop through the list of custom properties * */
+ foreach ($customPropertyList as $customPropertyName) {
+ echo '', $customPropertyName, ': ';
+ /* Retrieve the property value * */
+ $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customPropertyName);
+ /* Retrieve the property type * */
+ $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customPropertyName);
-echo 'Custom Properties: ';
-/* Loop through the list of custom properties **/
-foreach ($customPropertyList as $customPropertyName) {
- echo '',$customPropertyName,': ';
- /* Retrieve the property value **/
- $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customPropertyName);
- /* Retrieve the property type **/
- $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customPropertyName);
+ /* Manipulate properties as appropriate for display purposes * */
+ switch ($propertyType) {
+ case 'i': // integer
+ $propertyType = 'integer number';
+ break;
+ case 'f': // float
+ $propertyType = 'floating point number';
+ break;
+ case 's': // string
+ $propertyType = 'string';
+ break;
+ case 'd': // date
+ $propertyValue = date('l, d<\s\up>S\s\up> F Y g:i A', $propertyValue);
+ $propertyType = 'date';
+ break;
+ case 'b': // boolean
+ $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE';
+ $propertyType = 'boolean';
+ break;
+ }
- /* Manipulate properties as appropriate for display purposes **/
- switch ($propertyType) {
- case 'i': // integer
- $propertyType = 'integer number';
- break;
- case 'f': // float
- $propertyType = 'floating point number';
- break;
- case 's': // string
- $propertyType = 'string';
- break;
- case 'd': // date
- $propertyValue = date('l, d<\s\up>S\s\up> F Y g:i A', $propertyValue);
- $propertyType = 'date';
- break;
- case 'b': // boolean
- $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE';
- $propertyType = 'boolean';
- break;
- }
-
- echo $propertyValue, ' (', $propertyType, ') ';
-}
-
-?>
-
+ echo $propertyValue, ' (', $propertyType, ') ';
+ }
+ ?>
+
diff --git a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
index 88c7f9e0..7299e783 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
@@ -1,48 +1,47 @@
-
-
+
+
-PhpSpreadsheet Reading WorkBook Data Example #04
+ PhpSpreadsheet Reading WorkBook Data Example #04
-
-
+
+
-
PhpSpreadsheet Reading WorkBook Data Example #04
-
Get a List of the Worksheets in a WorkBook
-PhpSpreadsheet Reading WorkBook Data Example #04
+
Get a List of the Worksheets in a WorkBook
+ load($inputFileName);
-/* Create a new Reader of the type defined in $inputFileType **/
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
-/* Load $inputFileName to a PhpSpreadsheet Object **/
-$spreadsheet = $reader->load($inputFileName);
+ echo '';
-echo '';
+ echo 'Reading the number of Worksheets in the WorkBook ';
+ /* Use the PhpSpreadsheet object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */
+ $sheetCount = $spreadsheet->getSheetCount();
+ echo 'There ', (($sheetCount == 1) ? 'is' : 'are'), ' ', $sheetCount, ' WorkSheet', (($sheetCount == 1) ? '' : 's'), ' in the WorkBook
';
-echo 'Reading the number of Worksheets in the WorkBook ';
-/* Use the PhpSpreadsheet object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */
-$sheetCount = $spreadsheet->getSheetCount();
-echo 'There ',(($sheetCount == 1) ? 'is' : 'are'),' ',$sheetCount,' WorkSheet',(($sheetCount == 1) ? '' : 's'),' in the WorkBook
';
-
-echo 'Reading the names of Worksheets in the WorkBook ';
-/* Use the PhpSpreadsheet object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */
-$sheetNames = $spreadsheet->getSheetNames();
-foreach ($sheetNames as $sheetIndex => $sheetName) {
- echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'" ';
-}
-
-?>
-
+ echo 'Reading the names of Worksheets in the WorkBook ';
+ /* Use the PhpSpreadsheet object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */
+ $sheetNames = $spreadsheet->getSheetNames();
+ foreach ($sheetNames as $sheetIndex => $sheetName) {
+ echo 'WorkSheet #', $sheetIndex, ' is named "', $sheetName, '" ';
+ }
+ ?>
+
diff --git a/docs/Examples/index.php b/docs/Examples/index.php
index a2c51879..9ff0929d 100644
--- a/docs/Examples/index.php
+++ b/docs/Examples/index.php
@@ -1,48 +1,44 @@
-
-
+
+
-PhpSpreadsheet Examples
+ PhpSpreadsheet Examples
-
-
+
+
-PhpSpreadsheet ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples';
-foreach ($exampleTypeList as $exampleType) {
- echo '
#';
+ if (preg_match($h1Pattern, $fileData, $out)) {
+ $h1Text = $out[1];
+ $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
- if (preg_match($h1Pattern, $fileData, $out)) {
- $h1Text = $out[1];
- $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
-
- echo '', $h1Text, ' ';
- if (($h2Text > '') &&
- (pathinfo($exampleType, PATHINFO_BASENAME) != 'Calculations')) {
- echo $h2Text, ' ';
+ echo '', $h1Text, ' ';
+ if (($h2Text > '') &&
+ (pathinfo($exampleType, PATHINFO_BASENAME) != 'Calculations')) {
+ echo $h2Text, ' ';
+ }
+ }
}
}
- }
-}
-
-?>
-
+ ?>
+
\ No newline at end of file
diff --git a/docs/extra/extra.css b/docs/extra/extra.css
new file mode 100644
index 00000000..2addeb79
--- /dev/null
+++ b/docs/extra/extra.css
@@ -0,0 +1,8 @@
+/* Make the huge table always visible */
+table.features-cross-reference {
+ overflow: visible !important;
+}
+.rst-content table.features-cross-reference.docutils th,
+.rst-content table.features-cross-reference.docutils td {
+ background-color: white;
+}
diff --git a/docs/extra/extra.js b/docs/extra/extra.js
new file mode 100644
index 00000000..fdef958f
--- /dev/null
+++ b/docs/extra/extra.js
@@ -0,0 +1,57 @@
+var nodemcu = nodemcu || {};
+(function () {
+ 'use strict';
+
+ $(document).ready(function () {
+ fixSearch();
+ });
+
+ /*
+ * RTD messes up MkDocs' search feature by tinkering with the search box defined in the theme, see
+ * https://github.com/rtfd/readthedocs.org/issues/1088. This function sets up a DOM4 MutationObserver
+ * to react to changes to the search form (triggered by RTD on doc ready). It then reverts everything
+ * the RTD JS code modified.
+ */
+ function fixSearch() {
+ var target = document.getElementById('rtd-search-form');
+ var config = {attributes: true, childList: true};
+
+ var observer = new MutationObserver(function (mutations) {
+ // if it isn't disconnected it'll loop infinitely because the observed element is modified
+ observer.disconnect();
+ var form = $('#rtd-search-form');
+ form.empty();
+ form.attr('action', 'https://' + window.location.hostname + '/en/' + determineSelectedBranch() + '/search.html');
+ $('').attr({
+ type: "text",
+ name: "q",
+ placeholder: "Search docs"
+ }).appendTo(form);
+ });
+
+ if (window.location.origin.indexOf('readthedocs') > -1) {
+ observer.observe(target, config);
+ }
+ }
+
+ /**
+ * Analyzes the URL of the current page to find out what the selected GitHub branch is. It's usually
+ * part of the location path. The code needs to distinguish between running MkDocs standalone
+ * and docs served from RTD. If no valid branch could be determined 'dev' returned.
+ *
+ * @returns GitHub branch name
+ */
+ function determineSelectedBranch() {
+ var branch = 'dev', path = window.location.pathname;
+ if (window.location.origin.indexOf('readthedocs') > -1) {
+ // path is like /en///build/ -> extract 'lang'
+ // split[0] is an '' because the path starts with the separator
+ var thirdPathSegment = path.split('/')[2];
+ // 'latest' is an alias on RTD for the 'dev' branch - which is the default for 'branch' here
+ if (thirdPathSegment !== 'latest') {
+ branch = thirdPathSegment;
+ }
+ }
+ return branch;
+ }
+}());
\ No newline at end of file
diff --git a/docs/index.md b/docs/index.md
index 30043595..402059b6 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -6,6 +6,21 @@ PhpSpreadsheet is a library written in pure PHP and providing a set of
classes that allow you to read from and to write to different
spreadsheet file formats, like Excel and LibreOffice Calc.
+## File formats supported
+
+|Format |Reading|Writing|
+|--------------------------------------------|:-----:|:-----:|
+|Open Document Format/OASIS (.ods) | ✓ | ✓ |
+|Office Open XML (.xlsx) Excel 2007 and above| ✓ | ✓ |
+|BIFF 8 (.xls) Excel 97 and above | ✓ | ✓ |
+|BIFF 5 (.xls) Excel 95 | ✓ | |
+|SpreadsheetML (.xml) Excel 2003 | ✓ | |
+|Gnumeric | ✓ | |
+|HTML | ✓ | ✓ |
+|SYLK | ✓ | |
+|CSV | ✓ | ✓ |
+|PDF (using either the tcPDF, DomPDF or mPDF libraries, which need to be installed separately)| | ✓ |
+
# Getting started
## Software requirements
@@ -17,6 +32,10 @@ The following software is required to develop using PhpSpreadsheet:
- PHP extension php\_xml enabled
- PHP extension php\_gd2 enabled (if not compiled in)
+### PHP version support
+
+Support for PHP versions will only be maintained for a period of six months beyond the end-of-life of that PHP version
+
## Installation
Use [composer](https://getcomposer.org/) to install PhpSpreadsheet into your project:
diff --git a/docs/references/features-cross-reference.md b/docs/references/features-cross-reference.md
index cdca7001..7ab9d068 100644
--- a/docs/references/features-cross-reference.md
+++ b/docs/references/features-cross-reference.md
@@ -5,7 +5,7 @@
- ✖ Not supported
- N/A Cannot be supported
-
+
Readers
@@ -906,7 +906,7 @@
-
+
●
diff --git a/docs/topics/calculation-engine.md b/docs/topics/calculation-engine.md
index 1480e13f..94fa3a10 100644
--- a/docs/topics/calculation-engine.md
+++ b/docs/topics/calculation-engine.md
@@ -90,7 +90,7 @@ calculated values, or force recalculation in Excel2003.
### 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.
+return either an Excel timestamp or a PHP timestamp or `DateTime` object.
It is possible for scripts to change the data type used for returning
date values by calling the
@@ -103,9 +103,9 @@ method:
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`
+- `\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).
@@ -117,11 +117,11 @@ method can be used to determine the current value of this setting:
$returnDateType = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType();
```
-The default is RETURNDATE\_PHP\_NUMERIC.
+The default is `RETURNDATE_PHP_NUMERIC`.
#### PHP Timestamps
-If RETURNDATE\_PHP\_NUMERIC is set for the Return Date Type, then any
+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
@@ -131,15 +131,15 @@ 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
+#### PHP `DateTime` Objects
-If the Return Date Type is set for RETURNDATE\_PHP\_NUMERIC, then any
+If the Return Date Type is set for `RETURNDATE_PHP_OBJECT`, 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.
+Time functions in Excel will be a PHP `DateTime` object.
#### Excel Timestamps
-If RETURNDATE\_EXCEL is set for the Return Date Type, then the returned
+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
@@ -157,8 +157,8 @@ Excel date values by calling the
where the following constants can be used for `$baseDate`:
-- \PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR\_WINDOWS\_1900
-- \PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR\_MAC\_1904
+- `\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).
@@ -170,31 +170,31 @@ be used to determine the current value of this setting:
$baseDate = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar();
```
-The default is CALENDAR\_WINDOWS\_1900.
+The default is `CALENDAR_WINDOWS_1900`.
#### Functions that return a Date/Time Value
-- DATE
-- DATEVALUE
-- EDATE
-- EOMONTH
-- NOW
-- TIME
-- TIMEVALUE
-- TODAY
+- 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
+timestamp or a PHP timestamp; or `DateTime` 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
+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
+will be converted to a `DateTime` 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.
@@ -202,7 +202,7 @@ 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
+by the php `DateTime` 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
@@ -213,28 +213,28 @@ 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
+`DateTime` 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
+- DATEDIF
+- DAY
+- DAYS360
+- EDATE
+- EOMONTH
+- HOUR
+- MINUTE
+- MONTH
+- NETWORKDAYS
+- SECOND
+- WEEKDAY
+- WEEKNUM
+- WORKDAY
+- YEAR
+- YEARFRAC
### Helper Methods
@@ -243,7 +243,7 @@ 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)
+#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDate)
Converts a date/time from an Excel date timestamp to return a PHP
serialized date/timestamp.
@@ -251,17 +251,17 @@ 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)
+#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDate)
-Converts a date from an Excel date/timestamp to return a PHP DateTime
+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
+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)
+#### \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.
@@ -979,7 +979,7 @@ Excel and in PHP.
#### DATE
-The DATE function returns an Excel timestamp or a PHP timestamp or date
+The DATE function returns an Excel timestamp or a PHP timestamp or `DateTime`
object representing the date that is referenced by the parameters.
##### Syntax
@@ -1025,7 +1025,7 @@ February 27, 2008.
**mixed** A date/time stamp that corresponds to the given date.
-This could be a PHP timestamp value (integer), a PHP date/time object,
+This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
@@ -1093,12 +1093,12 @@ variety of different intervals, such number of years, months, or days.
**date1** First Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**date2** Second Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**unit** The interval type to use for the calculation
@@ -1230,7 +1230,7 @@ A string, representing a date 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,
+This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
@@ -1290,7 +1290,7 @@ $retVal = call_user_func_array(
##### Notes
-DATEVALUE uses the php date/time object implementation of `strtotime()`
+DATEVALUE uses the php `DateTime` 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.
@@ -1317,7 +1317,7 @@ integer ranging from 1 to 31.
**datetime** Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
##### Return Value
@@ -1371,12 +1371,12 @@ accounting systems.
**date1** First Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**date2** Second Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**method** A boolean flag (TRUE or FALSE)
@@ -1453,7 +1453,7 @@ Excel `TRUE()` and `FALSE()` functions are used instead.
#### EDATE
-The EDATE function returns an Excel timestamp or a PHP timestamp or date
+The EDATE function returns an Excel timestamp or a PHP timestamp or `DateTime`
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
@@ -1467,7 +1467,7 @@ month as the date of issue.
**baseDate** Start Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**months** Number of months to add.
@@ -1480,7 +1480,7 @@ value yields a past date.
**mixed** A date/time stamp that corresponds to the basedate + months.
-This could be a PHP timestamp value (integer), a PHP date/time object,
+This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
@@ -1526,7 +1526,7 @@ 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
+`DateTime` 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.
@@ -1539,7 +1539,7 @@ fall on the last day of the month.
**baseDate** Start Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**months** Number of months to add.
@@ -1553,7 +1553,7 @@ value yields a past date.
**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,
+This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
@@ -1607,7 +1607,7 @@ an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
**datetime** Time.
-An Excel date/time value, PHP date timestamp, PHP date object, or a
+An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a
date/time represented as a string.
##### Return Value
@@ -1665,7 +1665,7 @@ given as an integer, ranging from 0 to 59.
**datetime** Time.
-An Excel date/time value, PHP date timestamp, PHP date object, or a
+An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a
date/time represented as a string.
##### Return Value
@@ -1723,7 +1723,7 @@ integer ranging from 1 to 12.
**datetime** Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
##### Return Value
@@ -1779,12 +1779,12 @@ a specific term.
**startDate** Start Date of the period.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` 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
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**holidays** Optional array of Holiday dates.
@@ -1831,7 +1831,7 @@ There are no parameters for the `NOW()` function.
**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,
+This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType().
@@ -1862,7 +1862,7 @@ given as an integer, ranging from 0 to 59.
**datetime** Time.
-An Excel date/time value, PHP date timestamp, PHP date object, or a
+An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a
date/time represented as a string.
##### Return Value
@@ -1934,7 +1934,7 @@ modified to return a value between 0 and 6.
**datetime** Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
**method** An integer flag (values 0, 1 or 2)
@@ -2012,7 +2012,7 @@ The YEAR function returns the year of a date.
**datetime** Date.
-An Excel date value, PHP date timestamp, PHP date object, or a date
+An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date
represented as a string.
##### Return Value
diff --git a/docs/topics/migration-from-PHPExcel.md b/docs/topics/migration-from-PHPExcel.md
index c34fba7f..04374959 100644
--- a/docs/topics/migration-from-PHPExcel.md
+++ b/docs/topics/migration-from-PHPExcel.md
@@ -192,3 +192,74 @@ $cell = $worksheet->setCellValue('A1', 'value', true);
// After
$cell = $worksheet->getCell('A1')->setValue('value');
```
+
+## Standardized keys for styling
+
+Array keys used for styling have been standardized for a more coherent experience.
+It now uses the same wording and casing as the getter and setter:
+
+```php
+// Before
+$style = [
+ 'numberformat' => [
+ 'code' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
+ ],
+ 'font' => [
+ 'strike' => true,
+ 'superScript' => true,
+ 'subScript' => true,
+ ],
+ 'alignment' => [
+ 'rotation' => 90,
+ 'readorder' => Alignment::READORDER_RTL,
+ 'wrap' => true,
+ ],
+ 'borders' => [
+ 'diagonaldirection' => Borders::DIAGONAL_BOTH,
+ 'allborders' => [
+ 'style' => Border::BORDER_THIN,
+ ],
+ ],
+ 'fill' => [
+ 'type' => Fill::FILL_GRADIENT_LINEAR,
+ 'startcolor' => [
+ 'argb' => 'FFA0A0A0',
+ ],
+ 'endcolor' => [
+ 'argb' => 'FFFFFFFF',
+ ],
+ ],
+];
+
+// After
+$style = [
+ 'numberFormat' => [
+ 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
+ ],
+ 'font' => [
+ 'strikethrough' => true,
+ 'superscript' => true,
+ 'subscript' => true,
+ ],
+ 'alignment' => [
+ 'textRotation' => 90,
+ 'readOrder' => Alignment::READORDER_RTL,
+ 'wrapText' => true,
+ ],
+ 'borders' => [
+ 'diagonalDirection' => Borders::DIAGONAL_BOTH,
+ 'allBorders' => [
+ 'borderStyle' => Border::BORDER_THIN,
+ ],
+ ],
+ 'fill' => [
+ 'fillType' => Fill::FILL_GRADIENT_LINEAR,
+ 'startColor' => [
+ 'argb' => 'FFA0A0A0',
+ ],
+ 'endColor' => [
+ 'argb' => 'FFFFFFFF',
+ ],
+ ],
+];
+```
diff --git a/docs/topics/recipes.md b/docs/topics/recipes.md
index db2fa417..e094e2c5 100644
--- a/docs/topics/recipes.md
+++ b/docs/topics/recipes.md
@@ -558,16 +558,16 @@ $styleArray = array(
),
'borders' => array(
'top' => array(
- 'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
),
),
'fill' => array(
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
+ 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90,
- 'startcolor' => array(
+ 'startColor' => array(
'argb' => 'FFA0A0A0',
),
- 'endcolor' => array(
+ 'endColor' => array(
'argb' => 'FFFFFFFF',
),
),
@@ -693,7 +693,7 @@ B2:G8.
$styleArray = array(
'borders' => array(
'outline' => array(
- 'style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => array('argb' => 'FFFF0000'),
),
),
@@ -721,7 +721,7 @@ operating on a single cell at a time:
Additional shortcut borders come in handy like in the example above.
These are the shortcut borders available:
-- allborders
+- allBorders
- outline
- inside
- vertical
@@ -731,10 +731,10 @@ An overview of all border shortcuts can be seen in the following image:
![08-styling-border-options.png](./images/08-styling-border-options.png)
-If you simultaneously set e.g. allborders and vertical, then we have
+If you simultaneously set e.g. allBorders and vertical, then we have
"overlapping" borders, and one of the components has to win over the
other where there is border overlap. In PhpSpreadsheet, from weakest to
-strongest borders, the list is as follows: allborders, outline/inside,
+strongest borders, the list is as follows: allBorders, outline/inside,
vertical/horizontal, left/right/top/bottom/diagonal.
This border hierarchy can be utilized to achieve various effects in an
@@ -757,17 +757,17 @@ fill | getFill()
font | getFont()
borders | getBorders()
alignment | getAlignment()
-numberformat | getNumberFormat()
+numberFormat | getNumberFormat()
protection | getProtection()
**\PhpOffice\PhpSpreadsheet\Style\Fill**
Array key | Maps to property
-----------|-------------------
-type | setFillType()
+fillType | setFillType()
rotation | setRotation()
-startcolor | getStartColor()
-endcolor | getEndColor()
+startColor | getStartColor()
+endColor | getEndColor()
color | getStartColor()
@@ -779,17 +779,17 @@ name | setName()
bold | setBold()
italic | setItalic()
underline | setUnderline()
-strike | setStrikethrough()
+strikethrough | setStrikethrough()
color | getColor()
size | setSize()
-superScript | setSuperScript()
-subScript | setSubScript()
+superscript | setSuperscript()
+subscript | setSubscript()
**\PhpOffice\PhpSpreadsheet\Style\Borders**
Array key | Maps to property
------------------|-------------------
-allborders | getLeft(); getRight(); getTop(); getBottom()
+allBorders | getLeft(); getRight(); getTop(); getBottom()
left | getLeft()
right | getRight()
top | getTop()
@@ -797,7 +797,7 @@ bottom | getBottom()
diagonal | getDiagonal()
vertical | getVertical()
horizontal | getHorizontal()
-diagonaldirection | setDiagonalDirection()
+diagonalDirection | setDiagonalDirection()
outline | setOutline()
**\PhpOffice\PhpSpreadsheet\Style\Border**
@@ -813,8 +813,8 @@ Array key | Maps to property
------------|-------------------
horizontal | setHorizontal()
vertical | setVertical()
-rotation | setTextRotation()
-wrap | setWrapText()
+textRotation| setTextRotation()
+wrapText | setWrapText()
shrinkToFit | setShrinkToFit()
indent | setIndent()
@@ -822,7 +822,7 @@ indent | setIndent()
Array key | Maps to property
----------|-------------------
-code | setFormatCode()
+formatCode | setFormatCode()
**\PhpOffice\PhpSpreadsheet\Style\Protection**
@@ -910,15 +910,18 @@ practice...
## Setting security on a spreadsheet
-Excel offers 3 levels of "protection": document security, sheet security
-and cell security.
+Excel offers 3 levels of "protection":
-Document security allows you to set a password on a complete
+- Document: allows you to set a password on a complete
spreadsheet, allowing changes to be made only when that password is
-entered.Worksheet security offers other security options: you can
-disallow inserting rows on a specific sheet, disallow sorting, ... Cell
-security offers the option to lock/unlock a cell as well as show/hide
-the internal formulaAn example on setting document security:
+entered.
+- Worksheet: offers other security options: you can
+disallow inserting rows on a specific sheet, disallow sorting, ...
+- Cell: offers the option to lock/unlock a cell as well as show/hide
+the internal formula.
+
+
+An example on setting document security:
``` php
$spreadsheet->getSecurity()->setLockWindows(true);
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 00000000..00620004
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,11 @@
+site_name: PhpSpreadsheet Documentation
+repo_url: https://github.com/PHPOffice/phpspreadsheet
+edit_uri: edit/develop/docs/
+
+theme: readthedocs
+extra_css:
+ - extra/extra.css
+
+extra_javascript:
+ - extra/extra.js
+
\ No newline at end of file
diff --git a/samples/01_Simple.php b/samples/01_Simple.php
index d21de72e..3ba6ba05 100644
--- a/samples/01_Simple.php
+++ b/samples/01_Simple.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/01_Simple_download_ods.php b/samples/01_Simple_download_ods.php
index 8e76e8cf..4031eec6 100644
--- a/samples/01_Simple_download_ods.php
+++ b/samples/01_Simple_download_ods.php
@@ -1,8 +1,12 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@@ -10,7 +14,7 @@ if ($helper->isCli()) {
}
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -52,6 +56,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods');
+$writer = IOFactory::createWriter($spreadsheet, 'Ods');
$writer->save('php://output');
exit;
diff --git a/samples/01_Simple_download_pdf.php b/samples/01_Simple_download_pdf.php
index dc23daa0..04c91a18 100644
--- a/samples/01_Simple_download_pdf.php
+++ b/samples/01_Simple_download_pdf.php
@@ -1,8 +1,13 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@@ -12,11 +17,11 @@ if ($helper->isCli()) {
// Change these values to select the Rendering library that you wish to use
// and its directory location on your server
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
+$rendererName = Settings::PDF_RENDERER_MPDF;
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -46,13 +51,13 @@ $spreadsheet->getActiveSheet()->setShowGridLines(false);
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$spreadsheet->setActiveSheetIndex(0);
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Redirect output to a client’s web browser (PDF)
header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="01simple.pdf"');
header('Cache-Control: max-age=0');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf');
+$writer = IOFactory::createWriter($spreadsheet, 'Pdf');
$writer->save('php://output');
exit;
diff --git a/samples/01_Simple_download_xls.php b/samples/01_Simple_download_xls.php
index 7bfd5cc6..71fcbc7e 100644
--- a/samples/01_Simple_download_xls.php
+++ b/samples/01_Simple_download_xls.php
@@ -1,8 +1,12 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
@@ -10,7 +14,7 @@ if ($helper->isCli()) {
}
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -52,6 +56,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$writer->save('php://output');
exit;
diff --git a/samples/01_Simple_download_xlsx.php b/samples/01_Simple_download_xlsx.php
index 3881d4cc..45ba9bc3 100644
--- a/samples/01_Simple_download_xlsx.php
+++ b/samples/01_Simple_download_xlsx.php
@@ -1,15 +1,19 @@
isCli()) {
echo 'This example should only be run from a Web Browser' . PHP_EOL;
return;
}
// Create new Spreadsheet object
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$spreadsheet->getProperties()->setCreator('Maarten Balliauw')
@@ -51,6 +55,6 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save('php://output');
exit;
diff --git a/samples/02_Types.php b/samples/02_Types.php
index 5fef248d..84bc5002 100644
--- a/samples/02_Types.php
+++ b/samples/02_Types.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -70,41 +76,41 @@ $dateTimeNow = time();
$spreadsheet->getActiveSheet()
->setCellValue('A9', 'Date/Time')
->setCellValue('B9', 'Date')
- ->setCellValue('C9', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
+ ->setCellValue('C9', Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C9')
->getNumberFormat()
- ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
+ ->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
$spreadsheet->getActiveSheet()
->setCellValue('A10', 'Date/Time')
->setCellValue('B10', 'Time')
- ->setCellValue('C10', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
+ ->setCellValue('C10', Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C10')
->getNumberFormat()
- ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4);
+ ->setFormatCode(NumberFormat::FORMAT_DATE_TIME4);
$spreadsheet->getActiveSheet()
->setCellValue('A11', 'Date/Time')
->setCellValue('B11', 'Date and Time')
- ->setCellValue('C11', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($dateTimeNow));
+ ->setCellValue('C11', Date::PHPToExcel($dateTimeNow));
$spreadsheet->getActiveSheet()
->getStyle('C11')
->getNumberFormat()
- ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
+ ->setFormatCode(NumberFormat::FORMAT_DATE_DATETIME);
$spreadsheet->getActiveSheet()
->setCellValue('A12', 'NULL')
->setCellValue('C12', null);
-$richText = new \PhpOffice\PhpSpreadsheet\RichText();
+$richText = new RichText();
$richText->createText('你好 ');
$payable = $richText->createTextRun('你 好 吗?');
$payable->getFont()->setBold(true);
$payable->getFont()->setItalic(true);
-$payable->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN));
+$payable->getFont()->setColor(new Color(Color::COLOR_DARKGREEN));
$richText->createText(', unless specified otherwise on the invoice.');
@@ -112,11 +118,11 @@ $spreadsheet->getActiveSheet()
->setCellValue('A13', 'Rich Text')
->setCellValue('C13', $richText);
-$richText2 = new \PhpOffice\PhpSpreadsheet\RichText();
+$richText2 = new RichText();
$richText2->createText("black text\n");
$red = $richText2->createTextRun('red text');
-$red->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED));
+$red->getFont()->setColor(new Color(Color::COLOR_RED));
$spreadsheet->getActiveSheet()
->getCell('C14')
diff --git a/samples/03_Formulas.php b/samples/03_Formulas.php
index 8896253c..752b99c8 100644
--- a/samples/03_Formulas.php
+++ b/samples/03_Formulas.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/04_Printing.php b/samples/04_Printing.php
index 4434b2f5..e8854821 100644
--- a/samples/04_Printing.php
+++ b/samples/04_Printing.php
@@ -1,10 +1,15 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -34,22 +39,22 @@ $spreadsheet->getActiveSheet()
// Add a drawing to the header
$helper->log('Add a drawing to the header');
-$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing();
+$drawing = new HeaderFooterDrawing();
$drawing->setName('PhpSpreadsheet logo');
$drawing->setPath(__DIR__ . '/images/PhpSpreadsheet_logo.png');
$drawing->setHeight(36);
$spreadsheet->getActiveSheet()
->getHeaderFooter()
- ->addImage($drawing, \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT);
+ ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT);
// Set page orientation and size
$helper->log('Set page orientation and size');
$spreadsheet->getActiveSheet()
->getPageSetup()
- ->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+ ->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
$spreadsheet->getActiveSheet()
->getPageSetup()
- ->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
+ ->setPaperSize(PageSetup::PAPERSIZE_A4);
// Rename worksheet
$helper->log('Rename worksheet');
diff --git a/samples/07_Reader.php b/samples/07_Reader.php
index 2e7b9610..05186521 100644
--- a/samples/07_Reader.php
+++ b/samples/07_Reader.php
@@ -1,15 +1,18 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$writer->save($filename);
$callStartTime = microtime(true);
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheet = IOFactory::load($filename);
$helper->logRead('Xlsx', $filename, $callStartTime);
// Save
diff --git a/samples/08_Conditional_formatting.php b/samples/08_Conditional_formatting.php
index 86019305..36c3aaee 100644
--- a/samples/08_Conditional_formatting.php
+++ b/samples/08_Conditional_formatting.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -47,30 +53,30 @@ $spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(12);
// Add conditional formatting
$helper->log('Add conditional formatting');
-$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_BETWEEN)
+$conditional1 = new Conditional();
+$conditional1->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_BETWEEN)
->addCondition('200')
->addCondition('400');
-$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_YELLOW);
+$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_YELLOW);
$conditional1->getStyle()->getFont()->setBold(true);
-$conditional1->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+$conditional1->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
-$conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
+$conditional2 = new Conditional();
+$conditional2->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_LESSTHAN)
->addCondition('0');
-$conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
+$conditional2->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED);
$conditional2->getStyle()->getFont()->setItalic(true);
-$conditional2->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+$conditional2->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
-$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
+$conditional3 = new Conditional();
+$conditional3->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL)
->addCondition('0');
-$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
+$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN);
$conditional3->getStyle()->getFont()->setItalic(true);
-$conditional3->getStyle()->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+$conditional3->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles();
array_push($conditionalStyles, $conditional1);
@@ -98,8 +104,8 @@ $spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spread
// Set page orientation and size
$helper->log('Set page orientation and size');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_PORTRAIT);
-$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_PORTRAIT);
+$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(PageSetup::PAPERSIZE_A4);
// Rename worksheet
$helper->log('Rename worksheet');
diff --git a/samples/08_Conditional_formatting_2.php b/samples/08_Conditional_formatting_2.php
index 87bd2851..07d2361d 100644
--- a/samples/08_Conditional_formatting_2.php
+++ b/samples/08_Conditional_formatting_2.php
@@ -1,10 +1,15 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -32,22 +37,22 @@ $spreadsheet->getActiveSheet()
$spreadsheet->getActiveSheet()->getStyle('A1:A8')
->getNumberFormat()
->setFormatCode(
- \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_PERCENTAGE_00
+ NumberFormat::FORMAT_PERCENTAGE_00
);
// Add conditional formatting
$helper->log('Add conditional formatting');
-$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN)
+$conditional1 = new Conditional();
+$conditional1->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_LESSTHAN)
->addCondition('0');
-$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED);
+$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED);
-$conditional3 = new \PhpOffice\PhpSpreadsheet\Style\Conditional();
-$conditional3->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS)
- ->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL)
+$conditional3 = new Conditional();
+$conditional3->setConditionType(Conditional::CONDITION_CELLIS)
+ ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL)
->addCondition('1');
-$conditional3->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN);
+$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN);
$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles();
array_push($conditionalStyles, $conditional1);
diff --git a/samples/09_Pagebreaks.php b/samples/09_Pagebreaks.php
index 9b91d2f0..c4cf33af 100644
--- a/samples/09_Pagebreaks.php
+++ b/samples/09_Pagebreaks.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -36,7 +39,7 @@ for ($i = 2; $i <= 50; ++$i) {
// Add page breaks every 10 rows
if ($i % 10 == 0) {
// Add a page break
- $spreadsheet->getActiveSheet()->setBreak('A' . $i, \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_ROW);
+ $spreadsheet->getActiveSheet()->setBreak('A' . $i, Worksheet::BREAK_ROW);
}
}
diff --git a/samples/10_Autofilter.php b/samples/10_Autofilter.php
index 45955a8c..7058e6a5 100644
--- a/samples/10_Autofilter.php
+++ b/samples/10_Autofilter.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/10_Autofilter_selection_1.php b/samples/10_Autofilter_selection_1.php
index 6f74f483..1b34b019 100644
--- a/samples/10_Autofilter_selection_1.php
+++ b/samples/10_Autofilter_selection_1.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +54,7 @@ foreach ($years as $year) {
foreach ($countries as $country) {
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
for ($i = 1; $i <= $endDays; ++$i) {
- $eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
+ $eDate = Date::formattedPHPToExcel(
$year,
$period,
$i
@@ -86,8 +92,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
-$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
-$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
+$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$spreadsheet->getActiveSheet()->freezePane('A2');
@@ -104,45 +110,45 @@ $helper->log('Set active filters');
// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
$autoFilter->getColumn('C')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'japan'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
// Filter the Date column on a filter value of the first day of every period of the current year
// We us a dateGroup ruletype for this, although it is still a standard filter
foreach ($periods as $period) {
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
$autoFilter->getColumn('D')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
[
'year' => $currentYear,
'month' => $period,
'day' => $endDate,
]
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP);
}
// Display only sales values that are blank
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);
diff --git a/samples/10_Autofilter_selection_2.php b/samples/10_Autofilter_selection_2.php
index 1802d0ea..9bfb254a 100644
--- a/samples/10_Autofilter_selection_2.php
+++ b/samples/10_Autofilter_selection_2.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +54,7 @@ foreach ($years as $year) {
foreach ($countries as $country) {
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
for ($i = 1; $i <= $endDays; ++$i) {
- $eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
+ $eDate = Date::formattedPHPToExcel(
$year,
$period,
$i
@@ -86,8 +92,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
-$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
-$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
+$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$spreadsheet->getActiveSheet()->freezePane('A2');
@@ -104,39 +110,39 @@ $helper->log('Set active filters');
// Filter the Country column on a filter value of Germany
// As it's just a simple value filter, we can use FILTERTYPE_FILTER
$autoFilter->getColumn('C')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'Germany'
);
// Filter the Date column on a filter value of the year to date
$autoFilter->getColumn('D')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
null,
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
+ Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
// Display only sales values that are between 400 and 600
$autoFilter->getColumn('E')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
400
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('E')
- ->setJoin(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)
+ ->setJoin(Column::AUTOFILTER_COLUMN_JOIN_AND)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
600
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
// Save
$helper->write($spreadsheet, __FILE__);
diff --git a/samples/10_Autofilter_selection_display.php b/samples/10_Autofilter_selection_display.php
index 0f431e66..2be654d3 100644
--- a/samples/10_Autofilter_selection_display.php
+++ b/samples/10_Autofilter_selection_display.php
@@ -1,10 +1,16 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +54,7 @@ foreach ($years as $year) {
foreach ($countries as $country) {
$endDays = date('t', mktime(0, 0, 0, $period, 1, $year));
for ($i = 1; $i <= $endDays; ++$i) {
- $eDate = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(
+ $eDate = Date::formattedPHPToExcel(
$year,
$period,
$i
@@ -86,8 +92,8 @@ $spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true);
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
-$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDD2);
-$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
+$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14);
$spreadsheet->getActiveSheet()->freezePane('A2');
@@ -104,45 +110,45 @@ $helper->log('Set active filters');
// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
$autoFilter->getColumn('C')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'u*'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
$autoFilter->getColumn('C')
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
'japan'
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
// Filter the Date column on a filter value of the first day of every period of the current year
// We us a dateGroup ruletype for this, although it is still a standard filter
foreach ($periods as $period) {
$endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear));
$autoFilter->getColumn('D')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
[
'year' => $currentYear,
'month' => $period,
'day' => $endDate,
]
)
- ->setRuleType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP);
+ ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP);
}
// Display only sales values that are blank
// Standard filter, operator equals, and value of NULL
$autoFilter->getColumn('E')
- ->setFilterType(\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER)
->createRule()
->setRule(
- \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
''
);
diff --git a/samples/11_Documentsecurity.php b/samples/11_Documentsecurity.php
index 2224808a..0298e7ee 100644
--- a/samples/11_Documentsecurity.php
+++ b/samples/11_Documentsecurity.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/12_CellProtection.php b/samples/12_CellProtection.php
index 4ef97b01..a84bb8a5 100644
--- a/samples/12_CellProtection.php
+++ b/samples/12_CellProtection.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -37,7 +40,7 @@ $spreadsheet->getActiveSheet()->getProtection()->setSheet(true);
$spreadsheet->getActiveSheet()
->getStyle('A2:B2')
->getProtection()->setLocked(
- \PhpOffice\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED
+ Protection::PROTECTION_UNPROTECTED
);
// Save
diff --git a/samples/13_Calculation.php b/samples/13_Calculation.php
index d620a6f2..e143e9ab 100644
--- a/samples/13_Calculation.php
+++ b/samples/13_Calculation.php
@@ -1,17 +1,20 @@
log('List implemented functions');
-$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
+$calc = Calculation::getInstance();
print_r($calc->getImplementedFunctionNames());
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Add some data, we will use some formulas here
$helper->log('Add some data and formulas');
diff --git a/samples/13_CalculationCyclicFormulae.php b/samples/13_CalculationCyclicFormulae.php
index ea1be404..968c467c 100644
--- a/samples/13_CalculationCyclicFormulae.php
+++ b/samples/13_CalculationCyclicFormulae.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Add some data, we will use some formulas here
$helper->log('Add some data and formulas');
@@ -13,7 +16,7 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', '=B1')
->setCellValue('B1', '=A1+1')
->setCellValue('B2', '=A2');
-\PhpOffice\PhpSpreadsheet\Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
+Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100;
// Calculated data
$helper->log('Calculated data');
diff --git a/samples/14_Xls.php b/samples/14_Xls.php
index 86d125b9..03a38d28 100644
--- a/samples/14_Xls.php
+++ b/samples/14_Xls.php
@@ -1,10 +1,12 @@
getFilename(__FILE__, 'xls');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/15_Datavalidation.php b/samples/15_Datavalidation.php
index bd7299d6..416a102a 100644
--- a/samples/15_Datavalidation.php
+++ b/samples/15_Datavalidation.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -35,8 +38,8 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', 'Cell B3 and B5 contain data
// Set data validation
$helper->log('Set data validation');
$validation = $spreadsheet->getActiveSheet()->getCell('B3')->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE);
-$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP);
+$validation->setType(DataValidation::TYPE_WHOLE);
+$validation->setErrorStyle(DataValidation::STYLE_STOP);
$validation->setAllowBlank(true);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
@@ -48,8 +51,8 @@ $validation->setFormula1(10);
$validation->setFormula2(20);
$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
-$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
+$validation->setType(DataValidation::TYPE_LIST);
+$validation->setErrorStyle(DataValidation::STYLE_INFORMATION);
$validation->setAllowBlank(false);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
@@ -61,8 +64,8 @@ $validation->setPrompt('Please pick a value from the drop-down list.');
$validation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!!
$validation = $spreadsheet->getActiveSheet()->getCell('B7')->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
-$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
+$validation->setType(DataValidation::TYPE_LIST);
+$validation->setErrorStyle(DataValidation::STYLE_INFORMATION);
$validation->setAllowBlank(false);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
diff --git a/samples/16_Csv.php b/samples/16_Csv.php
index 63cbd53e..0c1db51d 100644
--- a/samples/16_Csv.php
+++ b/samples/16_Csv.php
@@ -1,10 +1,12 @@
log('Write to CSV format');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',')
+$writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0);
@@ -15,7 +17,7 @@ $helper->logWrite($writer, $filename, $callStartTime);
$helper->log('Read from CSV format');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Csv')->setDelimiter(',')
+$reader = IOFactory::createReader('Csv')->setDelimiter(',')
->setEnclosure('"')
->setSheetIndex(0);
@@ -28,7 +30,7 @@ $helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx']);
// Write CSV
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
-$writerCSV = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheetFromCSV, 'Csv');
+$writerCSV = IOFactory::createWriter($spreadsheetFromCSV, 'Csv');
$writerCSV->setExcelCompatibility(true);
$callStartTime = microtime(true);
diff --git a/samples/17_Html.php b/samples/17_Html.php
index d3dfd5b0..9ea9f0bd 100644
--- a/samples/17_Html.php
+++ b/samples/17_Html.php
@@ -1,10 +1,12 @@
getFilename(__FILE__, 'html');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Html');
+$writer = IOFactory::createWriter($spreadsheet, 'Html');
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/18_Extendedcalculation.php b/samples/18_Extendedcalculation.php
index b7d45b33..e459e9d3 100644
--- a/samples/18_Extendedcalculation.php
+++ b/samples/18_Extendedcalculation.php
@@ -1,16 +1,18 @@
log('List implemented functions');
-$calc = \PhpOffice\PhpSpreadsheet\Calculation::getInstance();
+$calc = Calculation::getInstance();
print_r($calc->getImplementedFunctionNames());
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Add some data, we will use some formulas here
$helper->log('Add some data');
diff --git a/samples/19_Namedrange.php b/samples/19_Namedrange.php
index ea39a335..53c25660 100644
--- a/samples/19_Namedrange.php
+++ b/samples/19_Namedrange.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -28,8 +31,8 @@ $spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:')
// Define named ranges
$helper->log('Define named ranges');
-$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
-$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
+$spreadsheet->addNamedRange(new NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1'));
+$spreadsheet->addNamedRange(new NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2'));
// Rename named ranges
$helper->log('Rename named ranges');
diff --git a/samples/20_Read_Excel2003XML.php b/samples/20_Read_Excel2003XML.php
index e6c1a797..6e2f464d 100644
--- a/samples/20_Read_Excel2003XML.php
+++ b/samples/20_Read_Excel2003XML.php
@@ -1,10 +1,12 @@
logRead('Xml', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Gnumeric.php b/samples/20_Read_Gnumeric.php
index d390dc14..d2c598c4 100644
--- a/samples/20_Read_Gnumeric.php
+++ b/samples/20_Read_Gnumeric.php
@@ -1,10 +1,12 @@
logRead('Gnumeric', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Ods.php b/samples/20_Read_Ods.php
index 37f7d4f7..10a8275c 100644
--- a/samples/20_Read_Ods.php
+++ b/samples/20_Read_Ods.php
@@ -1,10 +1,12 @@
logRead('Ods', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Sylk.php b/samples/20_Read_Sylk.php
index b3baa5a5..c07c9647 100644
--- a/samples/20_Read_Sylk.php
+++ b/samples/20_Read_Sylk.php
@@ -1,10 +1,12 @@
logRead('Slk', $filename, $callStartTime);
// Save
diff --git a/samples/20_Read_Xls.php b/samples/20_Read_Xls.php
index ef8b1eda..542f96a2 100644
--- a/samples/20_Read_Xls.php
+++ b/samples/20_Read_Xls.php
@@ -1,19 +1,21 @@
getTemporaryFilename('xls');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
// Read Xls file
$callStartTime = microtime(true);
-$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheet = IOFactory::load($filename);
$helper->logRead('Xls', $filename, $callStartTime);
// Save
diff --git a/samples/21_Pdf_Domdf.php b/samples/21_Pdf_Domdf.php
index bc891d6f..f13ca72c 100644
--- a/samples/21_Pdf_Domdf.php
+++ b/samples/21_Pdf_Domdf.php
@@ -1,5 +1,8 @@
log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$helper->log('Set orientation to landscape');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
+$rendererName = Settings::PDF_RENDERER_DOMPDF;
$helper->log("Write to PDF format using {$rendererName}");
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Save
$helper->write($spreadsheet, __FILE__, ['Pdf']);
diff --git a/samples/21_Pdf_TCPDF.php b/samples/21_Pdf_TCPDF.php
index 980069fc..1bf75c84 100644
--- a/samples/21_Pdf_TCPDF.php
+++ b/samples/21_Pdf_TCPDF.php
@@ -1,5 +1,8 @@
log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$helper->log('Set orientation to landscape');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
+$rendererName = Settings::PDF_RENDERER_TCPDF;
$helper->log("Write to PDF format using {$rendererName}");
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Save
$helper->write($spreadsheet, __FILE__, ['Pdf']);
diff --git a/samples/21_Pdf_mPDF.php b/samples/21_Pdf_mPDF.php
index b5327a61..8e46f838 100644
--- a/samples/21_Pdf_mPDF.php
+++ b/samples/21_Pdf_mPDF.php
@@ -1,5 +1,8 @@
log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$helper->log('Set orientation to landscape');
-$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
+$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
-$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
+$rendererName = Settings::PDF_RENDERER_MPDF;
$helper->log("Write to PDF format using {$rendererName}");
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
// Save
$helper->write($spreadsheet, __FILE__, ['Pdf']);
diff --git a/samples/22_Heavily_formatted.php b/samples/22_Heavily_formatted.php
index 541f3149..feb2d957 100644
--- a/samples/22_Heavily_formatted.php
+++ b/samples/22_Heavily_formatted.php
@@ -1,10 +1,14 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -22,19 +26,19 @@ $spreadsheet->setActiveSheetIndex(0);
$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'],
],
'borders' => [
- 'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
- 'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
+ 'bottom' => ['borderStyle' => Border::BORDER_THIN],
+ 'right' => ['borderStyle' => Border::BORDER_MEDIUM],
],
]
);
$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'],
],
]
diff --git a/samples/23_Sharedstyles.php b/samples/23_Sharedstyles.php
index 48ffb1ad..1405431c 100644
--- a/samples/23_Sharedstyles.php
+++ b/samples/23_Sharedstyles.php
@@ -1,10 +1,15 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -20,29 +25,29 @@ $spreadsheet->getProperties()->setCreator('Maarten Balliauw')
$helper->log('Add some data');
$spreadsheet->setActiveSheetIndex(0);
-$sharedStyle1 = new \PhpOffice\PhpSpreadsheet\Style();
-$sharedStyle2 = new \PhpOffice\PhpSpreadsheet\Style();
+$sharedStyle1 = new Style();
+$sharedStyle2 = new Style();
$sharedStyle1->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFCCFFCC'],
],
'borders' => [
- 'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
- 'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
+ 'bottom' => ['borderStyle' => Border::BORDER_THIN],
+ 'right' => ['borderStyle' => Border::BORDER_MEDIUM],
],
]
);
$sharedStyle2->applyFromArray(
['fill' => [
- 'type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FFFFFF00'],
],
'borders' => [
- 'bottom' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN],
- 'right' => ['style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM],
+ 'bottom' => ['borderStyle' => Border::BORDER_THIN],
+ 'right' => ['borderStyle' => Border::BORDER_MEDIUM],
],
]
);
diff --git a/samples/24_Readfilter.php b/samples/24_Readfilter.php
index 17912705..f5258604 100644
--- a/samples/24_Readfilter.php
+++ b/samples/24_Readfilter.php
@@ -2,17 +2,20 @@
namespace PhpOffice\PhpSpreadsheet;
+use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
+use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
+
require __DIR__ . '/Header.php';
// Write temporary file
$largeSpreadsheet = require __DIR__ . '/templates/largeSpreadsheet.php';
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($largeSpreadsheet);
+$writer = new Xlsx($largeSpreadsheet);
$filename = $helper->getTemporaryFilename();
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
-class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
+class MyReadFilter implements IReadFilter
{
public function readCell($column, $row, $worksheetName = '')
{
@@ -26,7 +29,7 @@ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
}
$helper->log('Load from Xlsx file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$reader->setReadFilter(new MyReadFilter());
$callStartTime = microtime(true);
$spreadsheet = $reader->load($filename);
diff --git a/samples/25_In_memory_image.php b/samples/25_In_memory_image.php
index aef166f1..5756bd3e 100644
--- a/samples/25_In_memory_image.php
+++ b/samples/25_In_memory_image.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -24,12 +27,12 @@ imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor);
// Add a drawing to the worksheet
$helper->log('Add a drawing to the worksheet');
-$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing();
+$drawing = new MemoryDrawing();
$drawing->setName('Sample image');
$drawing->setDescription('Sample image');
$drawing->setImageResource($gdImage);
-$drawing->setRenderingFunction(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG);
-$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT);
+$drawing->setRenderingFunction(MemoryDrawing::RENDERING_JPEG);
+$drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT);
$drawing->setHeight(36);
$drawing->setWorksheet($spreadsheet->getActiveSheet());
diff --git a/samples/26_Utf8.php b/samples/26_Utf8.php
index 105b0f94..790640a0 100644
--- a/samples/26_Utf8.php
+++ b/samples/26_Utf8.php
@@ -1,16 +1,19 @@
log('Load Xlsx template file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load(__DIR__ . '/templates/26template.xlsx');
/* at this point, we could do some manipulations with the template, but we skip this step */
@@ -18,7 +21,7 @@ $helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']);
// Export to PDF (.pdf)
$helper->log('Write to PDF format');
-\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
+Settings::setPdfRendererName($rendererName);
$helper->write($spreadsheet, __FILE__, ['Pdf']);
// Remove first two rows with field headers before exporting to CSV
@@ -28,7 +31,7 @@ $worksheet->removeRow(1, 2);
// Export to CSV (.csv)
$helper->log('Write to CSV format');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv');
+$writer = IOFactory::createWriter($spreadsheet, 'Csv');
$filename = $helper->getFilename(__FILE__, 'csv');
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/27_Images_Xls.php b/samples/27_Images_Xls.php
index 8fc7bf2b..4923efe2 100644
--- a/samples/27_Images_Xls.php
+++ b/samples/27_Images_Xls.php
@@ -1,10 +1,12 @@
log('Load Xlsx template file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xls');
+$reader = IOFactory::createReader('Xls');
$spreadsheet = $reader->load(__DIR__ . '/templates/27template.xls');
// Save
diff --git a/samples/28_Iterator.php b/samples/28_Iterator.php
index 95bed125..5dbb49e4 100644
--- a/samples/28_Iterator.php
+++ b/samples/28_Iterator.php
@@ -1,16 +1,19 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
$callStartTime = microtime(true);
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load($filename);
$helper->logRead('Xlsx', $filename, $callStartTime);
$helper->log('Iterate worksheets');
diff --git a/samples/29_Advanced_value_binder.php b/samples/29_Advanced_value_binder.php
index 260a612b..7f22c8f0 100644
--- a/samples/29_Advanced_value_binder.php
+++ b/samples/29_Advanced_value_binder.php
@@ -1,5 +1,7 @@
log('Set value binder');
-\PhpOffice\PhpSpreadsheet\Cell::setValueBinder(new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder());
+Cell::setValueBinder(new Cell\AdvancedValueBinder());
// Create new Spreadsheet object
$helper->log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/30_Template.php b/samples/30_Template.php
index ed6f588e..4c6d867b 100644
--- a/samples/30_Template.php
+++ b/samples/30_Template.php
@@ -1,9 +1,12 @@
log('Load from Xls template');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xls');
+$reader = IOFactory::createReader('Xls');
$spreadsheet = $reader->load(__DIR__ . '/templates/30template.xls');
$helper->log('Add new data to the template');
@@ -21,7 +24,7 @@ $data = [['title' => 'Excel for dummies',
],
];
-$spreadsheet->getActiveSheet()->setCellValue('D1', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(time()));
+$spreadsheet->getActiveSheet()->setCellValue('D1', Date::PHPToExcel(time()));
$baseRow = 5;
foreach ($data as $r => $dataRow) {
diff --git a/samples/31_Document_properties_write.php b/samples/31_Document_properties_write.php
index 76aeaa62..15936ffa 100644
--- a/samples/31_Document_properties_write.php
+++ b/samples/31_Document_properties_write.php
@@ -1,11 +1,14 @@
load($inputFileName);
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
@@ -18,7 +21,7 @@ $spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document')
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
@@ -28,7 +31,7 @@ $helper->logEndingNotes();
// Reread File
$helper->log('Reread Xlsx file');
-$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheetRead = IOFactory::load($filename);
// Set properties
$helper->log('Get properties');
@@ -53,9 +56,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
foreach ($customProperties as $customProperty) {
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
- if ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
+ if ($propertyType == Properties::PROPERTY_TYPE_DATE) {
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
- } elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
+ } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) {
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
} else {
$formattedValue = $propertyValue;
diff --git a/samples/31_Document_properties_write_xls.php b/samples/31_Document_properties_write_xls.php
index 38f15354..a427be18 100644
--- a/samples/31_Document_properties_write_xls.php
+++ b/samples/31_Document_properties_write_xls.php
@@ -1,11 +1,14 @@
load($inputFileName);
$helper->logRead($inputFileType, $inputFileName, $callStartTime);
@@ -18,7 +21,7 @@ $spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document')
// Save Excel 95 file
$filename = $helper->getFilename(__FILE__, 'xls');
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
@@ -28,7 +31,7 @@ $helper->logEndingNotes();
// Reread File
$helper->log('Reread Xls file');
-$spreadsheetRead = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
+$spreadsheetRead = IOFactory::load($filename);
// Set properties
$helper->log('Get properties');
@@ -53,9 +56,9 @@ $customProperties = $spreadsheet->getProperties()->getCustomProperties();
foreach ($customProperties as $customProperty) {
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
$propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty);
- if ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE) {
+ if ($propertyType == Properties::PROPERTY_TYPE_DATE) {
$formattedValue = date('d-M-Y H:i:s', $propertyValue);
- } elseif ($propertyType == \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN) {
+ } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) {
$formattedValue = $propertyValue ? 'TRUE' : 'FALSE';
} else {
$formattedValue = $propertyValue;
diff --git a/samples/32_Chart_read_write.php b/samples/32_Chart_read_write.php
index 2ae0b8ae..6668280c 100644
--- a/samples/32_Chart_read_write.php
+++ b/samples/32_Chart_read_write.php
@@ -1,5 +1,7 @@
log('File ' . $inputFileNameShort . ' does not exist');
continue;
}
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$callStartTime = microtime(true);
$spreadsheet = $reader->load($inputFileName);
@@ -69,7 +71,7 @@ foreach ($inputFileNames as $inputFileName) {
}
$outputFileName = $helper->getFilename($inputFileName);
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+ $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($outputFileName);
diff --git a/samples/32_Chart_read_write_HTML.php b/samples/32_Chart_read_write_HTML.php
index aa697efd..ac2d1e1b 100644
--- a/samples/32_Chart_read_write_HTML.php
+++ b/samples/32_Chart_read_write_HTML.php
@@ -1,14 +1,17 @@
log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
return;
@@ -35,7 +38,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
@@ -83,7 +86,7 @@ foreach ($inputFileNames as $inputFileName) {
// Save
$filename = $helper->getFilename($inputFileName);
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Html');
+ $writer = IOFactory::createWriter($spreadsheet, 'Html');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/32_Chart_read_write_PDF.php b/samples/32_Chart_read_write_PDF.php
index d41f6728..ffd4ba40 100644
--- a/samples/32_Chart_read_write_PDF.php
+++ b/samples/32_Chart_read_write_PDF.php
@@ -1,22 +1,25 @@
log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
return;
@@ -43,7 +46,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file " . $inputFileNameShort);
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
@@ -91,7 +94,7 @@ foreach ($inputFileNames as $inputFileName) {
// Save
$filename = $helper->getFilename($inputFileName);
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf');
+ $writer = IOFactory::createWriter($spreadsheet, 'Pdf');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_area.php b/samples/33_Chart_create_area.php
index 550f8133..2fba7ca7 100644
--- a/samples/33_Chart_create_area.php
+++ b/samples/33_Chart_create_area.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -45,15 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_AREACHART, // plotType
+ DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,15 +69,15 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test %age-Stacked Area Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -89,7 +97,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_bar.php b/samples/33_Chart_create_bar.php
index 6889956b..96ac5ef7 100644
--- a/samples/33_Chart_create_bar.php
+++ b/samples/33_Chart_create_bar.php
@@ -1,5 +1,6 @@
getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_bar_stacked.php b/samples/33_Chart_create_bar_stacked.php
index f4bb87bc..86178d79 100644
--- a/samples/33_Chart_create_bar_stacked.php
+++ b/samples/33_Chart_create_bar_stacked.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -45,15 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,18 +69,18 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a horizontal bar rather than a vertical column graph
-$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_BAR);
+$series->setPlotDirection(DataSeries::DIRECTION_BAR);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -92,7 +100,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_column.php b/samples/33_Chart_create_column.php
index 1d4023cf..49d65c75 100644
--- a/samples/33_Chart_create_column.php
+++ b/samples/33_Chart_create_column.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -45,15 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,18 +69,18 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Column Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -92,7 +100,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_column_2.php b/samples/33_Chart_create_column_2.php
index d459dd5b..f4afcedb 100644
--- a/samples/33_Chart_create_column_2.php
+++ b/samples/33_Chart_create_column_2.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -31,9 +39,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 'Budget'
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 'Forecast'
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), // 'Actual'
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 'Budget'
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 'Forecast'
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$E$1', null, 1), // 'Actual'
];
// Set the X-Axis Labels
// Datatype
@@ -43,7 +51,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$B$13', null, 12), // Q1 to Q4 for 2010 to 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$B$13', null, 12), // Q1 to Q4 for 2010 to 2012
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -53,15 +61,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$E$2:$E$13', null, 12),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -69,19 +77,19 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_BOTTOM, null, false);
+$legend = new Legend(Legend::POSITION_BOTTOM, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Grouped Column Chart');
-$xAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Financial Period');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Grouped Column Chart');
+$xAxisLabel = new Title('Financial Period');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -101,7 +109,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_composite.php b/samples/33_Chart_create_composite.php
index 57abd991..692209f8 100644
--- a/samples/33_Chart_create_composite.php
+++ b/samples/33_Chart_create_composite.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -31,13 +39,13 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // Temperature
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // Temperature
];
$dataSeriesLabels2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // Rainfall
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // Rainfall
];
$dataSeriesLabels3 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // Humidity
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // Humidity
];
// Set the X-Axis Labels
@@ -48,7 +56,7 @@ $dataSeriesLabels3 = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
];
// Set the Data values for each data series we want to plot
@@ -59,13 +67,13 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$13', null, 12),
];
// Build the dataseries
-$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_CLUSTERED, // plotGrouping
+$series1 = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_CLUSTERED, // plotGrouping
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues, // plotCategory
@@ -73,7 +81,7 @@ $series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series1->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series1->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the Data values for each data series we want to plot
// Datatype
@@ -83,13 +91,13 @@ $series1->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION
// Data values
// Data Marker
$dataSeriesValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12),
];
// Build the dataseries
-$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series2 = new DataSeries(
+ DataSeries::TYPE_LINECHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
null, // plotCategory
@@ -104,13 +112,13 @@ $series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
// Data values
// Data Marker
$dataSeriesValues3 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12),
];
// Build the dataseries
-$series3 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series3 = new DataSeries(
+ DataSeries::TYPE_AREACHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels3, // plotLabel
null, // plotCategory
@@ -118,14 +126,14 @@ $series3 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series1, $series2, $series3]);
+$plotArea = new PlotArea(null, [$series1, $series2, $series3]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Average Weather Chart for Crete');
+$title = new Title('Average Weather Chart for Crete');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -145,7 +153,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_line.php b/samples/33_Chart_create_line.php
index 556f9530..0f1184f6 100644
--- a/samples/33_Chart_create_line.php
+++ b/samples/33_Chart_create_line.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -45,15 +53,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_LINECHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STACKED, // plotGrouping
+$series = new DataSeries(
+ DataSeries::TYPE_LINECHART, // plotType
+ DataSeries::GROUPING_STACKED, // plotGrouping
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
@@ -61,15 +69,15 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stacked Line Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Stacked Line Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -89,7 +97,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_multiple_charts.php b/samples/33_Chart_create_multiple_charts.php
index d8ce1a20..bd2cf606 100644
--- a/samples/33_Chart_create_multiple_charts.php
+++ b/samples/33_Chart_create_multiple_charts.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,9 +31,9 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -35,7 +43,7 @@ $dataSeriesLabels1 = [
// Data values
// Data Marker
$xAxisTickValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -45,15 +53,15 @@ $xAxisTickValues1 = [
// Data values
// Data Marker
$dataSeriesValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_AREACHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
+$series1 = new DataSeries(
+ DataSeries::TYPE_AREACHART, // plotType
+ DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
$xAxisTickValues1, // plotCategory
@@ -61,15 +69,15 @@ $series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea1 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series1]);
+$plotArea1 = new PlotArea(null, [$series1]);
// Set the chart legend
-$legend1 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend1 = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test %age-Stacked Area Chart');
-$yAxisLabel1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title1 = new Title('Test %age-Stacked Area Chart');
+$yAxisLabel1 = new Title('Value ($k)');
// Create the chart
-$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart1 = new Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@@ -95,9 +103,9 @@ $worksheet->addChart($chart1);
// Data values
// Data Marker
$dataSeriesLabels2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -107,7 +115,7 @@ $dataSeriesLabels2 = [
// Data values
// Data Marker
$xAxisTickValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -117,15 +125,15 @@ $xAxisTickValues2 = [
// Data values
// Data Marker
$dataSeriesValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_BARCHART, // plotType
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::GROUPING_STANDARD, // plotGrouping
+$series2 = new DataSeries(
+ DataSeries::TYPE_BARCHART, // plotType
+ DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
$xAxisTickValues2, // plotCategory
@@ -133,18 +141,18 @@ $series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set additional dataseries parameters
// Make it a vertical column rather than a horizontal bar graph
-$series2->setPlotDirection(\PhpOffice\PhpSpreadsheet\Chart\DataSeries::DIRECTION_COL);
+$series2->setPlotDirection(DataSeries::DIRECTION_COL);
// Set the series in the plot area
-$plotArea2 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series2]);
+$plotArea2 = new PlotArea(null, [$series2]);
// Set the chart legend
-$legend2 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend2 = new Legend(Legend::POSITION_RIGHT, null, false);
-$title2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Column Chart');
-$yAxisLabel2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title2 = new Title('Test Column Chart');
+$yAxisLabel2 = new Title('Value ($k)');
// Create the chart
-$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart2 = new Chart(
'chart2', // name
$title2, // title
$legend2, // legend
@@ -164,7 +172,7 @@ $worksheet->addChart($chart2);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_pie.php b/samples/33_Chart_create_pie.php
index c8a23909..3b5ea810 100644
--- a/samples/33_Chart_create_pie.php
+++ b/samples/33_Chart_create_pie.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,7 +31,7 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
];
// Set the X-Axis Labels
// Datatype
@@ -33,7 +41,7 @@ $dataSeriesLabels1 = [
// Data values
// Data Marker
$xAxisTickValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -43,12 +51,12 @@ $xAxisTickValues1 = [
// Data values
// Data Marker
$dataSeriesValues1 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
];
// Build the dataseries
-$series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_PIECHART, // plotType
+$series1 = new DataSeries(
+ DataSeries::TYPE_PIECHART, // plotType
null, // plotGrouping (Pie charts don't have any grouping)
range(0, count($dataSeriesValues1) - 1), // plotOrder
$dataSeriesLabels1, // plotLabel
@@ -57,19 +65,19 @@ $series1 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set up a layout object for the Pie chart
-$layout1 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
+$layout1 = new Chart\Layout();
$layout1->setShowVal(true);
$layout1->setShowPercent(true);
// Set the series in the plot area
-$plotArea1 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout1, [$series1]);
+$plotArea1 = new PlotArea($layout1, [$series1]);
// Set the chart legend
-$legend1 = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend1 = new Legend(Legend::POSITION_RIGHT, null, false);
-$title1 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Pie Chart');
+$title1 = new Title('Test Pie Chart');
// Create the chart
-$chart1 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart1 = new Chart(
'chart1', // name
$title1, // title
$legend1, // legend
@@ -95,7 +103,7 @@ $worksheet->addChart($chart1);
// Data values
// Data Marker
$dataSeriesLabels2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
];
// Set the X-Axis Labels
// Datatype
@@ -105,7 +113,7 @@ $dataSeriesLabels2 = [
// Data values
// Data Marker
$xAxisTickValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -115,12 +123,12 @@ $xAxisTickValues2 = [
// Data values
// Data Marker
$dataSeriesValues2 = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
];
// Build the dataseries
-$series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_DONUTCHART, // plotType
+$series2 = new DataSeries(
+ DataSeries::TYPE_DONUTCHART, // plotType
null, // plotGrouping (Donut charts don't have any grouping)
range(0, count($dataSeriesValues2) - 1), // plotOrder
$dataSeriesLabels2, // plotLabel
@@ -129,17 +137,17 @@ $series2 = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set up a layout object for the Pie chart
-$layout2 = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
+$layout2 = new Chart\Layout();
$layout2->setShowVal(true);
$layout2->setShowCatName(true);
// Set the series in the plot area
-$plotArea2 = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout2, [$series2]);
+$plotArea2 = new PlotArea($layout2, [$series2]);
-$title2 = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Donut Chart');
+$title2 = new Title('Test Donut Chart');
// Create the chart
-$chart2 = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart2 = new Chart(
'chart2', // name
$title2, // title
null, // legend
@@ -159,7 +167,7 @@ $worksheet->addChart($chart2);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_radar.php b/samples/33_Chart_create_radar.php
index 2a978792..49053c95 100644
--- a/samples/33_Chart_create_radar.php
+++ b/samples/33_Chart_create_radar.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -31,8 +39,8 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
// Datatype
@@ -42,8 +50,8 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -53,13 +61,13 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', null, 12),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_RADARCHART, // plotType
+$series = new DataSeries(
+ DataSeries::TYPE_RADARCHART, // plotType
null, // plotGrouping (Radar charts don't have any grouping)
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@@ -67,21 +75,21 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
$dataSeriesValues, // plotValues
null, // plotDirection
null, // smooth line
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::STYLE_MARKER // plotStyle
+ DataSeries::STYLE_MARKER // plotStyle
);
// Set up a layout object for the Pie chart
-$layout = new \PhpOffice\PhpSpreadsheet\Chart\Layout();
+$layout = new Chart\Layout();
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea($layout, [$series]);
+$plotArea = new PlotArea($layout, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Radar Chart');
+$title = new Title('Test Radar Chart');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -101,7 +109,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_scatter.php b/samples/33_Chart_create_scatter.php
index 205113ab..f756c5a9 100644
--- a/samples/33_Chart_create_scatter.php
+++ b/samples/33_Chart_create_scatter.php
@@ -1,9 +1,17 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -23,13 +31,13 @@ $worksheet->fromArray(
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), // 2010
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), // 2011
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), // 2012
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012
];
// Set the X-Axis Labels
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -39,14 +47,14 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', null, 4),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_SCATTERCHART, // plotType
+$series = new DataSeries(
+ DataSeries::TYPE_SCATTERCHART, // plotType
null, // plotGrouping (Scatter charts don't have any grouping)
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@@ -54,19 +62,19 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
$dataSeriesValues, // plotValues
null, // plotDirection
null, // smooth line
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::STYLE_LINEMARKER // plotStyle
+ DataSeries::STYLE_LINEMARKER // plotStyle
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_TOPRIGHT, null, false);
+$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Scatter Chart');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Value ($k)');
+$title = new Title('Test Scatter Chart');
+$yAxisLabel = new Title('Value ($k)');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'chart1', // name
$title, // title
$legend, // legend
@@ -86,7 +94,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/33_Chart_create_stock.php b/samples/33_Chart_create_stock.php
index eea2a430..30c876b5 100644
--- a/samples/33_Chart_create_stock.php
+++ b/samples/33_Chart_create_stock.php
@@ -1,9 +1,18 @@
getActiveSheet();
$worksheet->fromArray(
[
@@ -18,7 +27,7 @@ $worksheet->fromArray(
'A1',
true
);
-$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_00);
+$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER_00);
// Set the Labels for each data series we want to plot
// Datatype
@@ -28,10 +37,10 @@ $worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSp
// Data values
// Data Marker
$dataSeriesLabels = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$B$1', null, 1), //Max / Open
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$C$1', null, 1), //Min / Close
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$D$1', null, 1), //Min Threshold / Min
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$E$1', null, 1), //Max Threshold / Max
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), //Max / Open
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), //Min / Close
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), //Min Threshold / Min
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$E$1', null, 1), //Max Threshold / Max
];
// Set the X-Axis Labels
// Datatype
@@ -41,7 +50,7 @@ $dataSeriesLabels = [
// Data values
// Data Marker
$xAxisTickValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$6', null, 5), // Counts
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$6', null, 5), // Counts
];
// Set the Data values for each data series we want to plot
// Datatype
@@ -51,15 +60,15 @@ $xAxisTickValues = [
// Data values
// Data Marker
$dataSeriesValues = [
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', null, 5),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', null, 5),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', null, 5),
- new \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', null, 5),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$6', null, 5),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$6', null, 5),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$6', null, 5),
+ new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$E$2:$E$6', null, 5),
];
// Build the dataseries
-$series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
- \PhpOffice\PhpSpreadsheet\Chart\DataSeries::TYPE_STOCKCHART, // plotType
+$series = new DataSeries(
+ DataSeries::TYPE_STOCKCHART, // plotType
null, // plotGrouping - if we set this to not null, then xlsx throws error
range(0, count($dataSeriesValues) - 1), // plotOrder
$dataSeriesLabels, // plotLabel
@@ -68,16 +77,16 @@ $series = new \PhpOffice\PhpSpreadsheet\Chart\DataSeries(
);
// Set the series in the plot area
-$plotArea = new \PhpOffice\PhpSpreadsheet\Chart\PlotArea(null, [$series]);
+$plotArea = new PlotArea(null, [$series]);
// Set the chart legend
-$legend = new \PhpOffice\PhpSpreadsheet\Chart\Legend(\PhpOffice\PhpSpreadsheet\Chart\Legend::POSITION_RIGHT, null, false);
+$legend = new Legend(Legend::POSITION_RIGHT, null, false);
-$title = new \PhpOffice\PhpSpreadsheet\Chart\Title('Test Stock Chart');
-$xAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Counts');
-$yAxisLabel = new \PhpOffice\PhpSpreadsheet\Chart\Title('Values');
+$title = new Title('Test Stock Chart');
+$xAxisLabel = new Title('Counts');
+$yAxisLabel = new Title('Values');
// Create the chart
-$chart = new \PhpOffice\PhpSpreadsheet\Chart(
+$chart = new Chart(
'stock-chart', // name
$title, // title
$legend, // legend
@@ -97,7 +106,7 @@ $worksheet->addChart($chart);
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/34_Chart_update.php b/samples/34_Chart_update.php
index 0a3c6e5a..bed5241d 100644
--- a/samples/34_Chart_update.php
+++ b/samples/34_Chart_update.php
@@ -1,16 +1,18 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$writer->save($filename);
$helper->log('Load from Xlsx file');
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
+$reader = IOFactory::createReader('Xlsx');
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($filename);
@@ -29,7 +31,7 @@ $worksheet->fromArray(
// Save Excel 2007 file
$filename = $helper->getFilename(__FILE__);
-$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->setIncludeCharts(true);
$callStartTime = microtime(true);
$writer->save($filename);
diff --git a/samples/35_Chart_render.php b/samples/35_Chart_render.php
index b472f206..a63b28ef 100644
--- a/samples/35_Chart_render.php
+++ b/samples/35_Chart_render.php
@@ -1,14 +1,17 @@
log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
return;
@@ -35,7 +38,7 @@ foreach ($inputFileNames as $inputFileName) {
$helper->log("Load Test from $inputFileType file ", $inputFileNameShort);
- $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+ $reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
diff --git a/samples/37_Page_layout_view.php b/samples/37_Page_layout_view.php
index 42cc1beb..2cdb3e12 100644
--- a/samples/37_Page_layout_view.php
+++ b/samples/37_Page_layout_view.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -23,7 +26,7 @@ $spreadsheet->setActiveSheetIndex(0)
->setCellValue('B2', 'world!');
// Set the page layout view as page layout
-$spreadsheet->getActiveSheet()->getSheetView()->setView(\PhpOffice\PhpSpreadsheet\Worksheet\SheetView::SHEETVIEW_PAGE_LAYOUT);
+$spreadsheet->getActiveSheet()->getSheetView()->setView(SheetView::SHEETVIEW_PAGE_LAYOUT);
// Save
$helper->write($spreadsheet, __FILE__);
diff --git a/samples/38_Clone_worksheet.php b/samples/38_Clone_worksheet.php
index aa555c39..b55b9025 100644
--- a/samples/38_Clone_worksheet.php
+++ b/samples/38_Clone_worksheet.php
@@ -1,10 +1,12 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
diff --git a/samples/39_Dropdown.php b/samples/39_Dropdown.php
index d4c0306e..bb68c3e9 100644
--- a/samples/39_Dropdown.php
+++ b/samples/39_Dropdown.php
@@ -1,10 +1,14 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -39,7 +43,7 @@ foreach ($continents as $key => $filename) {
$spreadsheet->getActiveSheet()
->fromArray($countries, null, $column . '1');
$spreadsheet->addNamedRange(
- new \PhpOffice\PhpSpreadsheet\NamedRange(
+ new NamedRange(
$continent,
$spreadsheet->getActiveSheet(),
$column . '1:' . $column . $countryCount
@@ -61,7 +65,7 @@ $spreadsheet->getActiveSheet()
->setVisible(false);
$spreadsheet->addNamedRange(
- new \PhpOffice\PhpSpreadsheet\NamedRange(
+ new NamedRange(
'Continents',
$spreadsheet->getActiveSheet(),
$continentColumn . '1:' . $continentColumn . count($continents)
@@ -85,8 +89,8 @@ $spreadsheet->getActiveSheet()
$validation = $spreadsheet->getActiveSheet()
->getCell('B1')
->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
- ->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
+$validation->setType(DataValidation::TYPE_LIST)
+ ->setErrorStyle(DataValidation::STYLE_INFORMATION)
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)
@@ -106,8 +110,8 @@ $spreadsheet->getActiveSheet()
$validation = $spreadsheet->getActiveSheet()
->getCell('B3')
->getDataValidation();
-$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST)
- ->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION)
+$validation->setType(DataValidation::TYPE_LIST)
+ ->setErrorStyle(DataValidation::STYLE_INFORMATION)
->setAllowBlank(false)
->setShowInputMessage(true)
->setShowErrorMessage(true)
diff --git a/samples/40_Duplicate_style.php b/samples/40_Duplicate_style.php
index dca84817..4a006f90 100644
--- a/samples/40_Duplicate_style.php
+++ b/samples/40_Duplicate_style.php
@@ -1,15 +1,19 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
$worksheet = $spreadsheet->getActiveSheet();
$helper->log('Create styles array');
$styles = [];
for ($i = 0; $i < 10; ++$i) {
- $style = new \PhpOffice\PhpSpreadsheet\Style();
+ $style = new Style();
$style->getFont()->setSize($i + 4);
$styles[] = $style;
}
@@ -20,7 +24,7 @@ for ($col = 0; $col < 50; ++$col) {
for ($row = 0; $row < 100; ++$row) {
$str = ($row + $col);
$style = $styles[$row % 10];
- $coord = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($col) . ($row + 1);
+ $coord = Cell::stringFromColumnIndex($col) . ($row + 1);
$worksheet->setCellValue($coord, $str);
$worksheet->duplicateStyle($style, $coord);
}
diff --git a/samples/42_RichText.php b/samples/42_RichText.php
index 53b1c573..88db805c 100644
--- a/samples/42_RichText.php
+++ b/samples/42_RichText.php
@@ -1,10 +1,13 @@
log('Create new Spreadsheet object');
-$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
+$spreadsheet = new Spreadsheet();
// Set document properties
$helper->log('Set document properties');
@@ -48,7 +51,7 @@ $html4 = 'H2SO4 is the chemical formula for Sulphuric acid
$html5 = 'bold, italic, bold+italic';
-$wizard = new \PhpOffice\PhpSpreadsheet\Helper\Html();
+$wizard = new HtmlHelper();
$richText = $wizard->toRichTextObject($html1);
$spreadsheet->getActiveSheet()
diff --git a/samples/43_Merge_workbooks.php b/samples/43_Merge_workbooks.php
index 6173a2d5..57721a4a 100644
--- a/samples/43_Merge_workbooks.php
+++ b/samples/43_Merge_workbooks.php
@@ -1,17 +1,19 @@
log('Load MergeBook1 from Xlsx file');
$filename1 = __DIR__ . '/templates/43mergeBook1.xlsx';
$callStartTime = microtime(true);
-$spreadsheet1 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename1);
+$spreadsheet1 = IOFactory::load($filename1);
$helper->logRead('Xlsx', $filename1, $callStartTime);
$helper->log('Load MergeBook2 from Xlsx file');
$filename2 = __DIR__ . '/templates/43mergeBook2.xlsx';
$callStartTime = microtime(true);
-$spreadsheet2 = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename2);
+$spreadsheet2 = IOFactory::load($filename2);
$helper->logRead('Xlsx', $filename2, $callStartTime);
foreach ($spreadsheet2->getSheetNames() as $sheetName) {
diff --git a/samples/44_Worksheet_info.php b/samples/44_Worksheet_info.php
index 71849ca4..cacb9ae6 100644
--- a/samples/44_Worksheet_info.php
+++ b/samples/44_Worksheet_info.php
@@ -1,15 +1,18 @@
getTemporaryFilename();
-$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($sampleSpreadsheet);
+$writer = new Xlsx($sampleSpreadsheet);
$writer->save($filename);
-$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($filename);
-$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
+$inputFileType = IOFactory::identify($filename);
+$reader = IOFactory::createReader($inputFileType);
$sheetList = $reader->listWorksheetNames($filename);
$sheetInfo = $reader->listWorksheetInfo($filename);
diff --git a/samples/45_Quadratic_equation_solver.php b/samples/45_Quadratic_equation_solver.php
index f5e11e47..39f6685d 100644
--- a/samples/45_Quadratic_equation_solver.php
+++ b/samples/45_Quadratic_equation_solver.php
@@ -1,4 +1,6 @@