Rename classes to keep them in their related namespaces

This commit is contained in:
Adrien Crivelli 2017-10-29 17:39:42 +09:00
parent 3982ce2944
commit 557e80dc03
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
160 changed files with 626 additions and 570 deletions

View File

@ -28,6 +28,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Standardization of array keys used for style, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). - Standardization of array keys used for style, see the [migration guide](./docs/topics/migration-from-PHPExcel.md).
- Easier usage of PDF writers, and other custom readers and writers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). - Easier usage of PDF writers, and other custom readers and writers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md).
- Easier usage of chart renderers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md).
- Rename a few more classes to keep them in their related namespaces:
- `CalcEngine` => `Calculation\Engine`
- `PhpSpreadsheet\Calculation` => `PhpSpreadsheet\Calculation\Calculation`
- `PhpSpreadsheet\Cell` => `PhpSpreadsheet\Cell\Cell`
- `PhpSpreadsheet\Chart` => `PhpSpreadsheet\Chart\Chart`
- `PhpSpreadsheet\RichText` => `PhpSpreadsheet\RichText\RichText`
- `PhpSpreadsheet\Style` => `PhpSpreadsheet\Style\Style`
- `PhpSpreadsheet\Worksheet` => `PhpSpreadsheet\Worksheet\Worksheet`
## [1.0.0-beta] - 2017-08-17 ## [1.0.0-beta] - 2017-08-17

View File

@ -389,7 +389,7 @@ $worksheet = $spreadsheet->getActiveSheet();
// Get the highest row and column numbers referenced in the worksheet // Get the highest row and column numbers referenced in the worksheet
$highestRow = $worksheet->getHighestRow(); // e.g. 10 $highestRow = $worksheet->getHighestRow(); // e.g. 10
$highestColumn = $worksheet->getHighestColumn(); // e.g 'F' $highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($highestColumn); // e.g. 5 $highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Cell::columnIndexFromString($highestColumn); // e.g. 5
echo '<table>' . "\n"; echo '<table>' . "\n";
for ($row = 1; $row <= $highestRow; ++$row) { for ($row = 1; $row <= $highestRow; ++$row) {
@ -459,7 +459,7 @@ value binder in PhpSpreadsheet:
require_once 'src/Boostrap.php'; require_once 'src/Boostrap.php';
// Set value binder // Set value binder
\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); \PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
// Create new Spreadsheet object // Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

View File

@ -575,7 +575,7 @@ these values during the load process within a Value Binder.
A Value Binder is a class that implement the A Value Binder is a class that implement the
\PhpOffice\PhpSpreadsheet\Cell\IValueBinder interface. It must contain a \PhpOffice\PhpSpreadsheet\Cell\IValueBinder interface. It must contain a
bindValue() method that accepts a \PhpOffice\PhpSpreadsheet\Cell and a bindValue() method that accepts a `\PhpOffice\PhpSpreadsheet\Cell\Cell` and a
value as arguments, and return a boolean true or false that indicates value as arguments, and return a boolean true or false that indicates
whether the workbook cell has been populated with the value or not. The whether the workbook cell has been populated with the value or not. The
Advanced Value Binder implements such a class: amongst other tests, it Advanced Value Binder implements such a class: amongst other tests, it
@ -593,7 +593,7 @@ loader logic when reading unformatted text files.
``` php ``` php
/** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/ /** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/
\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); \PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
$inputFileType = 'Csv'; $inputFileType = 'Csv';
$inputFileName = './sampleData/example1.tsv'; $inputFileName = './sampleData/example1.tsv';

View File

@ -71,7 +71,7 @@ method that suits you the best. Here are some examples:
``` php ``` php
// MySQL-like timestamp '2008-12-31' or date string // MySQL-like timestamp '2008-12-31' or date string
\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); \PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
$spreadsheet->getActiveSheet() $spreadsheet->getActiveSheet()
->setCellValue('D1', '2008-12-31'); ->setCellValue('D1', '2008-12-31');
@ -248,7 +248,7 @@ when it sees a newline character in a string that you are inserting in a
cell. Just like Microsoft Office Excel. Try this: cell. Just like Microsoft Office Excel. Try this:
``` php ``` php
\PhpOffice\PhpSpreadsheet\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); \PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
$spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld"); $spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld");
``` ```
@ -743,13 +743,13 @@ easy manner.
### Valid array keys for style `applyFromArray()` ### Valid array keys for style `applyFromArray()`
The following table lists the valid array keys for The following table lists the valid array keys for
\PhpOffice\PhpSpreadsheet\Style applyFromArray() classes. If the "Maps `\PhpOffice\PhpSpreadsheet\Style\Style::applyFromArray()` classes. If the "Maps
to property" column maps a key to a setter, the value provided for that to property" column maps a key to a setter, the value provided for that
key will be applied directly. If the "Maps to property" column maps a key will be applied directly. If the "Maps to property" column maps a
key to a getter, the value provided for that key will be applied as key to a getter, the value provided for that key will be applied as
another style array. another style array.
**\PhpOffice\PhpSpreadsheet\Style** **\PhpOffice\PhpSpreadsheet\Style\Style**
Array key | Maps to property Array key | Maps to property
-------------|------------------- -------------|-------------------

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Color;

View File

@ -1,7 +1,7 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
mt_srand(1234567890); mt_srand(1234567890);

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';

View File

@ -1,9 +1,9 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style;
use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Style;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';

View File

@ -1,6 +1,7 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';
@ -11,7 +12,7 @@ date_default_timezone_set('UTC');
// Set value binder // Set value binder
$helper->log('Set value binder'); $helper->log('Set value binder');
Cell::setValueBinder(new Cell\AdvancedValueBinder()); Cell::setValueBinder(new AdvancedValueBinder());
// Create new Spreadsheet object // Create new Spreadsheet object
$helper->log('Create new Spreadsheet object'); $helper->log('Create new Spreadsheet object');

View File

@ -1,8 +1,8 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style; use PhpOffice\PhpSpreadsheet\Style\Style;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';

View File

@ -1,5 +1,5 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,8 +1,9 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Layout;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;
use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\Title;
@ -65,7 +66,7 @@ $series1 = new DataSeries(
); );
// Set up a layout object for the Pie chart // Set up a layout object for the Pie chart
$layout1 = new Chart\Layout(); $layout1 = new Layout();
$layout1->setShowVal(true); $layout1->setShowVal(true);
$layout1->setShowPercent(true); $layout1->setShowPercent(true);
@ -137,7 +138,7 @@ $series2 = new DataSeries(
); );
// Set up a layout object for the Pie chart // Set up a layout object for the Pie chart
$layout2 = new Chart\Layout(); $layout2 = new Layout();
$layout2->setShowVal(true); $layout2->setShowVal(true);
$layout2->setShowCatName(true); $layout2->setShowCatName(true);

View File

@ -1,8 +1,9 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Layout;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;
use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\Title;
@ -79,7 +80,7 @@ $series = new DataSeries(
); );
// Set up a layout object for the Pie chart // Set up a layout object for the Pie chart
$layout = new Chart\Layout(); $layout = new Layout();
// Set the series in the plot area // Set the series in the plot area
$plotArea = new PlotArea($layout, [$series]); $plotArea = new PlotArea($layout, [$series]);

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,11 +1,12 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
require __DIR__ . '/../Header.php'; require __DIR__ . '/../Header.php';
Cell::setValueBinder(new Cell\AdvancedValueBinder()); Cell::setValueBinder(new AdvancedValueBinder());
$inputFileType = 'Csv'; $inputFileType = 'Csv';
$inputFileName = __DIR__ . '/sampleData/example1.tsv'; $inputFileName = __DIR__ . '/sampleData/example1.tsv';

View File

@ -1,6 +1,6 @@
<?php <?php
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Chart\DataSeries; use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues; use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;

View File

@ -1,7 +1,7 @@
<?php <?php
// Create new Spreadsheet object // Create new Spreadsheet object
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Alignment;

View File

@ -1,19 +1,15 @@
<?php <?php
namespace PhpOffice\PhpSpreadsheet; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Category; use PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack;
use PhpOffice\PhpSpreadsheet\Calculation\Database; use PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger;
use PhpOffice\PhpSpreadsheet\Calculation\DateTime;
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
use PhpOffice\PhpSpreadsheet\Calculation\Financial;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Logical;
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
use PhpOffice\PhpSpreadsheet\Calculation\TextData;
use PhpOffice\PhpSpreadsheet\Calculation\Token\Stack; use PhpOffice\PhpSpreadsheet\Calculation\Token\Stack;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\Shared;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class Calculation class Calculation
{ {
@ -97,7 +93,7 @@ class Calculation
/** /**
* The debug log generated by the calculation engine. * The debug log generated by the calculation engine.
* *
* @var CalcEngine\Logger * @var Logger
*/ */
private $debugLog; private $debugLog;
@ -1998,8 +1994,8 @@ class Calculation
$this->delta = 1 * pow(10, 0 - ini_get('precision')); $this->delta = 1 * pow(10, 0 - ini_get('precision'));
$this->spreadsheet = $spreadsheet; $this->spreadsheet = $spreadsheet;
$this->cyclicReferenceStack = new CalcEngine\CyclicReferenceStack(); $this->cyclicReferenceStack = new CyclicReferenceStack();
$this->debugLog = new CalcEngine\Logger($this->cyclicReferenceStack); $this->debugLog = new Logger($this->cyclicReferenceStack);
} }
private static function loadLocales() private static function loadLocales()
@ -2049,7 +2045,7 @@ class Calculation
/** /**
* Get the Logger for this calculation engine instance. * Get the Logger for this calculation engine instance.
* *
* @return CalcEngine\Logger * @return Logger
*/ */
public function getDebugLog() public function getDebugLog()
{ {
@ -2059,11 +2055,11 @@ class Calculation
/** /**
* __clone implementation. Cloning should not be allowed in a Singleton! * __clone implementation. Cloning should not be allowed in a Singleton!
* *
* @throws Calculation\Exception * @throws Exception
*/ */
final public function __clone() final public function __clone()
{ {
throw new Calculation\Exception('Cloning the calculation engine is not allowed!'); throw new Exception('Cloning the calculation engine is not allowed!');
} }
/** /**
@ -2446,7 +2442,7 @@ class Calculation
return '"' . $value . '"'; return '"' . $value . '"';
// Convert numeric errors to NaN error // Convert numeric errors to NaN error
} elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
return Calculation\Functions::NAN(); return Functions::NAN();
} }
return $value; return $value;
@ -2467,7 +2463,7 @@ class Calculation
} }
// Convert numeric errors to NAN error // Convert numeric errors to NAN error
} elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
return Calculation\Functions::NAN(); return Functions::NAN();
} }
return $value; return $value;
@ -2479,7 +2475,7 @@ class Calculation
* *
* @param Cell $pCell Cell to calculate * @param Cell $pCell Cell to calculate
* *
* @throws Calculation\Exception * @throws Exception
* *
* @return mixed * @return mixed
*/ */
@ -2487,8 +2483,8 @@ class Calculation
{ {
try { try {
return $this->calculateCellValue($pCell); return $this->calculateCellValue($pCell);
} catch (Exception $e) { } catch (\Exception $e) {
throw new Calculation\Exception($e->getMessage()); throw new Exception($e->getMessage());
} }
} }
@ -2498,7 +2494,7 @@ class Calculation
* @param Cell $pCell Cell to calculate * @param Cell $pCell Cell to calculate
* @param bool $resetLog Flag indicating whether the debug log should be reset or not * @param bool $resetLog Flag indicating whether the debug log should be reset or not
* *
* @throws Calculation\Exception * @throws Exception
* *
* @return mixed * @return mixed
*/ */
@ -2529,18 +2525,18 @@ class Calculation
$result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); $result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
$cellAddress = array_pop($this->cellStack); $cellAddress = array_pop($this->cellStack);
$this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); $this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
} catch (Exception $e) { } catch (\Exception $e) {
$cellAddress = array_pop($this->cellStack); $cellAddress = array_pop($this->cellStack);
$this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); $this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
throw new Calculation\Exception($e->getMessage()); throw new Exception($e->getMessage());
} }
if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) { if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
self::$returnArrayAsType = $returnArrayAsType; self::$returnArrayAsType = $returnArrayAsType;
$testResult = Calculation\Functions::flattenArray($result); $testResult = Functions::flattenArray($result);
if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) { if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) {
return Calculation\Functions::VALUE(); return Functions::VALUE();
} }
// If there's only a single cell in the array, then we allow it // If there's only a single cell in the array, then we allow it
if (count($testResult) != 1) { if (count($testResult) != 1) {
@ -2548,13 +2544,13 @@ class Calculation
$r = array_keys($result); $r = array_keys($result);
$r = array_shift($r); $r = array_shift($r);
if (!is_numeric($r)) { if (!is_numeric($r)) {
return Calculation\Functions::VALUE(); return Functions::VALUE();
} }
if (is_array($result[$r])) { if (is_array($result[$r])) {
$c = array_keys($result[$r]); $c = array_keys($result[$r]);
$c = array_shift($c); $c = array_shift($c);
if (!is_numeric($c)) { if (!is_numeric($c)) {
return Calculation\Functions::VALUE(); return Functions::VALUE();
} }
} }
} }
@ -2565,7 +2561,7 @@ class Calculation
if ($result === null) { if ($result === null) {
return 0; return 0;
} elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) { } elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
return Calculation\Functions::NAN(); return Functions::NAN();
} }
return $result; return $result;
@ -2576,7 +2572,7 @@ class Calculation
* *
* @param string $formula Formula to parse * @param string $formula Formula to parse
* *
* @throws Calculation\Exception * @throws Exception
* *
* @return array * @return array
*/ */
@ -2604,7 +2600,7 @@ class Calculation
* @param string $cellID Address of the cell to calculate * @param string $cellID Address of the cell to calculate
* @param Cell $pCell Cell to calculate * @param Cell $pCell Cell to calculate
* *
* @throws Calculation\Exception * @throws Exception
* *
* @return mixed * @return mixed
*/ */
@ -2628,8 +2624,8 @@ class Calculation
// Execute the calculation // Execute the calculation
try { try {
$result = self::unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); $result = self::unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell));
} catch (Exception $e) { } catch (\Exception $e) {
throw new Calculation\Exception($e->getMessage()); throw new Exception($e->getMessage());
} }
if ($this->spreadsheet === null) { if ($this->spreadsheet === null) {
@ -2680,7 +2676,7 @@ class Calculation
* @param string $cellID The ID (e.g. A3) of the cell that we are calculating * @param string $cellID The ID (e.g. A3) of the cell that we are calculating
* @param Cell $pCell Cell to calculate * @param Cell $pCell Cell to calculate
* *
* @throws Calculation\Exception * @throws Exception
* *
* @return mixed * @return mixed
*/ */
@ -2908,7 +2904,7 @@ class Calculation
private function showValue($value) private function showValue($value)
{ {
if ($this->debugLog->getWriteDebugLog()) { if ($this->debugLog->getWriteDebugLog()) {
$testArray = Calculation\Functions::flattenArray($value); $testArray = Functions::flattenArray($value);
if (count($testArray) == 1) { if (count($testArray) == 1) {
$value = array_pop($testArray); $value = array_pop($testArray);
} }
@ -2933,7 +2929,7 @@ class Calculation
} }
} }
return Calculation\Functions::flattenSingleValue($value); return Functions::flattenSingleValue($value);
} }
/** /**
@ -2946,7 +2942,7 @@ class Calculation
private function showTypeDetails($value) private function showTypeDetails($value)
{ {
if ($this->debugLog->getWriteDebugLog()) { if ($this->debugLog->getWriteDebugLog()) {
$testArray = Calculation\Functions::flattenArray($value); $testArray = Functions::flattenArray($value);
if (count($testArray) == 1) { if (count($testArray) == 1) {
$value = array_pop($testArray); $value = array_pop($testArray);
} }
@ -3070,7 +3066,7 @@ class Calculation
/** /**
* @param string $formula * @param string $formula
* @param null|Cell $pCell * @param null|\PhpOffice\PhpSpreadsheet\Cell\Cell $pCell
* *
* @return bool * @return bool
*/ */
@ -3507,7 +3503,7 @@ class Calculation
} }
$stack->push('Cell Reference', $cellValue, $cellRef); $stack->push('Cell Reference', $cellValue, $cellRef);
} else { } else {
$stack->push('Error', Calculation\Functions::REF(), null); $stack->push('Error', Functions::REF(), null);
} }
break; break;
@ -3551,7 +3547,7 @@ class Calculation
// Perform the required operation against the operand 1 matrix, passing in operand 2 // Perform the required operation against the operand 1 matrix, passing in operand 2
$matrixResult = $matrix->concat($operand2); $matrixResult = $matrix->concat($operand2);
$result = $matrixResult->getArray(); $result = $matrixResult->getArray();
} catch (Exception $ex) { } catch (\Exception $ex) {
$this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
$result = '#VALUE!'; $result = '#VALUE!';
} }
@ -3599,7 +3595,7 @@ class Calculation
$matrix1 = new Shared\JAMA\Matrix($arg); $matrix1 = new Shared\JAMA\Matrix($arg);
$matrixResult = $matrix1->arrayTimesEquals($multiplier); $matrixResult = $matrix1->arrayTimesEquals($multiplier);
$result = $matrixResult->getArray(); $result = $matrixResult->getArray();
} catch (Exception $ex) { } catch (\Exception $ex) {
$this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
$result = '#VALUE!'; $result = '#VALUE!';
} }
@ -3613,7 +3609,7 @@ class Calculation
if (isset($matches[8])) { if (isset($matches[8])) {
if ($pCell === null) { if ($pCell === null) {
// We can't access the range, so return a REF error // We can't access the range, so return a REF error
$cellValue = Calculation\Functions::REF(); $cellValue = Functions::REF();
} else { } else {
$cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10];
if ($matches[2] > '') { if ($matches[2] > '') {
@ -3643,7 +3639,7 @@ class Calculation
} else { } else {
if ($pCell === null) { if ($pCell === null) {
// We can't access the cell, so return a REF error // We can't access the cell, so return a REF error
$cellValue = Calculation\Functions::REF(); $cellValue = Functions::REF();
} else { } else {
$cellRef = $matches[6] . $matches[7]; $cellRef = $matches[6] . $matches[7];
if ($matches[2] > '') { if ($matches[2] > '') {
@ -3734,7 +3730,7 @@ class Calculation
if ($functionName != 'MKMATRIX') { if ($functionName != 'MKMATRIX') {
if ($this->debugLog->getWriteDebugLog()) { if ($this->debugLog->getWriteDebugLog()) {
krsort($argArrayVals); krsort($argArrayVals);
$this->debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); $this->debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Functions::flattenArray($argArrayVals)), ' )');
} }
} }
@ -3745,7 +3741,7 @@ class Calculation
if (!is_array($functionCall)) { if (!is_array($functionCall)) {
foreach ($args as &$arg) { foreach ($args as &$arg) {
$arg = Calculation\Functions::flattenSingleValue($arg); $arg = Functions::flattenSingleValue($arg);
} }
unset($arg); unset($arg);
} }
@ -3887,7 +3883,7 @@ class Calculation
} }
// Use case insensitive comparaison if not OpenOffice mode // Use case insensitive comparaison if not OpenOffice mode
if (Calculation\Functions::getCompatibilityMode() != Calculation\Functions::COMPATIBILITY_OPENOFFICE) { if (Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) {
if (is_string($operand1)) { if (is_string($operand1)) {
$operand1 = strtoupper($operand1); $operand1 = strtoupper($operand1);
} }
@ -3896,7 +3892,7 @@ class Calculation
} }
} }
$useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && Calculation\Functions::getCompatibilityMode() == Calculation\Functions::COMPATIBILITY_OPENOFFICE; $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE;
// execute the necessary operation // execute the necessary operation
switch ($operation) { switch ($operation) {
@ -4016,15 +4012,15 @@ class Calculation
// Perform the required operation against the operand 1 matrix, passing in operand 2 // Perform the required operation against the operand 1 matrix, passing in operand 2
$matrixResult = $matrix->$matrixFunction($operand2); $matrixResult = $matrix->$matrixFunction($operand2);
$result = $matrixResult->getArray(); $result = $matrixResult->getArray();
} catch (Exception $ex) { } catch (\Exception $ex) {
$this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
$result = '#VALUE!'; $result = '#VALUE!';
} }
} else { } else {
if ((Calculation\Functions::getCompatibilityMode() != Calculation\Functions::COMPATIBILITY_OPENOFFICE) && if ((Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) &&
((is_string($operand1) && !is_numeric($operand1) && strlen($operand1) > 0) || ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1) > 0) ||
(is_string($operand2) && !is_numeric($operand2) && strlen($operand2) > 0))) { (is_string($operand2) && !is_numeric($operand2) && strlen($operand2) > 0))) {
$result = Calculation\Functions::VALUE(); $result = Functions::VALUE();
} else { } else {
// If we're dealing with non-matrix operations, execute the necessary operation // If we're dealing with non-matrix operations, execute the necessary operation
switch ($operation) { switch ($operation) {
@ -4078,7 +4074,7 @@ class Calculation
$this->formulaError = $errorMessage; $this->formulaError = $errorMessage;
$this->cyclicReferenceStack->clear(); $this->cyclicReferenceStack->clear();
if (!$this->suppressFormulaErrors) { if (!$this->suppressFormulaErrors) {
throw new Calculation\Exception($errorMessage); throw new Exception($errorMessage);
} }
trigger_error($errorMessage, E_USER_ERROR); trigger_error($errorMessage, E_USER_ERROR);
} }
@ -4090,7 +4086,7 @@ class Calculation
* @param Worksheet $pSheet Worksheet * @param Worksheet $pSheet Worksheet
* @param bool $resetLog Flag indicating whether calculation log should be reset or not * @param bool $resetLog Flag indicating whether calculation log should be reset or not
* *
* @throws Calculation\Exception * @throws Exception
* *
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
*/ */
@ -4141,7 +4137,7 @@ class Calculation
* @param Worksheet $pSheet Worksheet * @param Worksheet $pSheet Worksheet
* @param bool $resetLog Flag indicating whether calculation log should be reset or not * @param bool $resetLog Flag indicating whether calculation log should be reset or not
* *
* @throws Calculation\Exception * @throws Exception
* *
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
*/ */
@ -4170,7 +4166,7 @@ class Calculation
$pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1]; $pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
} }
} else { } else {
return Calculation\Functions::REF(); return Functions::REF();
} }
// Extract range // Extract range
@ -4218,7 +4214,7 @@ class Calculation
/** /**
* Get a list of all implemented functions as an array of function objects. * Get a list of all implemented functions as an array of function objects.
* *
* @return array of Calculation\Category * @return array of Category
*/ */
public function getFunctions() public function getFunctions()
{ {

View File

@ -2,8 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Calculation; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation;
class Database class Database
{ {
/** /**

View File

@ -1,6 +1,6 @@
<?php <?php
namespace PhpOffice\PhpSpreadsheet\CalcEngine; namespace PhpOffice\PhpSpreadsheet\Calculation\Engine;
class CyclicReferenceStack class CyclicReferenceStack
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace PhpOffice\PhpSpreadsheet\CalcEngine; namespace PhpOffice\PhpSpreadsheet\Calculation\Engine;
class Logger class Logger
{ {

View File

@ -2,8 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Calculation; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation;
class Functions class Functions
{ {
const PRECISION = 8.88E-016; const PRECISION = 8.88E-016;

View File

@ -2,8 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Calculation; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation;
class Logical class Logical
{ {
/** /**

View File

@ -2,8 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell;
class LookupRef class LookupRef
{ {

View File

@ -2,7 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Calculation; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
use PhpOffice\PhpSpreadsheet\Shared\JAMA\Matrix; use PhpOffice\PhpSpreadsheet\Shared\JAMA\Matrix;

View File

@ -2,7 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Calculation; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Shared\Trend\Trend; use PhpOffice\PhpSpreadsheet\Shared\Trend\Trend;
class Statistical class Statistical

View File

@ -2,7 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Calculation; namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\NumberFormat;

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Calculation\Token; namespace PhpOffice\PhpSpreadsheet\Calculation\Token;
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
class Stack class Stack
{ {

View File

@ -2,9 +2,8 @@
namespace PhpOffice\PhpSpreadsheet\Cell; namespace PhpOffice\PhpSpreadsheet\Cell;
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\RichText;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\NumberFormat;

View File

@ -1,8 +1,13 @@
<?php <?php
namespace PhpOffice\PhpSpreadsheet; namespace PhpOffice\PhpSpreadsheet\Cell;
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Collection\Cells; use PhpOffice\PhpSpreadsheet\Collection\Cells;
use PhpOffice\PhpSpreadsheet\Exception;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Style;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class Cell class Cell
{ {
@ -16,7 +21,7 @@ class Cell
/** /**
* Value binder to use. * Value binder to use.
* *
* @var Cell\IValueBinder * @var IValueBinder
*/ */
private static $valueBinder; private static $valueBinder;
@ -106,8 +111,8 @@ class Cell
// Set datatype? // Set datatype?
if ($pDataType !== null) { if ($pDataType !== null) {
if ($pDataType == Cell\DataType::TYPE_STRING2) { if ($pDataType == DataType::TYPE_STRING2) {
$pDataType = Cell\DataType::TYPE_STRING; $pDataType = DataType::TYPE_STRING;
} }
$this->dataType = $pDataType; $this->dataType = $pDataType;
} elseif (!self::getValueBinder()->bindValue($this, $pValue)) { } elseif (!self::getValueBinder()->bindValue($this, $pValue)) {
@ -193,7 +198,7 @@ class Cell
* Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder). * Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder).
* *
* @param mixed $pValue Value * @param mixed $pValue Value
* @param string $pDataType Explicit data type, see Cell\DataType::TYPE_* * @param string $pDataType Explicit data type, see DataType::TYPE_*
* *
* @throws Exception * @throws Exception
* *
@ -203,34 +208,34 @@ class Cell
{ {
// set the value according to data type // set the value according to data type
switch ($pDataType) { switch ($pDataType) {
case Cell\DataType::TYPE_NULL: case DataType::TYPE_NULL:
$this->value = $pValue; $this->value = $pValue;
break; break;
case Cell\DataType::TYPE_STRING2: case DataType::TYPE_STRING2:
$pDataType = Cell\DataType::TYPE_STRING; $pDataType = DataType::TYPE_STRING;
// no break // no break
case Cell\DataType::TYPE_STRING: case DataType::TYPE_STRING:
// Synonym for string // Synonym for string
case Cell\DataType::TYPE_INLINE: case DataType::TYPE_INLINE:
// Rich text // Rich text
$this->value = Cell\DataType::checkString($pValue); $this->value = DataType::checkString($pValue);
break; break;
case Cell\DataType::TYPE_NUMERIC: case DataType::TYPE_NUMERIC:
$this->value = (float) $pValue; $this->value = (float) $pValue;
break; break;
case Cell\DataType::TYPE_FORMULA: case DataType::TYPE_FORMULA:
$this->value = (string) $pValue; $this->value = (string) $pValue;
break; break;
case Cell\DataType::TYPE_BOOL: case DataType::TYPE_BOOL:
$this->value = (bool) $pValue; $this->value = (bool) $pValue;
break; break;
case Cell\DataType::TYPE_ERROR: case DataType::TYPE_ERROR:
$this->value = Cell\DataType::checkErrorCode($pValue); $this->value = DataType::checkErrorCode($pValue);
break; break;
default: default:
@ -255,7 +260,7 @@ class Cell
*/ */
public function getCalculatedValue($resetLog = true) public function getCalculatedValue($resetLog = true)
{ {
if ($this->dataType == Cell\DataType::TYPE_FORMULA) { if ($this->dataType == DataType::TYPE_FORMULA) {
try { try {
$result = Calculation::getInstance( $result = Calculation::getInstance(
$this->getWorksheet()->getParent() $this->getWorksheet()->getParent()
@ -271,7 +276,7 @@ class Cell
return $this->calculatedValue; // Fallback for calculations referencing external files. return $this->calculatedValue; // Fallback for calculations referencing external files.
} }
throw new Calculation\Exception( throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(
$this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage() $this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage()
); );
} }
@ -332,14 +337,14 @@ class Cell
/** /**
* Set cell data type. * Set cell data type.
* *
* @param string $pDataType see Cell\DataType::TYPE_* * @param string $pDataType see DataType::TYPE_*
* *
* @return Cell * @return Cell
*/ */
public function setDataType($pDataType) public function setDataType($pDataType)
{ {
if ($pDataType == Cell\DataType::TYPE_STRING2) { if ($pDataType == DataType::TYPE_STRING2) {
$pDataType = Cell\DataType::TYPE_STRING; $pDataType = DataType::TYPE_STRING;
} }
$this->dataType = $pDataType; $this->dataType = $pDataType;
@ -353,7 +358,7 @@ class Cell
*/ */
public function isFormula() public function isFormula()
{ {
return $this->dataType == Cell\DataType::TYPE_FORMULA; return $this->dataType == DataType::TYPE_FORMULA;
} }
/** /**
@ -377,7 +382,7 @@ class Cell
* *
* @throws Exception * @throws Exception
* *
* @return Cell\DataValidation * @return DataValidation
*/ */
public function getDataValidation() public function getDataValidation()
{ {
@ -391,13 +396,13 @@ class Cell
/** /**
* Set Data validation rules. * Set Data validation rules.
* *
* @param Cell\DataValidation $pDataValidation * @param DataValidation $pDataValidation
* *
* @throws Exception * @throws Exception
* *
* @return Cell * @return Cell
*/ */
public function setDataValidation(Cell\DataValidation $pDataValidation = null) public function setDataValidation(DataValidation $pDataValidation = null)
{ {
if (!isset($this->parent)) { if (!isset($this->parent)) {
throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); throw new Exception('Cannot set data validation for cell that is not bound to a worksheet');
@ -429,7 +434,7 @@ class Cell
* *
* @throws Exception * @throws Exception
* *
* @return Cell\Hyperlink * @return Hyperlink
*/ */
public function getHyperlink() public function getHyperlink()
{ {
@ -443,13 +448,13 @@ class Cell
/** /**
* Set Hyperlink. * Set Hyperlink.
* *
* @param Cell\Hyperlink $pHyperlink * @param Hyperlink $pHyperlink
* *
* @throws Exception * @throws Exception
* *
* @return Cell * @return Cell
*/ */
public function setHyperlink(Cell\Hyperlink $pHyperlink = null) public function setHyperlink(Hyperlink $pHyperlink = null)
{ {
if (!isset($this->parent)) { if (!isset($this->parent)) {
throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
@ -1033,12 +1038,12 @@ class Cell
/** /**
* Get value binder to use. * Get value binder to use.
* *
* @return Cell\IValueBinder * @return IValueBinder
*/ */
public static function getValueBinder() public static function getValueBinder()
{ {
if (self::$valueBinder === null) { if (self::$valueBinder === null) {
self::$valueBinder = new Cell\DefaultValueBinder(); self::$valueBinder = new DefaultValueBinder();
} }
return self::$valueBinder; return self::$valueBinder;
@ -1047,11 +1052,11 @@ class Cell
/** /**
* Set value binder to use. * Set value binder to use.
* *
* @param Cell\IValueBinder $binder * @param IValueBinder $binder
* *
* @throws Exception * @throws Exception
*/ */
public static function setValueBinder(Cell\IValueBinder $binder) public static function setValueBinder(IValueBinder $binder)
{ {
self::$valueBinder = $binder; self::$valueBinder = $binder;
} }

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Cell; namespace PhpOffice\PhpSpreadsheet\Cell;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
class DataType class DataType

View File

@ -3,8 +3,7 @@
namespace PhpOffice\PhpSpreadsheet\Cell; namespace PhpOffice\PhpSpreadsheet\Cell;
use DateTime; use DateTime;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\RichText;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
class DefaultValueBinder implements IValueBinder class DefaultValueBinder implements IValueBinder

View File

@ -2,8 +2,6 @@
namespace PhpOffice\PhpSpreadsheet\Cell; namespace PhpOffice\PhpSpreadsheet\Cell;
use PhpOffice\PhpSpreadsheet\Cell;
interface IValueBinder interface IValueBinder
{ {
/** /**

View File

@ -1,6 +1,9 @@
<?php <?php
namespace PhpOffice\PhpSpreadsheet; namespace PhpOffice\PhpSpreadsheet\Chart;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class Chart class Chart
{ {
@ -21,35 +24,35 @@ class Chart
/** /**
* Chart Title. * Chart Title.
* *
* @var Chart\Title * @var Title
*/ */
private $title; private $title;
/** /**
* Chart Legend. * Chart Legend.
* *
* @var Chart\Legend * @var Legend
*/ */
private $legend; private $legend;
/** /**
* X-Axis Label. * X-Axis Label.
* *
* @var Chart\Title * @var Title
*/ */
private $xAxisLabel; private $xAxisLabel;
/** /**
* Y-Axis Label. * Y-Axis Label.
* *
* @var Chart\Title * @var Title
*/ */
private $yAxisLabel; private $yAxisLabel;
/** /**
* Chart Plot Area. * Chart Plot Area.
* *
* @var Chart\PlotArea * @var PlotArea
*/ */
private $plotArea; private $plotArea;
@ -70,28 +73,28 @@ class Chart
/** /**
* Chart Asix Y as. * Chart Asix Y as.
* *
* @var Chart\Axis * @var Axis
*/ */
private $yAxis; private $yAxis;
/** /**
* Chart Asix X as. * Chart Asix X as.
* *
* @var Chart\Axis * @var Axis
*/ */
private $xAxis; private $xAxis;
/** /**
* Chart Major Gridlines as. * Chart Major Gridlines as.
* *
* @var Chart\GridLines * @var GridLines
*/ */
private $majorGridlines; private $majorGridlines;
/** /**
* Chart Minor Gridlines as. * Chart Minor Gridlines as.
* *
* @var Chart\GridLines * @var GridLines
*/ */
private $minorGridlines; private $minorGridlines;
@ -144,7 +147,7 @@ class Chart
* @param mixed $plotVisibleOnly * @param mixed $plotVisibleOnly
* @param mixed $displayBlanksAs * @param mixed $displayBlanksAs
*/ */
public function __construct($name, Chart\Title $title = null, Chart\Legend $legend = null, Chart\PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Chart\Title $xAxisLabel = null, Chart\Title $yAxisLabel = null, Chart\Axis $xAxis = null, Chart\Axis $yAxis = null, Chart\GridLines $majorGridlines = null, Chart\GridLines $minorGridlines = null) public function __construct($name, Title $title = null, Legend $legend = null, PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null)
{ {
$this->name = $name; $this->name = $name;
$this->title = $title; $this->title = $title;
@ -185,7 +188,7 @@ class Chart
* *
* @param Worksheet $pValue * @param Worksheet $pValue
* *
* @throws Chart\Exception * @throws Exception
* *
* @return Chart * @return Chart
*/ */
@ -199,7 +202,7 @@ class Chart
/** /**
* Get Title. * Get Title.
* *
* @return Chart\Title * @return Title
*/ */
public function getTitle() public function getTitle()
{ {
@ -209,11 +212,11 @@ class Chart
/** /**
* Set Title. * Set Title.
* *
* @param Chart\Title $title * @param Title $title
* *
* @return Chart * @return Chart
*/ */
public function setTitle(Chart\Title $title) public function setTitle(Title $title)
{ {
$this->title = $title; $this->title = $title;
@ -223,7 +226,7 @@ class Chart
/** /**
* Get Legend. * Get Legend.
* *
* @return Chart\Legend * @return Legend
*/ */
public function getLegend() public function getLegend()
{ {
@ -233,11 +236,11 @@ class Chart
/** /**
* Set Legend. * Set Legend.
* *
* @param Chart\Legend $legend * @param Legend $legend
* *
* @return Chart * @return Chart
*/ */
public function setLegend(Chart\Legend $legend) public function setLegend(Legend $legend)
{ {
$this->legend = $legend; $this->legend = $legend;
@ -247,7 +250,7 @@ class Chart
/** /**
* Get X-Axis Label. * Get X-Axis Label.
* *
* @return Chart\Title * @return Title
*/ */
public function getXAxisLabel() public function getXAxisLabel()
{ {
@ -257,11 +260,11 @@ class Chart
/** /**
* Set X-Axis Label. * Set X-Axis Label.
* *
* @param Chart\Title $label * @param Title $label
* *
* @return Chart * @return Chart
*/ */
public function setXAxisLabel(Chart\Title $label) public function setXAxisLabel(Title $label)
{ {
$this->xAxisLabel = $label; $this->xAxisLabel = $label;
@ -271,7 +274,7 @@ class Chart
/** /**
* Get Y-Axis Label. * Get Y-Axis Label.
* *
* @return Chart\Title * @return Title
*/ */
public function getYAxisLabel() public function getYAxisLabel()
{ {
@ -281,11 +284,11 @@ class Chart
/** /**
* Set Y-Axis Label. * Set Y-Axis Label.
* *
* @param Chart\Title $label * @param Title $label
* *
* @return Chart * @return Chart
*/ */
public function setYAxisLabel(Chart\Title $label) public function setYAxisLabel(Title $label)
{ {
$this->yAxisLabel = $label; $this->yAxisLabel = $label;
@ -295,7 +298,7 @@ class Chart
/** /**
* Get Plot Area. * Get Plot Area.
* *
* @return Chart\PlotArea * @return PlotArea
*/ */
public function getPlotArea() public function getPlotArea()
{ {
@ -351,7 +354,7 @@ class Chart
/** /**
* Get yAxis. * Get yAxis.
* *
* @return Chart\Axis * @return Axis
*/ */
public function getChartAxisY() public function getChartAxisY()
{ {
@ -359,13 +362,13 @@ class Chart
return $this->yAxis; return $this->yAxis;
} }
return new Chart\Axis(); return new Axis();
} }
/** /**
* Get xAxis. * Get xAxis.
* *
* @return Chart\Axis * @return Axis
*/ */
public function getChartAxisX() public function getChartAxisX()
{ {
@ -373,13 +376,13 @@ class Chart
return $this->xAxis; return $this->xAxis;
} }
return new Chart\Axis(); return new Axis();
} }
/** /**
* Get Major Gridlines. * Get Major Gridlines.
* *
* @return Chart\GridLines * @return GridLines
*/ */
public function getMajorGridlines() public function getMajorGridlines()
{ {
@ -387,13 +390,13 @@ class Chart
return $this->majorGridlines; return $this->majorGridlines;
} }
return new Chart\GridLines(); return new GridLines();
} }
/** /**
* Get Minor Gridlines. * Get Minor Gridlines.
* *
* @return Chart\GridLines * @return GridLines
*/ */
public function getMinorGridlines() public function getMinorGridlines()
{ {
@ -401,7 +404,7 @@ class Chart
return $this->minorGridlines; return $this->minorGridlines;
} }
return new Chart\GridLines(); return new GridLines();
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Chart; namespace PhpOffice\PhpSpreadsheet\Chart;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class DataSeries class DataSeries
{ {

View File

@ -2,10 +2,10 @@
namespace PhpOffice\PhpSpreadsheet\Chart; namespace PhpOffice\PhpSpreadsheet\Chart;
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class DataSeriesValues class DataSeriesValues
{ {

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Chart; namespace PhpOffice\PhpSpreadsheet\Chart;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class PlotArea class PlotArea
{ {

View File

@ -2,14 +2,14 @@
namespace PhpOffice\PhpSpreadsheet\Chart\Renderer; namespace PhpOffice\PhpSpreadsheet\Chart\Renderer;
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
interface IRenderer interface IRenderer
{ {
/** /**
* IRenderer constructor. * IRenderer constructor.
* *
* @param Chart $chart * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $chart
*/ */
public function __construct(Chart $chart); public function __construct(Chart $chart);

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Chart\Renderer; namespace PhpOffice\PhpSpreadsheet\Chart\Renderer;
use PhpOffice\PhpSpreadsheet\Chart; use PhpOffice\PhpSpreadsheet\Chart\Chart;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
require_once __DIR__ . '/Polyfill.php'; require_once __DIR__ . '/Polyfill.php';

View File

@ -2,9 +2,9 @@
namespace PhpOffice\PhpSpreadsheet\Collection; namespace PhpOffice\PhpSpreadsheet\Collection;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use Psr\SimpleCache\CacheInterface; use Psr\SimpleCache\CacheInterface;
class Cells class Cells
@ -390,7 +390,7 @@ class Cells
* *
* @throws PhpSpreadsheetException * @throws PhpSpreadsheetException
* *
* @return Cell * @return \PhpOffice\PhpSpreadsheet\Cell\Cell
*/ */
public function add($pCoord, Cell $cell) public function add($pCoord, Cell $cell)
{ {
@ -413,7 +413,7 @@ class Cells
* *
* @throws PhpSpreadsheetException * @throws PhpSpreadsheetException
* *
* @return Cell Cell that was found, or null if not found * @return \PhpOffice\PhpSpreadsheet\Cell\Cell Cell that was found, or null if not found
*/ */
public function get($pCoord) public function get($pCoord)
{ {

View File

@ -3,7 +3,7 @@
namespace PhpOffice\PhpSpreadsheet\Collection; namespace PhpOffice\PhpSpreadsheet\Collection;
use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
abstract class CellsFactory abstract class CellsFactory
{ {

View File

@ -2,6 +2,8 @@
namespace PhpOffice\PhpSpreadsheet; namespace PhpOffice\PhpSpreadsheet;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
class Comment implements IComparable class Comment implements IComparable
{ {
/** /**

View File

@ -6,7 +6,7 @@ use DOMDocument;
use DOMElement; use DOMElement;
use DOMNode; use DOMNode;
use DOMText; use DOMText;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\Font;

View File

@ -85,8 +85,8 @@ class Migrator
'PHPExcel_Writer_Excel2007_Worksheet' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet::class, 'PHPExcel_Writer_Excel2007_Worksheet' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet::class,
'PHPExcel_Writer_Excel2007_WriterPart' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart::class, 'PHPExcel_Writer_Excel2007_WriterPart' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart::class,
'PHPExcel_CachedObjectStorage_CacheBase' => \PhpOffice\PhpSpreadsheet\Collection\Cells::class, 'PHPExcel_CachedObjectStorage_CacheBase' => \PhpOffice\PhpSpreadsheet\Collection\Cells::class,
'PHPExcel_CalcEngine_CyclicReferenceStack' => \PhpOffice\PhpSpreadsheet\CalcEngine\CyclicReferenceStack::class, 'PHPExcel_CalcEngine_CyclicReferenceStack' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack::class,
'PHPExcel_CalcEngine_Logger' => \PhpOffice\PhpSpreadsheet\CalcEngine\Logger::class, 'PHPExcel_CalcEngine_Logger' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger::class,
'PHPExcel_Calculation_Functions' => \PhpOffice\PhpSpreadsheet\Calculation\Functions::class, 'PHPExcel_Calculation_Functions' => \PhpOffice\PhpSpreadsheet\Calculation\Functions::class,
'PHPExcel_Calculation_Function' => \PhpOffice\PhpSpreadsheet\Calculation\Category::class, 'PHPExcel_Calculation_Function' => \PhpOffice\PhpSpreadsheet\Calculation\Category::class,
'PHPExcel_Calculation_Database' => \PhpOffice\PhpSpreadsheet\Calculation\Database::class, 'PHPExcel_Calculation_Database' => \PhpOffice\PhpSpreadsheet\Calculation\Database::class,
@ -190,9 +190,9 @@ class Migrator
'PHPExcel_Writer_Excel5' => \PhpOffice\PhpSpreadsheet\Writer\Xls::class, 'PHPExcel_Writer_Excel5' => \PhpOffice\PhpSpreadsheet\Writer\Xls::class,
'PHPExcel_Writer_Excel2007' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx::class, 'PHPExcel_Writer_Excel2007' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx::class,
'PHPExcel_CachedObjectStorageFactory' => \PhpOffice\PhpSpreadsheet\Collection\CellsFactory::class, 'PHPExcel_CachedObjectStorageFactory' => \PhpOffice\PhpSpreadsheet\Collection\CellsFactory::class,
'PHPExcel_Calculation' => \PhpOffice\PhpSpreadsheet\Calculation::class, 'PHPExcel_Calculation' => \PhpOffice\PhpSpreadsheet\Calculation\Calculation::class,
'PHPExcel_Cell' => \PhpOffice\PhpSpreadsheet\Cell::class, 'PHPExcel_Cell' => \PhpOffice\PhpSpreadsheet\Cell\Cell::class,
'PHPExcel_Chart' => \PhpOffice\PhpSpreadsheet\Chart::class, 'PHPExcel_Chart' => \PhpOffice\PhpSpreadsheet\Chart\Chart::class,
'PHPExcel_Comment' => \PhpOffice\PhpSpreadsheet\Comment::class, 'PHPExcel_Comment' => \PhpOffice\PhpSpreadsheet\Comment::class,
'PHPExcel_Exception' => \PhpOffice\PhpSpreadsheet\Exception::class, 'PHPExcel_Exception' => \PhpOffice\PhpSpreadsheet\Exception::class,
'PHPExcel_HashTable' => \PhpOffice\PhpSpreadsheet\HashTable::class, 'PHPExcel_HashTable' => \PhpOffice\PhpSpreadsheet\HashTable::class,
@ -200,10 +200,10 @@ class Migrator
'PHPExcel_IOFactory' => \PhpOffice\PhpSpreadsheet\IOFactory::class, 'PHPExcel_IOFactory' => \PhpOffice\PhpSpreadsheet\IOFactory::class,
'PHPExcel_NamedRange' => \PhpOffice\PhpSpreadsheet\NamedRange::class, 'PHPExcel_NamedRange' => \PhpOffice\PhpSpreadsheet\NamedRange::class,
'PHPExcel_ReferenceHelper' => \PhpOffice\PhpSpreadsheet\ReferenceHelper::class, 'PHPExcel_ReferenceHelper' => \PhpOffice\PhpSpreadsheet\ReferenceHelper::class,
'PHPExcel_RichText' => \PhpOffice\PhpSpreadsheet\RichText::class, 'PHPExcel_RichText' => \PhpOffice\PhpSpreadsheet\RichText\RichText::class,
'PHPExcel_Settings' => \PhpOffice\PhpSpreadsheet\Settings::class, 'PHPExcel_Settings' => \PhpOffice\PhpSpreadsheet\Settings::class,
'PHPExcel_Style' => \PhpOffice\PhpSpreadsheet\Style::class, 'PHPExcel_Style' => \PhpOffice\PhpSpreadsheet\Style\Style::class,
'PHPExcel_Worksheet' => \PhpOffice\PhpSpreadsheet\Worksheet::class, 'PHPExcel_Worksheet' => \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::class,
'PHPExcel' => \PhpOffice\PhpSpreadsheet\Spreadsheet::class, 'PHPExcel' => \PhpOffice\PhpSpreadsheet\Spreadsheet::class,
// methods // methods
'MINUTEOFHOUR' => 'MINUTE', 'MINUTEOFHOUR' => 'MINUTE',

View File

@ -2,6 +2,8 @@
namespace PhpOffice\PhpSpreadsheet; namespace PhpOffice\PhpSpreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class NamedRange class NamedRange
{ {
/** /**

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;

View File

@ -2,10 +2,11 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\ReferenceHelper; use PhpOffice\PhpSpreadsheet\ReferenceHelper;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Shared\File;
@ -404,7 +405,7 @@ class Gnumeric extends BaseReader implements IReader
$ValueType = $cellAttributes->ValueType; $ValueType = $cellAttributes->ValueType;
$ExprID = (string) $cellAttributes->ExprID; $ExprID = (string) $cellAttributes->ExprID;
$type = Cell\DataType::TYPE_FORMULA; $type = DataType::TYPE_FORMULA;
if ($ExprID > '') { if ($ExprID > '') {
if (((string) $cell) > '') { if (((string) $cell) > '') {
$this->expressions[$ExprID] = [ $this->expressions[$ExprID] = [
@ -423,15 +424,15 @@ class Gnumeric extends BaseReader implements IReader
$worksheetName $worksheetName
); );
} }
$type = Cell\DataType::TYPE_FORMULA; $type = DataType::TYPE_FORMULA;
} else { } else {
switch ($ValueType) { switch ($ValueType) {
case '10': // NULL case '10': // NULL
$type = Cell\DataType::TYPE_NULL; $type = DataType::TYPE_NULL;
break; break;
case '20': // Boolean case '20': // Boolean
$type = Cell\DataType::TYPE_BOOL; $type = DataType::TYPE_BOOL;
$cell = ($cell == 'TRUE') ? true : false; $cell = ($cell == 'TRUE') ? true : false;
break; break;
@ -440,15 +441,15 @@ class Gnumeric extends BaseReader implements IReader
// Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case
// no break // no break
case '40': // Float case '40': // Float
$type = Cell\DataType::TYPE_NUMERIC; $type = DataType::TYPE_NUMERIC;
break; break;
case '50': // Error case '50': // Error
$type = Cell\DataType::TYPE_ERROR; $type = DataType::TYPE_ERROR;
break; break;
case '60': // String case '60': // String
$type = Cell\DataType::TYPE_STRING; $type = DataType::TYPE_STRING;
break; break;
case '70': // Cell Range case '70': // Cell Range

View File

@ -6,12 +6,12 @@ use DOMDocument;
use DOMElement; use DOMElement;
use DOMNode; use DOMNode;
use DOMText; use DOMText;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
/** PhpSpreadsheet root directory */ /** PhpSpreadsheet root directory */
class Html extends BaseReader implements IReader class Html extends BaseReader implements IReader

View File

@ -4,11 +4,11 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
use DateTime; use DateTime;
use DateTimeZone; use DateTimeZone;
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType; use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Document\Properties; use PhpOffice\PhpSpreadsheet\Document\Properties;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Shared\File;

View File

@ -2,8 +2,8 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Border;

View File

@ -2,11 +2,12 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Cell\DataValidation; use PhpOffice\PhpSpreadsheet\Cell\DataValidation;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Shared\CodePage; use PhpOffice\PhpSpreadsheet\Shared\CodePage;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Escher; use PhpOffice\PhpSpreadsheet\Shared\Escher;
@ -16,16 +17,16 @@ use PhpOffice\PhpSpreadsheet\Shared\OLE;
use PhpOffice\PhpSpreadsheet\Shared\OLERead; use PhpOffice\PhpSpreadsheet\Shared\OLERead;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style;
use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Borders; use PhpOffice\PhpSpreadsheet\Style\Borders;
use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\Font;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\Protection; use PhpOffice\PhpSpreadsheet\Style\Protection;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Style\Style;
use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing; use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing;
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup; use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
use PhpOffice\PhpSpreadsheet\Worksheet\SheetView; use PhpOffice\PhpSpreadsheet\Worksheet\SheetView;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
// Original file header of ParseXL (used as the base for this class): // Original file header of ParseXL (used as the base for this class):
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
@ -1175,7 +1176,7 @@ class Xls extends BaseReader implements IReader
list($column, $row) = Cell::coordinateFromString($cell); list($column, $row) = Cell::coordinateFromString($cell);
if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) { if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) {
$formula = $this->getFormulaFromStructure($this->sharedFormulas[$baseCell], $cell); $formula = $this->getFormulaFromStructure($this->sharedFormulas[$baseCell], $cell);
$this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, Cell\DataType::TYPE_FORMULA); $this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, DataType::TYPE_FORMULA);
} }
} }
} }
@ -3740,7 +3741,7 @@ class Xls extends BaseReader implements IReader
} }
// add cell // add cell
$cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC); $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC);
} }
} }
@ -3811,13 +3812,13 @@ class Xls extends BaseReader implements IReader
} }
if ($this->readEmptyCells || trim($richText->getPlainText()) !== '') { if ($this->readEmptyCells || trim($richText->getPlainText()) !== '') {
$cell = $this->phpSheet->getCell($columnString . ($row + 1)); $cell = $this->phpSheet->getCell($columnString . ($row + 1));
$cell->setValueExplicit($richText, Cell\DataType::TYPE_STRING); $cell->setValueExplicit($richText, DataType::TYPE_STRING);
$emptyCell = false; $emptyCell = false;
} }
} else { } else {
if ($this->readEmptyCells || trim($this->sst[$index]['value']) !== '') { if ($this->readEmptyCells || trim($this->sst[$index]['value']) !== '') {
$cell = $this->phpSheet->getCell($columnString . ($row + 1)); $cell = $this->phpSheet->getCell($columnString . ($row + 1));
$cell->setValueExplicit($this->sst[$index]['value'], Cell\DataType::TYPE_STRING); $cell->setValueExplicit($this->sst[$index]['value'], DataType::TYPE_STRING);
$emptyCell = false; $emptyCell = false;
} }
} }
@ -3875,7 +3876,7 @@ class Xls extends BaseReader implements IReader
} }
// add cell value // add cell value
$cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC); $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC);
} }
$offset += 6; $offset += 6;
@ -3919,7 +3920,7 @@ class Xls extends BaseReader implements IReader
} }
// add cell value // add cell value
$cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC); $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC);
} }
} }
@ -3986,7 +3987,7 @@ class Xls extends BaseReader implements IReader
// offset: 6; size: 8; result of the formula // offset: 6; size: 8; result of the formula
if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) {
// String formula. Result follows in appended STRING record // String formula. Result follows in appended STRING record
$dataType = Cell\DataType::TYPE_STRING; $dataType = DataType::TYPE_STRING;
// read possible SHAREDFMLA record // read possible SHAREDFMLA record
$code = self::getUInt2d($this->data, $this->pos); $code = self::getUInt2d($this->data, $this->pos);
@ -4000,23 +4001,23 @@ class Xls extends BaseReader implements IReader
&& (ord($recordData[12]) == 255) && (ord($recordData[12]) == 255)
&& (ord($recordData[13]) == 255)) { && (ord($recordData[13]) == 255)) {
// Boolean formula. Result is in +2; 0=false, 1=true // Boolean formula. Result is in +2; 0=false, 1=true
$dataType = Cell\DataType::TYPE_BOOL; $dataType = DataType::TYPE_BOOL;
$value = (bool) ord($recordData[8]); $value = (bool) ord($recordData[8]);
} elseif ((ord($recordData[6]) == 2) } elseif ((ord($recordData[6]) == 2)
&& (ord($recordData[12]) == 255) && (ord($recordData[12]) == 255)
&& (ord($recordData[13]) == 255)) { && (ord($recordData[13]) == 255)) {
// Error formula. Error code is in +2 // Error formula. Error code is in +2
$dataType = Cell\DataType::TYPE_ERROR; $dataType = DataType::TYPE_ERROR;
$value = Xls\ErrorCode::lookup(ord($recordData[8])); $value = Xls\ErrorCode::lookup(ord($recordData[8]));
} elseif ((ord($recordData[6]) == 3) } elseif ((ord($recordData[6]) == 3)
&& (ord($recordData[12]) == 255) && (ord($recordData[12]) == 255)
&& (ord($recordData[13]) == 255)) { && (ord($recordData[13]) == 255)) {
// Formula result is a null string // Formula result is a null string
$dataType = Cell\DataType::TYPE_NULL; $dataType = DataType::TYPE_NULL;
$value = ''; $value = '';
} else { } else {
// forumla result is a number, first 14 bytes like _NUMBER record // forumla result is a number, first 14 bytes like _NUMBER record
$dataType = Cell\DataType::TYPE_NUMERIC; $dataType = DataType::TYPE_NUMERIC;
$value = self::extractNumber(substr($recordData, 6, 8)); $value = self::extractNumber(substr($recordData, 6, 8));
} }
@ -4035,7 +4036,7 @@ class Xls extends BaseReader implements IReader
throw new Exception('Not BIFF8. Can only read BIFF8 formulas'); throw new Exception('Not BIFF8. Can only read BIFF8 formulas');
} }
$formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language $formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language
$cell->setValueExplicit('=' . $formula, Cell\DataType::TYPE_FORMULA); $cell->setValueExplicit('=' . $formula, DataType::TYPE_FORMULA);
} catch (PhpSpreadsheetException $e) { } catch (PhpSpreadsheetException $e) {
$cell->setValueExplicit($value, $dataType); $cell->setValueExplicit($value, $dataType);
} }
@ -4147,14 +4148,14 @@ class Xls extends BaseReader implements IReader
$value = (bool) $boolErr; $value = (bool) $boolErr;
// add cell value // add cell value
$cell->setValueExplicit($value, Cell\DataType::TYPE_BOOL); $cell->setValueExplicit($value, DataType::TYPE_BOOL);
break; break;
case 1: // error type case 1: // error type
$value = Xls\ErrorCode::lookup($boolErr); $value = Xls\ErrorCode::lookup($boolErr);
// add cell value // add cell value
$cell->setValueExplicit($value, Cell\DataType::TYPE_ERROR); $cell->setValueExplicit($value, DataType::TYPE_ERROR);
break; break;
} }
@ -4246,7 +4247,7 @@ class Xls extends BaseReader implements IReader
} }
if ($this->readEmptyCells || trim($value) !== '') { if ($this->readEmptyCells || trim($value) !== '') {
$cell = $this->phpSheet->getCell($columnString . ($row + 1)); $cell = $this->phpSheet->getCell($columnString . ($row + 1));
$cell->setValueExplicit($value, Cell\DataType::TYPE_STRING); $cell->setValueExplicit($value, DataType::TYPE_STRING);
if (!$this->readDataOnly) { if (!$this->readDataOnly) {
// add cell style // add cell style

View File

@ -2,7 +2,7 @@
namespace PhpOffice\PhpSpreadsheet\Reader\Xls; namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Reader\Xls; use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer;
use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer; use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer;

View File

@ -2,12 +2,12 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Document\Properties; use PhpOffice\PhpSpreadsheet\Document\Properties;
use PhpOffice\PhpSpreadsheet\NamedRange; use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart; use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart;
use PhpOffice\PhpSpreadsheet\ReferenceHelper; use PhpOffice\PhpSpreadsheet\ReferenceHelper;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Drawing; use PhpOffice\PhpSpreadsheet\Shared\Drawing;
@ -15,10 +15,16 @@ use PhpOffice\PhpSpreadsheet\Shared\File;
use PhpOffice\PhpSpreadsheet\Shared\Font; use PhpOffice\PhpSpreadsheet\Shared\Font;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper; use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style; use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Borders;
use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Conditional;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Worksheet; use PhpOffice\PhpSpreadsheet\Style\Protection;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column; use PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column;
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use XMLReader; use XMLReader;
use ZipArchive; use ZipArchive;
@ -969,7 +975,7 @@ class Xlsx extends BaseReader implements IReader
if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
foreach ($xmlSheet->conditionalFormatting as $conditional) { foreach ($xmlSheet->conditionalFormatting as $conditional) {
foreach ($conditional->cfRule as $cfRule) { foreach ($conditional->cfRule as $cfRule) {
if (((string) $cfRule['type'] == Style\Conditional::CONDITION_NONE || (string) $cfRule['type'] == Style\Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == Style\Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[(int) ($cfRule['dxfId'])])) { if (((string) $cfRule['type'] == Conditional::CONDITION_NONE || (string) $cfRule['type'] == Conditional::CONDITION_CELLIS || (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule['type'] == Conditional::CONDITION_EXPRESSION) && isset($dxfs[(int) ($cfRule['dxfId'])])) {
$conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule; $conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule;
} }
} }
@ -979,7 +985,7 @@ class Xlsx extends BaseReader implements IReader
ksort($cfRules); ksort($cfRules);
$conditionalStyles = []; $conditionalStyles = [];
foreach ($cfRules as $cfRule) { foreach ($cfRules as $cfRule) {
$objConditional = new Style\Conditional(); $objConditional = new Conditional();
$objConditional->setConditionType((string) $cfRule['type']); $objConditional->setConditionType((string) $cfRule['type']);
$objConditional->setOperatorType((string) $cfRule['operator']); $objConditional->setOperatorType((string) $cfRule['operator']);
@ -1475,7 +1481,7 @@ class Xlsx extends BaseReader implements IReader
$imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office');
$style = self::toCSSArray((string) $shape['style']); $style = self::toCSSArray((string) $shape['style']);
$hfImages[(string) $shape['id']] = new Worksheet\HeaderFooterDrawing(); $hfImages[(string) $shape['id']] = new HeaderFooterDrawing();
if (isset($imageData['title'])) { if (isset($imageData['title'])) {
$hfImages[(string) $shape['id']]->setName((string) $imageData['title']); $hfImages[(string) $shape['id']]->setName((string) $imageData['title']);
} }
@ -1555,7 +1561,7 @@ class Xlsx extends BaseReader implements IReader
$xfrm = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm; $xfrm = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm;
/** @var \SimpleXMLElement $outerShdw */ /** @var \SimpleXMLElement $outerShdw */
$outerShdw = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw; $outerShdw = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw;
$objDrawing = new Worksheet\Drawing(); $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
$objDrawing->setName((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name')); $objDrawing->setName((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name'));
$objDrawing->setDescription((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr')); $objDrawing->setDescription((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr'));
$objDrawing->setPath( $objDrawing->setPath(
@ -1602,7 +1608,7 @@ class Xlsx extends BaseReader implements IReader
$blip = $twoCellAnchor->pic->blipFill->children('http://schemas.openxmlformats.org/drawingml/2006/main')->blip; $blip = $twoCellAnchor->pic->blipFill->children('http://schemas.openxmlformats.org/drawingml/2006/main')->blip;
$xfrm = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm; $xfrm = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm;
$outerShdw = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw; $outerShdw = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw;
$objDrawing = new Worksheet\Drawing(); $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
$objDrawing->setName((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name')); $objDrawing->setName((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name'));
$objDrawing->setDescription((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr')); $objDrawing->setDescription((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr'));
$objDrawing->setPath( $objDrawing->setPath(
@ -1869,13 +1875,13 @@ class Xlsx extends BaseReader implements IReader
if (isset($color['rgb'])) { if (isset($color['rgb'])) {
return (string) $color['rgb']; return (string) $color['rgb'];
} elseif (isset($color['indexed'])) { } elseif (isset($color['indexed'])) {
return Style\Color::indexedColor($color['indexed'] - 7, $background)->getARGB(); return Color::indexedColor($color['indexed'] - 7, $background)->getARGB();
} elseif (isset($color['theme'])) { } elseif (isset($color['theme'])) {
if (self::$theme !== null) { if (self::$theme !== null) {
$returnColour = self::$theme->getColourByIndex((int) $color['theme']); $returnColour = self::$theme->getColourByIndex((int) $color['theme']);
if (isset($color['tint'])) { if (isset($color['tint'])) {
$tintAdjust = (float) $color['tint']; $tintAdjust = (float) $color['tint'];
$returnColour = Style\Color::changeBrightness($returnColour, $tintAdjust); $returnColour = Color::changeBrightness($returnColour, $tintAdjust);
} }
return 'FF' . $returnColour; return 'FF' . $returnColour;
@ -1913,7 +1919,7 @@ class Xlsx extends BaseReader implements IReader
$docStyle->getFont()->getColor()->setARGB(self::readColor($style->font->color)); $docStyle->getFont()->getColor()->setARGB(self::readColor($style->font->color));
if (isset($style->font->u) && !isset($style->font->u['val'])) { if (isset($style->font->u) && !isset($style->font->u['val'])) {
$docStyle->getFont()->setUnderline(Style\Font::UNDERLINE_SINGLE); $docStyle->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
} elseif (isset($style->font->u, $style->font->u['val'])) { } elseif (isset($style->font->u, $style->font->u['val'])) {
$docStyle->getFont()->setUnderline((string) $style->font->u['val']); $docStyle->getFont()->setUnderline((string) $style->font->u['val']);
} }
@ -1960,13 +1966,13 @@ class Xlsx extends BaseReader implements IReader
$diagonalUp = self::boolean((string) $style->border['diagonalUp']); $diagonalUp = self::boolean((string) $style->border['diagonalUp']);
$diagonalDown = self::boolean((string) $style->border['diagonalDown']); $diagonalDown = self::boolean((string) $style->border['diagonalDown']);
if (!$diagonalUp && !$diagonalDown) { if (!$diagonalUp && !$diagonalDown) {
$docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_NONE); $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_NONE);
} elseif ($diagonalUp && !$diagonalDown) { } elseif ($diagonalUp && !$diagonalDown) {
$docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_UP); $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_UP);
} elseif (!$diagonalUp && $diagonalDown) { } elseif (!$diagonalUp && $diagonalDown) {
$docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_DOWN); $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_DOWN);
} else { } else {
$docStyle->getBorders()->setDiagonalDirection(Style\Borders::DIAGONAL_BOTH); $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_BOTH);
} }
self::readBorder($docStyle->getBorders()->getLeft(), $style->border->left); self::readBorder($docStyle->getBorders()->getLeft(), $style->border->left);
self::readBorder($docStyle->getBorders()->getRight(), $style->border->right); self::readBorder($docStyle->getBorders()->getRight(), $style->border->right);
@ -1998,17 +2004,17 @@ class Xlsx extends BaseReader implements IReader
if (isset($style->protection)) { if (isset($style->protection)) {
if (isset($style->protection['locked'])) { if (isset($style->protection['locked'])) {
if (self::boolean((string) $style->protection['locked'])) { if (self::boolean((string) $style->protection['locked'])) {
$docStyle->getProtection()->setLocked(Style\Protection::PROTECTION_PROTECTED); $docStyle->getProtection()->setLocked(Protection::PROTECTION_PROTECTED);
} else { } else {
$docStyle->getProtection()->setLocked(Style\Protection::PROTECTION_UNPROTECTED); $docStyle->getProtection()->setLocked(Protection::PROTECTION_UNPROTECTED);
} }
} }
if (isset($style->protection['hidden'])) { if (isset($style->protection['hidden'])) {
if (self::boolean((string) $style->protection['hidden'])) { if (self::boolean((string) $style->protection['hidden'])) {
$docStyle->getProtection()->setHidden(Style\Protection::PROTECTION_PROTECTED); $docStyle->getProtection()->setHidden(Protection::PROTECTION_PROTECTED);
} else { } else {
$docStyle->getProtection()->setHidden(Style\Protection::PROTECTION_UNPROTECTED); $docStyle->getProtection()->setHidden(Protection::PROTECTION_UNPROTECTED);
} }
} }
} }
@ -2020,10 +2026,10 @@ class Xlsx extends BaseReader implements IReader
} }
/** /**
* @param Style\Border $docBorder * @param Border $docBorder
* @param \SimpleXMLElement $eleBorder * @param \SimpleXMLElement $eleBorder
*/ */
private static function readBorder($docBorder, $eleBorder) private static function readBorder(Border $docBorder, $eleBorder)
{ {
if (isset($eleBorder['style'])) { if (isset($eleBorder['style'])) {
$docBorder->setBorderStyle((string) $eleBorder['style']); $docBorder->setBorderStyle((string) $eleBorder['style']);
@ -2059,7 +2065,7 @@ class Xlsx extends BaseReader implements IReader
$objText->getFont()->setSize((string) $run->rPr->sz['val']); $objText->getFont()->setSize((string) $run->rPr->sz['val']);
} }
if (isset($run->rPr->color)) { if (isset($run->rPr->color)) {
$objText->getFont()->setColor(new Style\Color(self::readColor($run->rPr->color))); $objText->getFont()->setColor(new Color(self::readColor($run->rPr->color)));
} }
if ((isset($run->rPr->b['val']) && self::boolean((string) $run->rPr->b['val'])) || if ((isset($run->rPr->b['val']) && self::boolean((string) $run->rPr->b['val'])) ||
(isset($run->rPr->b) && !isset($run->rPr->b['val']))) { (isset($run->rPr->b) && !isset($run->rPr->b['val']))) {
@ -2079,7 +2085,7 @@ class Xlsx extends BaseReader implements IReader
} }
} }
if (isset($run->rPr->u) && !isset($run->rPr->u['val'])) { if (isset($run->rPr->u) && !isset($run->rPr->u['val'])) {
$objText->getFont()->setUnderline(Style\Font::UNDERLINE_SINGLE); $objText->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE);
} elseif (isset($run->rPr->u, $run->rPr->u['val'])) { } elseif (isset($run->rPr->u, $run->rPr->u['val'])) {
$objText->getFont()->setUnderline((string) $run->rPr->u['val']); $objText->getFont()->setUnderline((string) $run->rPr->u['val']);
} }

View File

@ -9,7 +9,7 @@ use PhpOffice\PhpSpreadsheet\Chart\Layout;
use PhpOffice\PhpSpreadsheet\Chart\Legend; use PhpOffice\PhpSpreadsheet\Chart\Legend;
use PhpOffice\PhpSpreadsheet\Chart\PlotArea; use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
use PhpOffice\PhpSpreadsheet\Chart\Title; use PhpOffice\PhpSpreadsheet\Chart\Title;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Font; use PhpOffice\PhpSpreadsheet\Style\Font;
use SimpleXMLElement; use SimpleXMLElement;
@ -210,7 +210,7 @@ class Chart
} }
} }
} }
$chart = new \PhpOffice\PhpSpreadsheet\Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); $chart = new \PhpOffice\PhpSpreadsheet\Chart\Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
return $chart; return $chart;
} }

View File

@ -2,9 +2,10 @@
namespace PhpOffice\PhpSpreadsheet\Reader; namespace PhpOffice\PhpSpreadsheet\Reader;
use PhpOffice\PhpSpreadsheet\Cell; use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Document\Properties; use PhpOffice\PhpSpreadsheet\Document\Properties;
use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Settings; use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\File; use PhpOffice\PhpSpreadsheet\Shared\File;
@ -648,7 +649,7 @@ class Xml extends BaseReader implements IReader
} }
if (isset($cell->Data)) { if (isset($cell->Data)) {
$cellValue = $cellData = $cell->Data; $cellValue = $cellData = $cell->Data;
$type = Cell\DataType::TYPE_NULL; $type = DataType::TYPE_NULL;
$cellData_ss = $cellData->attributes($namespaces['ss']); $cellData_ss = $cellData->attributes($namespaces['ss']);
if (isset($cellData_ss['Type'])) { if (isset($cellData_ss['Type'])) {
$cellDataType = $cellData_ss['Type']; $cellDataType = $cellData_ss['Type'];
@ -664,11 +665,11 @@ class Xml extends BaseReader implements IReader
*/ */
case 'String': case 'String':
$cellValue = self::convertStringEncoding($cellValue, $this->charSet); $cellValue = self::convertStringEncoding($cellValue, $this->charSet);
$type = Cell\DataType::TYPE_STRING; $type = DataType::TYPE_STRING;
break; break;
case 'Number': case 'Number':
$type = Cell\DataType::TYPE_NUMERIC; $type = DataType::TYPE_NUMERIC;
$cellValue = (float) $cellValue; $cellValue = (float) $cellValue;
if (floor($cellValue) == $cellValue) { if (floor($cellValue) == $cellValue) {
$cellValue = (int) $cellValue; $cellValue = (int) $cellValue;
@ -676,24 +677,24 @@ class Xml extends BaseReader implements IReader
break; break;
case 'Boolean': case 'Boolean':
$type = Cell\DataType::TYPE_BOOL; $type = DataType::TYPE_BOOL;
$cellValue = ($cellValue != 0); $cellValue = ($cellValue != 0);
break; break;
case 'DateTime': case 'DateTime':
$type = Cell\DataType::TYPE_NUMERIC; $type = DataType::TYPE_NUMERIC;
$cellValue = Date::PHPToExcel(strtotime($cellValue)); $cellValue = Date::PHPToExcel(strtotime($cellValue));
break; break;
case 'Error': case 'Error':
$type = Cell\DataType::TYPE_ERROR; $type = DataType::TYPE_ERROR;
break; break;
} }
} }
if ($hasCalculatedValue) { if ($hasCalculatedValue) {
$type = Cell\DataType::TYPE_FORMULA; $type = DataType::TYPE_FORMULA;
$columnNumber = Cell::columnIndexFromString($columnID); $columnNumber = Cell::columnIndexFromString($columnID);
if (substr($cellDataFormula, 0, 3) == 'of:') { if (substr($cellDataFormula, 0, 3) == 'of:') {
$cellDataFormula = substr($cellDataFormula, 3); $cellDataFormula = substr($cellDataFormula, 3);

Some files were not shown because too many files have changed in this diff Show More