diff --git a/docs/Examples/Calculations/Database/DAVERAGE.php b/docs/Examples/Calculations/Database/DAVERAGE.php
index c2d31a6a..be87d3ef 100644
--- a/docs/Examples/Calculations/Database/DAVERAGE.php
+++ b/docs/Examples/Calculations/Database/DAVERAGE.php
@@ -6,76 +6,73 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DAVERAGE
-Returns the average of selected database entries.
-DAVERAGE
+ Returns the average of selected database entries.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height');
+ $worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
-$worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height');
-$worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
+ $worksheet->setCellValue('A13', 'The Average age of all Apple and Pear trees in the orchard');
+ $worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)');
-$worksheet->setCellValue('A13', 'The Average age of all Apple and Pear trees in the orchard');
-$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
-var_dump($criteriaData);
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DAVERAGE() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DAVERAGE() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DAVERAGE() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DAVERAGE() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DCOUNT.php b/docs/Examples/Calculations/Database/DCOUNT.php
index d7bf2045..4387d8fa 100644
--- a/docs/Examples/Calculations/Database/DCOUNT.php
+++ b/docs/Examples/Calculations/Database/DCOUNT.php
@@ -6,76 +6,73 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DCOUNT
-Counts the cells that contain numbers in a database.
-DCOUNT
+ Counts the cells that contain numbers in a database.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height');
+ $worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)');
-$worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height');
-$worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)');
+ $worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard');
+ $worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)');
-$worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard');
-$worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true);
-var_dump($criteriaData);
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DCOUNT() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DCOUNT() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DCOUNT() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DCOUNT() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DGET.php b/docs/Examples/Calculations/Database/DGET.php
index 819120cb..59dd9529 100644
--- a/docs/Examples/Calculations/Database/DGET.php
+++ b/docs/Examples/Calculations/Database/DGET.php
@@ -6,72 +6,69 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DGET
-Extracts a single value from a column of a list or database that matches conditions that you specify.
-DGET
+ Extracts a single value from a column of a list or database that matches conditions that you specify.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall');
+ $worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)');
-$worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall');
-$worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ echo 'ALL' . '
';
-echo 'ALL' . '
';
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DMAX.php b/docs/Examples/Calculations/Database/DMAX.php
index 4fe13da6..bc0af306 100644
--- a/docs/Examples/Calculations/Database/DMAX.php
+++ b/docs/Examples/Calculations/Database/DMAX.php
@@ -6,75 +6,72 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DMAX
-Returns the maximum value from selected database entries.
-DMAX
+ Returns the maximum value from selected database entries.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The tallest tree in the orchard');
+ $worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)');
-$worksheet->setCellValue('A12', 'The tallest tree in the orchard');
-$worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)');
+ $worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard');
+ $worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)');
-$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard');
-$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ echo 'ALL' . '
';
-echo 'ALL' . '
';
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DMIN.php b/docs/Examples/Calculations/Database/DMIN.php
index b765c061..9f36786a 100644
--- a/docs/Examples/Calculations/Database/DMIN.php
+++ b/docs/Examples/Calculations/Database/DMIN.php
@@ -6,75 +6,72 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DMIN
-Returns the minimum value from selected database entries.
-DMIN
+ Returns the minimum value from selected database entries.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The shortest tree in the orchard');
+ $worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)');
-$worksheet->setCellValue('A12', 'The shortest tree in the orchard');
-$worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)');
+ $worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard');
+ $worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)');
-$worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard');
-$worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ echo 'ALL' . '
';
-echo 'ALL' . '
';
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DMIN() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DMIN() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DMIN() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DMIN() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DPRODUCT.php b/docs/Examples/Calculations/Database/DPRODUCT.php
index 4cf234d3..92efcf08 100644
--- a/docs/Examples/Calculations/Database/DPRODUCT.php
+++ b/docs/Examples/Calculations/Database/DPRODUCT.php
@@ -6,72 +6,69 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DPRODUCT
-Multiplies the values in a column of a list or database that match conditions that you specify.
-DPRODUCT
+ Multiplies the values in a column of a list or database that match conditions that you specify.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The product of the yields of all Apple trees over 10\' in the orchard');
+ $worksheet->setCellValue('B12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
-$worksheet->setCellValue('A12', 'The product of the yields of all Apple trees over 10\' in the orchard');
-$worksheet->setCellValue('B12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ echo 'ALL' . '
';
-echo 'ALL' . '
';
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DSTDEV.php b/docs/Examples/Calculations/Database/DSTDEV.php
index 8aeaf2d8..8eaf133e 100644
--- a/docs/Examples/Calculations/Database/DSTDEV.php
+++ b/docs/Examples/Calculations/Database/DSTDEV.php
@@ -6,76 +6,73 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DSTDEV
-Estimates the standard deviation based on a sample of selected database entries.
-DSTDEV
+ Estimates the standard deviation based on a sample of selected database entries.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The estimated standard deviation in the yield of Apple and Pear trees');
+ $worksheet->setCellValue('B12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
-$worksheet->setCellValue('A12', 'The estimated standard deviation in the yield of Apple and Pear trees');
-$worksheet->setCellValue('B12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
+ $worksheet->setCellValue('A13', 'The estimated standard deviation in height of Apple and Pear trees');
+ $worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)');
-$worksheet->setCellValue('A13', 'The estimated standard deviation in height of Apple and Pear trees');
-$worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DSTDEV() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DSTDEV() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DSTDEV() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DSTDEV() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DSTDEVP.php b/docs/Examples/Calculations/Database/DSTDEVP.php
index 0a562c65..ea9a5345 100644
--- a/docs/Examples/Calculations/Database/DSTDEVP.php
+++ b/docs/Examples/Calculations/Database/DSTDEVP.php
@@ -6,76 +6,73 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DSTDEVP
-Calculates the standard deviation based on the entire population of selected database entries.
-DSTDEVP
+ Calculates the standard deviation based on the entire population of selected database entries.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The standard deviation in the yield of Apple and Pear trees');
+ $worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
-$worksheet->setCellValue('A12', 'The standard deviation in the yield of Apple and Pear trees');
-$worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
+ $worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees');
+ $worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)');
-$worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees');
-$worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DSTDEVP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DSTDEVP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DSTDEVP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DSTDEVP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DVAR.php b/docs/Examples/Calculations/Database/DVAR.php
index b49020bf..2349845e 100644
--- a/docs/Examples/Calculations/Database/DVAR.php
+++ b/docs/Examples/Calculations/Database/DVAR.php
@@ -6,76 +6,73 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DVAR
-Estimates variance based on a sample from selected database entries.
-DVAR
+ Estimates variance based on a sample from selected database entries.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The estimated variance in the yield of Apple and Pear trees');
+ $worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)');
-$worksheet->setCellValue('A12', 'The estimated variance in the yield of Apple and Pear trees');
-$worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)');
+ $worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees');
+ $worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)');
-$worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees');
-$worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DVAR() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DVAR() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DVAR() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DVAR() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/Database/DVARP.php b/docs/Examples/Calculations/Database/DVARP.php
index 83d06fba..a9b053a5 100644
--- a/docs/Examples/Calculations/Database/DVARP.php
+++ b/docs/Examples/Calculations/Database/DVARP.php
@@ -6,76 +6,73 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DVARP
-Calculates variance based on the entire population of selected database entries,
-DVARP
+ Calculates variance based on the entire population of selected database entries,
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
+ ['Apple', 18, 20, 14, 105.00],
+ ['Pear', 12, 12, 10, 96.00],
+ ['Cherry', 13, 14, 9, 105.00],
+ ['Apple', 14, 15, 10, 75.00],
+ ['Pear', 9, 8, 8, 76.80],
+ ['Apple', 8, 9, 6, 45.00],
+ ];
+ $criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
+ ['="=Apple"', '>10', null, null, null, '<16'],
+ ['="=Pear"', null, null, null, null, null],
+ ];
-// Add some data
-$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'],
- ['Apple', 18, 20, 14, 105.00],
- ['Pear', 12, 12, 10, 96.00],
- ['Cherry', 13, 14, 9, 105.00],
- ['Apple', 14, 15, 10, 75.00],
- ['Pear', 9, 8, 8, 76.80],
- ['Apple', 8, 9, 6, 45.00],
- ];
-$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'],
- ['="=Apple"', '>10', null, null, null, '<16'],
- ['="=Pear"', null, null, null, null, null],
- ];
+ $worksheet->fromArray($criteria, null, 'A1');
+ $worksheet->fromArray($database, null, 'A4');
-$worksheet->fromArray($criteria, null, 'A1');
-$worksheet->fromArray($database, null, 'A4');
+ $worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees');
+ $worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)');
-$worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees');
-$worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)');
+ $worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees');
+ $worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)');
-$worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees');
-$worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)');
+ echo '
';
-echo '
';
+ echo 'Database
';
-echo 'Database
';
+ $databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
+ var_dump($databaseData);
-$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
-var_dump($databaseData);
+ echo '
';
-echo '
';
+ // Test the formulae
+ echo 'Criteria
';
-// Test the formulae
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
+ echo $worksheet->getCell('A12')->getValue() . '
';
+ echo 'DVARP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
-echo $worksheet->getCell('A12')->getValue() . '
';
-echo 'DVARP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue() . '
';
+ echo 'Criteria
';
-echo 'Criteria
';
+ $criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
+ var_dump($criteriaData);
-$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true);
-var_dump($criteriaData);
-
-echo $worksheet->getCell('A13')->getValue() . '
';
-echo 'DVARP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
-
-?>
-
+ echo $worksheet->getCell('A13')->getValue() . '
';
+ echo 'DVARP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue();
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/DateTime/DATE.php b/docs/Examples/Calculations/DateTime/DATE.php
index 5b0a8717..33330c97 100644
--- a/docs/Examples/Calculations/DateTime/DATE.php
+++ b/docs/Examples/Calculations/DateTime/DATE.php
@@ -6,74 +6,72 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DATE
-Returns the serial number of a particular date.
-DATE
+ Returns the serial number of a particular date.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $testDates = [[2012, 3, 26], [2012, 2, 29], [2012, 4, 1], [2012, 12, 25],
+ [2012, 10, 31], [2012, 11, 5], [2012, 1, 1], [2012, 3, 17],
+ [2011, 2, 29], [7, 5, 3], [2012, 13, 1], [2012, 11, 45],
+ [2012, 0, 0], [2012, 1, 0], [2012, 0, 1],
+ [2012, -2, 2], [2012, 2, -2], [2012, -2, -2],
+ ];
+ $testDateCount = count($testDates);
-// Add some data
-$testDates = [[2012, 3, 26], [2012, 2, 29], [2012, 4, 1], [2012, 12, 25],
- [2012, 10, 31], [2012, 11, 5], [2012, 1, 1], [2012, 3, 17],
- [2011, 2, 29], [7, 5, 3], [2012, 13, 1], [2012, 11, 45],
- [2012, 0, 0], [2012, 1, 0], [2012, 0, 1],
- [2012, -2, 2], [2012, 2, -2], [2012, -2, -2],
- ];
-$testDateCount = count($testDates);
+ $worksheet->fromArray($testDates, null, 'A1', true);
-$worksheet->fromArray($testDates, null, 'A1', true);
+ for ($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('D' . $row, '=DATE(A' . $row . ',B' . $row . ',C' . $row . ')');
+ $worksheet->setCellValue('E' . $row, '=D' . $row);
+ }
+ $worksheet->getStyle('E1:E' . $testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('yyyy-mmm-dd');
-for ($row = 1; $row <= $testDateCount; ++$row) {
- $worksheet->setCellValue('D' . $row, '=DATE(A' . $row . ',B' . $row . ',C' . $row . ')');
- $worksheet->setCellValue('E' . $row, '=D' . $row);
-}
-$worksheet->getStyle('E1:E' . $testDateCount)
- ->getNumberFormat()
- ->setFormatCode('yyyy-mmm-dd');
+ echo '
';
-echo '
';
-
-// Test the formulae
-?>
-
-
- Date Value |
- Formula |
- Excel DateStamp |
- Formatted DateStamp |
-
-
- Year |
- Month |
- Day |
-
- ';
- echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('D' . $row)->getValue(), ' | ';
- echo '', $worksheet->getCell('D' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('E' . $row)->getFormattedValue(), ' | ';
- echo '
';
- }
- ?>
-
-
+ // Test the formulae
+ ?>
+
+
+ Date Value |
+ Formula |
+ Excel DateStamp |
+ Formatted DateStamp |
+
+
+ Year |
+ Month |
+ Day |
+
+ ';
+ echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('D' . $row)->getValue(), ' | ';
+ echo '', $worksheet->getCell('D' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('E' . $row)->getFormattedValue(), ' | ';
+ echo '
';
+ }
+ ?>
+
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/DateTime/DATEVALUE.php b/docs/Examples/Calculations/DateTime/DATEVALUE.php
index 437b6aa8..535fdcce 100644
--- a/docs/Examples/Calculations/DateTime/DATEVALUE.php
+++ b/docs/Examples/Calculations/DateTime/DATEVALUE.php
@@ -6,67 +6,65 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-DATEVALUE
-Converts a date in the form of text to a serial number.
-DATEVALUE
+ Converts a date in the form of text to a serial number.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $testDates = ['26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012',
+ '2012-Oct-31', '5th November', 'January 1st', 'April 2012',
+ '17-03', '03-2012', '29 Feb 2011', '03-05-07',
+ '03-MAY-07', '03-13-07',
+ ];
+ $testDateCount = count($testDates);
-// Add some data
-$testDates = ['26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012',
- '2012-Oct-31', '5th November', 'January 1st', 'April 2012',
- '17-03', '03-2012', '29 Feb 2011', '03-05-07',
- '03-MAY-07', '03-13-07',
- ];
-$testDateCount = count($testDates);
+ for ($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('A' . $row, $testDates[$row - 1]);
+ $worksheet->setCellValue('B' . $row, '=DATEVALUE(A' . $row . ')');
+ $worksheet->setCellValue('C' . $row, '=B' . $row);
+ }
-for ($row = 1; $row <= $testDateCount; ++$row) {
- $worksheet->setCellValue('A' . $row, $testDates[$row - 1]);
- $worksheet->setCellValue('B' . $row, '=DATEVALUE(A' . $row . ')');
- $worksheet->setCellValue('C' . $row, '=B' . $row);
-}
+ $worksheet->getStyle('C1:C' . $testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('yyyy-mmm-dd');
-$worksheet->getStyle('C1:C' . $testDateCount)
- ->getNumberFormat()
- ->setFormatCode('yyyy-mmm-dd');
+ echo '
';
-echo '
';
-
-// Test the formulae
-?>
-Warning: The PhpSpreadsheet DATEVALUE() function accepts a wider range of date formats than MS Excel's DATEFORMAT() function.
-
-
- Date String |
- Formula |
- Excel DateStamp |
- Formatted DateStamp |
-
- ';
- echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('B' . $row)->getValue(), ' | ';
- echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
- echo '';
- }
- ?>
-
-
+ // Test the formulae
+ ?>
+ Warning: The PhpSpreadsheet DATEVALUE() function accepts a wider range of date formats than MS Excel's DATEFORMAT() function.
+
+
+ Date String |
+ Formula |
+ Excel DateStamp |
+ Formatted DateStamp |
+
+ ';
+ echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('B' . $row)->getValue(), ' | ';
+ echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
+ echo '';
+ }
+ ?>
+
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/DateTime/TIME.php b/docs/Examples/Calculations/DateTime/TIME.php
index 588eadf9..09641074 100644
--- a/docs/Examples/Calculations/DateTime/TIME.php
+++ b/docs/Examples/Calculations/DateTime/TIME.php
@@ -6,72 +6,70 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-TIME
-Returns the serial number of a particular time.
-TIME
+ Returns the serial number of a particular time.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $testDates = [[3, 15], [13, 15], [15, 15, 15], [3, 15, 30],
+ [15, 15, 15], [5], [9, 15, 0], [9, 15, -1],
+ [13, -14, -15], [0, 0, -1],
+ ];
+ $testDateCount = count($testDates);
-// Add some data
-$testDates = [[3, 15], [13, 15], [15, 15, 15], [3, 15, 30],
- [15, 15, 15], [5], [9, 15, 0], [9, 15, -1],
- [13, -14, -15], [0, 0, -1],
- ];
-$testDateCount = count($testDates);
+ $worksheet->fromArray($testDates, null, 'A1', true);
-$worksheet->fromArray($testDates, null, 'A1', true);
+ for ($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('D' . $row, '=TIME(A' . $row . ',B' . $row . ',C' . $row . ')');
+ $worksheet->setCellValue('E' . $row, '=D' . $row);
+ }
+ $worksheet->getStyle('E1:E' . $testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('hh:mm:ss');
-for ($row = 1; $row <= $testDateCount; ++$row) {
- $worksheet->setCellValue('D' . $row, '=TIME(A' . $row . ',B' . $row . ',C' . $row . ')');
- $worksheet->setCellValue('E' . $row, '=D' . $row);
-}
-$worksheet->getStyle('E1:E' . $testDateCount)
- ->getNumberFormat()
- ->setFormatCode('hh:mm:ss');
+ echo '
';
-echo '
';
-
-// Test the formulae
-?>
-
-
- Date Value |
- Formula |
- Excel TimeStamp |
- Formatted TimeStamp |
-
-
- Hour |
- Minute |
- Second |
-
- ';
- echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('D' . $row)->getValue(), ' | ';
- echo '', $worksheet->getCell('D' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('E' . $row)->getFormattedValue(), ' | ';
- echo '
';
- }
- ?>
-
-
+ // Test the formulae
+ ?>
+
+
+ Date Value |
+ Formula |
+ Excel TimeStamp |
+ Formatted TimeStamp |
+
+
+ Hour |
+ Minute |
+ Second |
+
+ ';
+ echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('D' . $row)->getValue(), ' | ';
+ echo '', $worksheet->getCell('D' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('E' . $row)->getFormattedValue(), ' | ';
+ echo '
';
+ }
+ ?>
+
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/DateTime/TIMEVALUE.php b/docs/Examples/Calculations/DateTime/TIMEVALUE.php
index 26996b61..4cf27c81 100644
--- a/docs/Examples/Calculations/DateTime/TIMEVALUE.php
+++ b/docs/Examples/Calculations/DateTime/TIMEVALUE.php
@@ -6,63 +6,61 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Calculation Examples
+ PhpSpreadsheet Calculation Examples
-
-
+
+
-TIMEVALUE
-Converts a time in the form of text to a serial number.
-TIMEVALUE
+ Converts a time in the form of text to a serial number.
+ getActiveSheet();
-// Create new PhpSpreadsheet object
-$spreadsheet = new Spreadsheet();
-$worksheet = $spreadsheet->getActiveSheet();
+ // Add some data
+ $testDates = ['3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM',
+ ];
+ $testDateCount = count($testDates);
-// Add some data
-$testDates = ['3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM',
- ];
-$testDateCount = count($testDates);
+ for ($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('A' . $row, $testDates[$row - 1]);
+ $worksheet->setCellValue('B' . $row, '=TIMEVALUE(A' . $row . ')');
+ $worksheet->setCellValue('C' . $row, '=B' . $row);
+ }
-for ($row = 1; $row <= $testDateCount; ++$row) {
- $worksheet->setCellValue('A' . $row, $testDates[$row - 1]);
- $worksheet->setCellValue('B' . $row, '=TIMEVALUE(A' . $row . ')');
- $worksheet->setCellValue('C' . $row, '=B' . $row);
-}
+ $worksheet->getStyle('C1:C' . $testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('hh:mm:ss');
-$worksheet->getStyle('C1:C' . $testDateCount)
- ->getNumberFormat()
- ->setFormatCode('hh:mm:ss');
+ echo '
';
-echo '
';
-
-// Test the formulae
-?>
-
-
- Time String |
- Formula |
- Excel TimeStamp |
- Formatted TimeStamp |
-
- ';
- echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('B' . $row)->getValue(), ' | ';
- echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
- echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
- echo '';
- }
- ?>
-
-
+ // Test the formulae
+ ?>
+
+
+ Time String |
+ Formula |
+ Excel TimeStamp |
+ Formatted TimeStamp |
+
+ ';
+ echo '', $worksheet->getCell('A' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('B' . $row)->getValue(), ' | ';
+ echo '', $worksheet->getCell('B' . $row)->getFormattedValue(), ' | ';
+ echo '', $worksheet->getCell('C' . $row)->getFormattedValue(), ' | ';
+ echo '';
+ }
+ ?>
+
+
\ No newline at end of file
diff --git a/docs/Examples/Calculations/index.php b/docs/Examples/Calculations/index.php
index 5990ca23..ad03fe8e 100644
--- a/docs/Examples/Calculations/index.php
+++ b/docs/Examples/Calculations/index.php
@@ -1,49 +1,45 @@
-
-
+
+
-PhpSpreadsheet Calculation Function Examples
+ PhpSpreadsheet Calculation Function Examples
-
-
+
+
-PhpSpreadsheet Calculation Function Examples';
-echo 'PhpSpreadsheet Calculation Function Examples
';
+ $exampleTypeList = glob('./*', GLOB_ONLYDIR);
-$exampleTypeList = glob('./*', GLOB_ONLYDIR);
+ foreach ($exampleTypeList as $exampleType) {
+ echo '' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Function Examples
';
-foreach ($exampleTypeList as $exampleType) {
- echo '' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Function Examples
';
+ $exampleList = glob('./' . $exampleType . '/*.php');
- $exampleList = glob('./' . $exampleType . '/*.php');
+ foreach ($exampleList as $exampleFile) {
+ $fileData = file_get_contents($exampleFile);
- foreach ($exampleList as $exampleFile) {
- $fileData = file_get_contents($exampleFile);
+ $h1Pattern = '#(.*?)
#';
+ $h2Pattern = '#(.*?)
#';
- $h1Pattern = '#(.*?)
#';
- $h2Pattern = '#(.*?)
#';
+ 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 > '') {
- echo $h2Text,'
';
+ echo '', $h1Text, '
';
+ if ($h2Text > '') {
+ echo $h2Text, '
';
+ }
+ }
}
}
- }
-}
-
-?>
-
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader01.php b/docs/Examples/Reader/exampleReader01.php
index d20207a2..1e343e5d 100644
--- a/docs/Examples/Reader/exampleReader01.php
+++ b/docs/Examples/Reader/exampleReader01.php
@@ -6,32 +6,29 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #01
+ PhpSpreadsheet Reader Example #01
-
-
+
+
-PhpSpreadsheet Reader Example #01
-Simple File Reader using IOFactory::load()
-PhpSpreadsheet Reader Example #01
+ Simple File Reader using IOFactory::load()
+ ';
+ $spreadsheet = IOFactory::load($inputFileName);
-$inputFileName = './sampleData/example1.xls';
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format
';
-$spreadsheet = IOFactory::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/exampleReader02.php b/docs/Examples/Reader/exampleReader02.php
index 9d301f69..c29e7993 100644
--- a/docs/Examples/Reader/exampleReader02.php
+++ b/docs/Examples/Reader/exampleReader02.php
@@ -8,38 +8,29 @@ set_time_limit(0);
date_default_timezone_set('Europe/London');
require_once __DIR__ . '/../../../src/Bootstrap.php';
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #02
+ PhpSpreadsheet Reader Example #02
-
-
+
+
-PhpSpreadsheet Reader Example #02
-Simple File Reader using a Specified Reader
-PhpSpreadsheet Reader Example #02
+ Simple File Reader using a Specified Reader
+ ';
+ $reader = new Xls();
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using \PhpOffice\PhpSpreadsheet\Reader\Xls
';
-$reader = new Xls();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric();
-// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
-$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/exampleReader03.php b/docs/Examples/Reader/exampleReader03.php
index 07dfa7ae..750d52c2 100644
--- a/docs/Examples/Reader/exampleReader03.php
+++ b/docs/Examples/Reader/exampleReader03.php
@@ -6,41 +6,32 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #03
+ PhpSpreadsheet Reader Example #03
-
-
+
+
-PhpSpreadsheet Reader Example #03
-Simple File Reader using the IOFactory to Return a Reader
-PhpSpreadsheet Reader Example #03
+ Simple File Reader using the IOFactory to Return a Reader
+ ';
+ $reader = IOFactory::createReader($inputFileType);
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
-$reader = IOFactory::createReader($inputFileType);
-$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/exampleReader04.php b/docs/Examples/Reader/exampleReader04.php
index d26d6525..7b8065d5 100644
--- a/docs/Examples/Reader/exampleReader04.php
+++ b/docs/Examples/Reader/exampleReader04.php
@@ -6,37 +6,34 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #04
+ PhpSpreadsheet Reader Example #04
-
-
+
+
-PhpSpreadsheet Reader Example #04
-Simple File Reader using the IOFactory to Identify a Reader to Use
-PhpSpreadsheet Reader Example #04
+ Simple File Reader using the IOFactory to Identify a Reader to Use
+ ';
-$inputFileType = IOFactory::identify($inputFileName);
-echo 'File ',pathinfo($inputFileName, PATHINFO_BASENAME),' has been identified as an ',$inputFileType,' file
';
+ echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' using IOFactory with the identified reader type
';
+ $reader = IOFactory::createReader($inputFileType);
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with the identified reader type
';
-$reader = IOFactory::createReader($inputFileType);
-$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/exampleReader05.php b/docs/Examples/Reader/exampleReader05.php
index ff72be92..2b06e8ac 100644
--- a/docs/Examples/Reader/exampleReader05.php
+++ b/docs/Examples/Reader/exampleReader05.php
@@ -6,41 +6,34 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #05
+ PhpSpreadsheet Reader Example #05
-
-
+
+
-PhpSpreadsheet Reader Example #05
-Simple File Reader using the "Read Data Only" Option
-PhpSpreadsheet Reader Example #05
+ Simple File Reader using the "Read Data Only" Option
+ ';
+ $reader = IOFactory::createReader($inputFileType);
+ echo 'Turning Formatting off for Load
';
+ $reader->setReadDataOnly(true);
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
-$reader = IOFactory::createReader($inputFileType);
-echo 'Turning Formatting off for Load
';
-$reader->setReadDataOnly(true);
-$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/exampleReader06.php b/docs/Examples/Reader/exampleReader06.php
index ccc59373..04e6b94e 100644
--- a/docs/Examples/Reader/exampleReader06.php
+++ b/docs/Examples/Reader/exampleReader06.php
@@ -6,44 +6,37 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #06
+ PhpSpreadsheet Reader Example #06
-
-
+
+
-PhpSpreadsheet Reader Example #06
-Simple File Reader Loading All WorkSheets
-PhpSpreadsheet Reader Example #06
+ Simple File Reader Loading All WorkSheets
+ ';
+ $reader = IOFactory::createReader($inputFileType);
+ echo 'Loading all WorkSheets
';
+ $reader->setLoadAllSheets();
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
-$reader = IOFactory::createReader($inputFileType);
-echo 'Loading all WorkSheets
';
-$reader->setLoadAllSheets();
-$spreadsheet = $reader->load($inputFileName);
+ echo '
';
-echo '
';
-
-echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
-$loadedSheetNames = $spreadsheet->getSheetNames();
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo $sheetIndex, ' -> ', $loadedSheetName, '
';
-}
-
-?>
-
+ echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
+ $loadedSheetNames = $spreadsheet->getSheetNames();
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo $sheetIndex, ' -> ', $loadedSheetName, '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader07.php b/docs/Examples/Reader/exampleReader07.php
index cde1c409..7beabc82 100644
--- a/docs/Examples/Reader/exampleReader07.php
+++ b/docs/Examples/Reader/exampleReader07.php
@@ -6,45 +6,38 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #07
+ PhpSpreadsheet Reader Example #07
-
-
+
+
-PhpSpreadsheet Reader Example #07
-Simple File Reader Loading a Single Named WorkSheet
-PhpSpreadsheet Reader Example #07
+ Simple File Reader Loading a Single Named WorkSheet
+ ';
+ $reader = IOFactory::createReader($inputFileType);
+ echo 'Loading Sheet "', $sheetname, '" only
';
+ $reader->setLoadSheetsOnly($sheetname);
+ $spreadsheet = $reader->load($inputFileName);
-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);
-$spreadsheet = $reader->load($inputFileName);
+ echo '
';
-echo '
';
-
-echo $spreadsheet->getSheetCount(),' worksheet',(($spreadsheet->getSheetCount() == 1) ? '' : 's'),' loaded
';
-$loadedSheetNames = $spreadsheet->getSheetNames();
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo $sheetIndex,' -> ',$loadedSheetName,'
';
-}
-
-?>
-
+ echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
+ $loadedSheetNames = $spreadsheet->getSheetNames();
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo $sheetIndex, ' -> ', $loadedSheetName, '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader08.php b/docs/Examples/Reader/exampleReader08.php
index 0a739f75..c9e574b9 100644
--- a/docs/Examples/Reader/exampleReader08.php
+++ b/docs/Examples/Reader/exampleReader08.php
@@ -6,45 +6,38 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #08
+ PhpSpreadsheet Reader Example #08
-
-
+
+
-PhpSpreadsheet Reader Example #08
-Simple File Reader Loading Several Named WorkSheets
-PhpSpreadsheet Reader Example #08
+ Simple File Reader Loading Several Named WorkSheets
+ ';
+ $reader = IOFactory::createReader($inputFileType);
+ echo 'Loading Sheet', ((count($sheetnames) == 1) ? '' : 's'), ' "', implode('" and "', $sheetnames), '" only
';
+ $reader->setLoadSheetsOnly($sheetnames);
+ $spreadsheet = $reader->load($inputFileName);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
-$reader = IOFactory::createReader($inputFileType);
-echo 'Loading Sheet',((count($sheetnames) == 1) ? '' : 's'),' "',implode('" and "', $sheetnames),'" only
';
-$reader->setLoadSheetsOnly($sheetnames);
-$spreadsheet = $reader->load($inputFileName);
+ echo '
';
-echo '
';
-
-echo $spreadsheet->getSheetCount(),' worksheet',(($spreadsheet->getSheetCount() == 1) ? '' : 's'),' loaded
';
-$loadedSheetNames = $spreadsheet->getSheetNames();
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo $sheetIndex,' -> ',$loadedSheetName,'
';
-}
-
-?>
-
+ echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
+ $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 8dde497c..1c5c4147 100644
--- a/docs/Examples/Reader/exampleReader09.php
+++ b/docs/Examples/Reader/exampleReader09.php
@@ -7,61 +7,55 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 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 = 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 f62c98d93..6d4517eb 100644
--- a/docs/Examples/Reader/exampleReader10.php
+++ b/docs/Examples/Reader/exampleReader10.php
@@ -7,73 +7,66 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 2b7225a9..67c9ec4d 100644
--- a/docs/Examples/Reader/exampleReader11.php
+++ b/docs/Examples/Reader/exampleReader11.php
@@ -7,86 +7,80 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 '
';
-}
-
-?>
-
+ $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 50580f2a..f9055ae1 100644
--- a/docs/Examples/Reader/exampleReader12.php
+++ b/docs/Examples/Reader/exampleReader12.php
@@ -7,89 +7,83 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 '
';
-}
-
-?>
-
+ $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
+ var_dump($sheetData);
+ echo '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader13.php b/docs/Examples/Reader/exampleReader13.php
index c5107c87..e13f1801 100644
--- a/docs/Examples/Reader/exampleReader13.php
+++ b/docs/Examples/Reader/exampleReader13.php
@@ -6,50 +6,47 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #13
+ PhpSpreadsheet Reader Example #13
-
-
+
+
-PhpSpreadsheet Reader Example #13
-Simple File Reader for Multiple CSV Files
-PhpSpreadsheet Reader Example #13
+ Simple File Reader for Multiple CSV Files
+ ';
+ $spreadsheet = $reader->load($inputFileName);
+ $spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
+ foreach ($inputFileNames as $sheet => $inputFileName) {
+ echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' into WorkSheet #', ($sheet + 2), ' using IOFactory with a defined reader type of ', $inputFileType, '
';
+ $reader->setSheetIndex($sheet + 1);
+ $reader->loadIntoExisting($inputFileName, $spreadsheet);
+ $spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
+ }
-$reader = IOFactory::createReader($inputFileType);
-$inputFileName = array_shift($inputFileNames);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' into WorkSheet #1 using IOFactory with a defined reader type of ',$inputFileType,'
';
-$spreadsheet = $reader->load($inputFileName);
-$spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
-foreach ($inputFileNames as $sheet => $inputFileName) {
- echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' into WorkSheet #',($sheet + 2),' using IOFactory with a defined reader type of ',$inputFileType,'
';
- $reader->setSheetIndex($sheet + 1);
- $reader->loadIntoExisting($inputFileName, $spreadsheet);
- $spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
-}
+ echo '
';
-echo '
';
-
-echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
-$loadedSheetNames = $spreadsheet->getSheetNames();
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, '
';
- $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
- $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
- var_dump($sheetData);
- echo '
';
-}
-
-?>
-
+ echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
+ $loadedSheetNames = $spreadsheet->getSheetNames();
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, '
';
+ $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
+ $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 aad066dc..98ab0b65 100644
--- a/docs/Examples/Reader/exampleReader14.php
+++ b/docs/Examples/Reader/exampleReader14.php
@@ -8,105 +8,103 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 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
';
-$loadedSheetNames = $spreadsheet->getSheetNames();
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, '
';
- $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
- $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
- var_dump($sheetData);
- echo '
';
-}
-
-?>
-
+ echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
+ $loadedSheetNames = $spreadsheet->getSheetNames();
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, '
';
+ $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
+ var_dump($sheetData);
+ echo '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader15.php b/docs/Examples/Reader/exampleReader15.php
index fdf38b05..be913444 100644
--- a/docs/Examples/Reader/exampleReader15.php
+++ b/docs/Examples/Reader/exampleReader15.php
@@ -7,66 +7,63 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #15
+ PhpSpreadsheet Reader Example #15
-
-
+
+
-PhpSpreadsheet Reader Example #15
-Simple File Reader for Tab-Separated Value File using the Advanced Value Binder
-PhpSpreadsheet Reader Example #15
+ Simple File Reader for Tab-Separated Value File using the Advanced Value Binder
+ ';
+ $reader->setDelimiter("\t");
+ $spreadsheet = $reader->load($inputFileName);
+ $spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
-$reader = IOFactory::createReader($inputFileType);
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' into WorkSheet #1 using IOFactory with a defined reader type of ',$inputFileType,'
';
-$reader->setDelimiter("\t");
-$spreadsheet = $reader->load($inputFileName);
-$spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME));
+ echo '
';
-echo '
';
+ echo $spreadsheet->getSheetCount(), ' worksheet', (($spreadsheet->getSheetCount() == 1) ? '' : 's'), ' loaded
';
+ $loadedSheetNames = $spreadsheet->getSheetNames();
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, ' (Formatted)
';
+ $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
+ var_dump($sheetData);
+ echo '
';
+ }
-echo $spreadsheet->getSheetCount(),' worksheet',(($spreadsheet->getSheetCount() == 1) ? '' : 's'),' loaded
';
-$loadedSheetNames = $spreadsheet->getSheetNames();
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Formatted)
';
- $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
- $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
- var_dump($sheetData);
- echo '
';
-}
+ echo '
';
-echo '
';
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, ' (Unformatted)
';
+ $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, false, true);
+ var_dump($sheetData);
+ echo '
';
+ }
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, ' (Unformatted)
';
- $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
- $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, false, true);
- var_dump($sheetData);
- echo '
';
-}
+ echo '
';
-echo '
';
-
-foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
- echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, ' (Raw)
';
- $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
- $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
- var_dump($sheetData);
- echo '
';
-}
-
-?>
-
+ foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #', $sheetIndex, ' -> ', $loadedSheetName, ' (Raw)
';
+ $spreadsheet->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
+ var_dump($sheetData);
+ echo '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader16.php b/docs/Examples/Reader/exampleReader16.php
index 9436bd2e..aa4bc469 100644
--- a/docs/Examples/Reader/exampleReader16.php
+++ b/docs/Examples/Reader/exampleReader16.php
@@ -7,36 +7,33 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #16
+ PhpSpreadsheet Reader Example #16
-
-
+
+
-PhpSpreadsheet Reader Example #16
-Handling Loader Exceptions using Try/Catch
-PhpSpreadsheet Reader Example #16
+ Handling Loader Exceptions using Try/Catch
+ ';
+ try {
+ $spreadsheet = IOFactory::load($inputFileName);
+ } catch (InvalidArgumentException $e) {
+ die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
+ }
-$inputFileName = './sampleData/example_1.xls';
-echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory to identify the format
';
-try {
- $spreadsheet = IOFactory::load($inputFileName);
-} catch (InvalidArgumentException $e) {
- die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
-}
+ 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/exampleReader17.php b/docs/Examples/Reader/exampleReader17.php
index 763805ac..3c6ebf30 100644
--- a/docs/Examples/Reader/exampleReader17.php
+++ b/docs/Examples/Reader/exampleReader17.php
@@ -6,42 +6,35 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-PhpSpreadsheet Reader Example #17
+ PhpSpreadsheet Reader Example #17
-
-
+
+
-PhpSpreadsheet Reader Example #17
-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 = 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 9822b209..68a478bb 100644
--- a/docs/Examples/Reader/exampleReader18.php
+++ b/docs/Examples/Reader/exampleReader18.php
@@ -6,42 +6,35 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = IOFactory::createReader($inputFileType);
-$worksheetNames = $reader->listWorksheetNames($inputFileName);
-
-echo 'Worksheet Names
';
-echo '';
-foreach ($worksheetNames as $worksheetName) {
- echo '- ', $worksheetName, '
';
-}
-echo '
';
-
-?>
-
+ echo 'Worksheet Names
';
+ echo '';
+ foreach ($worksheetNames as $worksheetName) {
+ echo '- ', $worksheetName, '
';
+ }
+ echo '
';
+ ?>
+
\ No newline at end of file
diff --git a/docs/Examples/Reader/exampleReader19.php b/docs/Examples/Reader/exampleReader19.php
index 5749d1b6..dea2dd06 100644
--- a/docs/Examples/Reader/exampleReader19.php
+++ b/docs/Examples/Reader/exampleReader19.php
@@ -6,45 +6,38 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = IOFactory::createReader($inputFileType);
-$worksheetData = $reader->listWorksheetInfo($inputFileName);
-
-echo 'Worksheet Information
';
-echo '';
-foreach ($worksheetData as $worksheet) {
- echo '- ', $worksheet['worksheetName'], '
';
- echo 'Rows: ', $worksheet['totalRows'], ' Columns: ', $worksheet['totalColumns'], '
';
- echo 'Cell Range: A1:', $worksheet['lastColumnLetter'], $worksheet['totalRows'];
- echo ' ';
-}
-echo '
';
-
-?>
-
+ echo 'Worksheet Information
';
+ echo '';
+ foreach ($worksheetData as $worksheet) {
+ echo '- ', $worksheet['worksheetName'], '
';
+ echo 'Rows: ', $worksheet['totalRows'], ' Columns: ', $worksheet['totalColumns'], '
';
+ echo 'Cell Range: A1:', $worksheet['lastColumnLetter'], $worksheet['totalRows'];
+ 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 8a6b4726..9085b394 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
@@ -6,83 +6,80 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 b9cfc196..b643f74b 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
@@ -6,41 +6,38 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 81327481..432099aa 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
@@ -6,69 +6,66 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 e3a71d34..7299e783 100644
--- a/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
+++ b/docs/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
@@ -6,45 +6,42 @@ error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
-
?>
-
-
+
+
-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 = 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 'PhpSpreadsheet ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples
';
+ $exampleList = glob('./' . $exampleType . '/*.php');
- $exampleList = glob('./' . $exampleType . '/*.php');
+ foreach ($exampleList as $exampleFile) {
+ $fileData = file_get_contents($exampleFile);
- foreach ($exampleList as $exampleFile) {
- $fileData = file_get_contents($exampleFile);
+ $h1Pattern = '#(.*?)
#';
+ $h2Pattern = '#(.*?)
#';
- $h1Pattern = '#(.*?)
#';
- $h2Pattern = '#(.*?)
#';
+ 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/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php
index 17556270..d84932bc 100644
--- a/src/PhpSpreadsheet/Calculation.php
+++ b/src/PhpSpreadsheet/Calculation.php
@@ -3770,9 +3770,6 @@ class Calculation
$output = $stack->pop();
$output = $output['value'];
-// if ((is_array($output)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
-// return array_shift(Calculation\Functions::flattenArray($output));
-// }
return $output;
}
diff --git a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php
index 094ded83..93e9fd58 100644
--- a/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php
+++ b/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php
@@ -778,7 +778,7 @@ class EigenvalueDecomposition
}
}
- // end hqr2
+ // end hqr2
/**
* Constructor: Check for symmetry, then construct the eigenvalue decomposition.
diff --git a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php
index cfd20113..9d383202 100644
--- a/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php
+++ b/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php
@@ -436,8 +436,6 @@ class SingularValueDecomposition
} // end while
}
- // end constructor
-
/**
* Return the left singular vectors.
*
diff --git a/src/PhpSpreadsheet/Writer/Xls/Font.php b/src/PhpSpreadsheet/Writer/Xls/Font.php
index 84b21981..d076fdcd 100644
--- a/src/PhpSpreadsheet/Writer/Xls/Font.php
+++ b/src/PhpSpreadsheet/Writer/Xls/Font.php
@@ -84,9 +84,9 @@ class Font
$bFamily = 0; // Font family
$bCharSet = \PhpOffice\PhpSpreadsheet\Shared\Font::getCharsetFromFontName($this->font->getName()); // Character set
- $record = 0x31; // Record identifier
- $reserved = 0x00; // Reserved
- $grbit = 0x00; // Font attributes
+ $record = 0x31; // Record identifier
+ $reserved = 0x00; // Reserved
+ $grbit = 0x00; // Font attributes
if ($this->font->getItalic()) {
$grbit |= 0x02;
}
@@ -134,10 +134,10 @@ class Font
private static function mapBold($bold)
{
if ($bold) {
- return 0x2BC; // 700 = Bold font weight
+ return 0x2BC; // 700 = Bold font weight
}
- return 0x190; // 400 = Normal font weight
+ return 0x190; // 400 = Normal font weight
}
/**
diff --git a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php
index 939b0f50..5f539650 100644
--- a/src/PhpSpreadsheet/Writer/Xls/Worksheet.php
+++ b/src/PhpSpreadsheet/Writer/Xls/Worksheet.php
@@ -1190,14 +1190,14 @@ class Worksheet extends BIFFwriter
// Pack the main data stream
$data = pack('vvvv', $row1, $row2, $col1, $col2) .
- $unknown1 .
- $link_type .
- $unknown2 .
- $up_count .
- $dir_short_len .
- $dir_short .
- $unknown3 .
- $stream_len; /*.
+ $unknown1 .
+ $link_type .
+ $unknown2 .
+ $up_count .
+ $dir_short_len .
+ $dir_short .
+ $unknown3 .
+ $stream_len; /*.
$dir_long_len .
$unknown4 .
$dir_long .
diff --git a/src/PhpSpreadsheet/Writer/Xlsx.php b/src/PhpSpreadsheet/Writer/Xlsx.php
index 93ea21db..7bcb0b33 100644
--- a/src/PhpSpreadsheet/Writer/Xlsx.php
+++ b/src/PhpSpreadsheet/Writer/Xlsx.php
@@ -159,8 +159,8 @@ class Xlsx extends BaseWriter implements IWriter
}
$hashTablesArray = ['stylesConditionalHashTable', 'fillHashTable', 'fontHashTable',
- 'bordersHashTable', 'numFmtHashTable', 'drawingHashTable',
- 'styleHashTable',
+ 'bordersHashTable', 'numFmtHashTable', 'drawingHashTable',
+ 'styleHashTable',
];
// Set HashTable variables
diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
index f5bf2bf7..a2e1058c 100644
--- a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
+++ b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
@@ -306,7 +306,6 @@ class Worksheet extends WriterPart
}
// Selection
-// if ($pane != '') {
// Only need to write selection element if we have a split pane
// We cheat a little by over-riding the active cell selection, setting it to the split cell
$objWriter->startElement('selection');
@@ -316,7 +315,6 @@ class Worksheet extends WriterPart
$objWriter->writeAttribute('activeCell', $activeCell);
$objWriter->writeAttribute('sqref', $activeCell);
$objWriter->endElement();
-// }
$objWriter->endElement();