Revision of release v1.3.2
This commit is contained in:
@ -1,2 +1,3 @@
|
||||
/tests export-ignore
|
||||
README.md export-ignore
|
||||
*.min.js binary
|
||||
|
@ -34,7 +34,7 @@ jobs:
|
||||
php: 7.1
|
||||
env: KEEP_XDEBUG=1
|
||||
script:
|
||||
- ./vendor/bin/phpunit --debug --coverage-clover coverage-clover.xml
|
||||
- travis_wait 40 ./vendor/bin/phpunit --debug --coverage-clover coverage-clover.xml
|
||||
after_script:
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover tests/coverage-clover.xml
|
||||
|
24
inc/vendor/phpoffice/phpspreadsheet/CHANGELOG.md
vendored
24
inc/vendor/phpoffice/phpspreadsheet/CHANGELOG.md
vendored
@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [1.2.1] - 2018-04-10
|
||||
|
||||
### Fixed
|
||||
|
||||
- Plain text and richtext mixed in same cell can be read - [#442](https://github.com/PHPOffice/PhpSpreadsheet/issues/442)
|
||||
|
||||
## [1.2.0] - 2018-03-04
|
||||
|
||||
### Added
|
||||
|
||||
- HTML writer creates a generator meta tag - [#312](https://github.com/PHPOffice/PhpSpreadsheet/issues/312)
|
||||
- Support invalid zoom value in XLSX format - [#350](https://github.com/PHPOffice/PhpSpreadsheet/pull/350)
|
||||
- Support for `_xlfn.` prefixed functions and `ISFORMULA`, `MODE.SNGL`, `STDEV.S`, `STDEV.P` - [#390](https://github.com/PHPOffice/PhpSpreadsheet/pull/390)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Avoid potentially unsupported PSR-16 cache keys - [#354](https://github.com/PHPOffice/PhpSpreadsheet/issues/354)
|
||||
- Check for MIME type to know if CSV reader can read a file - [#167](https://github.com/PHPOffice/PhpSpreadsheet/issues/167)
|
||||
- Use proper € symbol for currency format - [#379](https://github.com/PHPOffice/PhpSpreadsheet/pull/379)
|
||||
- Read printing area correctly when skipping some sheets - [#371](https://github.com/PHPOffice/PhpSpreadsheet/issues/371)
|
||||
- Avoid incorrectly overwriting calculated value type - [#394](https://github.com/PHPOffice/PhpSpreadsheet/issues/394)
|
||||
- Select correct cell when calling freezePane - [#389](https://github.com/PHPOffice/PhpSpreadsheet/issues/389)
|
||||
- `setStrikethrough()` did not set the font - [#403](https://github.com/PHPOffice/PhpSpreadsheet/issues/403)
|
||||
|
||||
## [1.1.0] - 2018-01-28
|
||||
|
||||
### Added
|
||||
|
35
inc/vendor/phpoffice/phpspreadsheet/README.md
vendored
Normal file
35
inc/vendor/phpoffice/phpspreadsheet/README.md
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
# PhpSpreadsheet
|
||||
|
||||
Master:
|
||||
[](https://travis-ci.org/PHPOffice/PhpSpreadsheet)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=master)
|
||||
[](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
||||
[](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
||||
[](https://packagist.org/packages/phpoffice/phpspreadsheet)
|
||||
[](https://gitter.im/PHPOffice/PhpSpreadsheet)
|
||||
|
||||
Develop:
|
||||
[](http://travis-ci.org/PHPOffice/PhpSpreadsheet)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=develop)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/?branch=develop)
|
||||
|
||||
PhpSpreadsheet is a library written in pure PHP and providing a set of classes that allow you to read from and to write to different spreadsheet file formats, like Excel and LibreOffice Calc.
|
||||
|
||||
## Documentation
|
||||
|
||||
Read more about it, including install instructions, in the official documentation:
|
||||
|
||||
https://phpspreadsheet.readthedocs.io
|
||||
|
||||
Please ask your support questions on [StackOverflow](http://stackoverflow.com/questions/tagged/phpspreadsheet), or have a quick chat on [Gitter](https://gitter.im/PHPOffice/PhpSpreadsheet).
|
||||
|
||||
## PHPExcel vs PhpSpreadsheet ?
|
||||
|
||||
PhpSpreadsheet is the next version of PHPExcel. It breaks compatibility to dramatically improve the code base quality (namespaces, PSR compliance, use of latest PHP language features, etc.).
|
||||
|
||||
Because all efforts have shifted to PhpSpreadsheet, PHPExcel will no longer be maintained. All contributions for PHPExcel, patches and new features, should target PhpSpreadsheet develop branch.
|
||||
|
||||
## License
|
||||
|
||||
PhpSpreadsheet is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/LICENSE)
|
@ -4,7 +4,7 @@
|
||||
"keywords": ["PHP", "OpenXML", "Excel", "xlsx", "xls", "ods", "gnumeric", "spreadsheet"],
|
||||
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
|
||||
"type": "library",
|
||||
"license": "LGPL-2.1",
|
||||
"license": "LGPL-2.1-or-later",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Maarten Balliauw",
|
||||
@ -58,8 +58,6 @@
|
||||
"friendsofphp/php-cs-fixer": "@stable"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "Required for exact column width autocalculation",
|
||||
"ext-dom": "Option to read and write HTML files",
|
||||
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
|
||||
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
|
||||
"tecnick.com/tcpdf": "Option for rendering PDF with PDF Writer",
|
||||
|
@ -83,7 +83,7 @@ Then point your browser to:
|
||||
The samples may also be run directly from the command line, for example:
|
||||
|
||||
```sh
|
||||
php vendor/phpoffice/phpspreadsheet/samples/01_Simple.php
|
||||
php vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php
|
||||
```
|
||||
|
||||
## Learn by documentation
|
||||
|
@ -178,13 +178,13 @@ It is also possible to set a range of cell values in a single call by
|
||||
passing an array of values to the `fromArray()` method.
|
||||
|
||||
``` php
|
||||
$arrayData = array(
|
||||
array(NULL, 2010, 2011, 2012),
|
||||
array('Q1', 12, 15, 21),
|
||||
array('Q2', 56, 73, 86),
|
||||
array('Q3', 52, 61, 69),
|
||||
array('Q4', 30, 32, 0),
|
||||
);
|
||||
$arrayData = [
|
||||
[NULL, 2010, 2011, 2012],
|
||||
['Q1', 12, 15, 21],
|
||||
['Q2', 56, 73, 86],
|
||||
['Q3', 52, 61, 69],
|
||||
['Q4', 30, 32, 0],
|
||||
];
|
||||
$spreadsheet->getActiveSheet()
|
||||
->fromArray(
|
||||
$arrayData, // The data to set
|
||||
@ -201,7 +201,7 @@ and columns. A 1-d array will be treated as a single row, which is
|
||||
particularly useful if you're fetching an array of data from a database.
|
||||
|
||||
``` php
|
||||
$rowArray = array('Value1', 'Value2', 'Value3', 'Value4');
|
||||
$rowArray = ['Value1', 'Value2', 'Value3', 'Value4'];
|
||||
$spreadsheet->getActiveSheet()
|
||||
->fromArray(
|
||||
$rowArray, // The data to set
|
||||
@ -218,7 +218,7 @@ the following will convert it into an appropriately structured 2-d array
|
||||
that can be fed to the `fromArray()` method:
|
||||
|
||||
``` php
|
||||
$rowArray = array('Value1', 'Value2', 'Value3', 'Value4');
|
||||
$rowArray = ['Value1', 'Value2', 'Value3', 'Value4'];
|
||||
$columnArray = array_chunk($rowArray, 1);
|
||||
$spreadsheet->getActiveSheet()
|
||||
->fromArray(
|
||||
|
@ -185,10 +185,10 @@ DateGroup rule identifying the selected year and month:
|
||||
$columnFilter->createRule()
|
||||
->setRule(
|
||||
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
|
||||
array(
|
||||
[
|
||||
'year' => 2012,
|
||||
'month' => 1
|
||||
)
|
||||
]
|
||||
)
|
||||
->setRuleType(
|
||||
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP
|
||||
|
@ -263,6 +263,28 @@ return an Excel date timestamp.
|
||||
Takes year, month and day values (and optional hour, minute and second
|
||||
values) and returns an Excel date timestamp value.
|
||||
|
||||
### Timezone support for Excel date timestamp conversions
|
||||
|
||||
The default timezone for the date functions in PhpSpreadsheet is UST (Universal Standard Time).
|
||||
If a different timezone needs to be used, these methods are available:
|
||||
|
||||
#### \PhpOffice\PhpSpreadsheet\Shared\Date::getDefaultTimezone()
|
||||
|
||||
Returns the current timezone value PhpSpeadsheet is using to handle dates and times.
|
||||
|
||||
#### \PhpOffice\PhpSpreadsheet\Shared\Date::setDefaultTimezone($timeZone)
|
||||
|
||||
Sets the timezone for Excel date timestamp conversions to $timeZone,
|
||||
which must be a valid PHP DateTimeZone value.
|
||||
The return value is a Boolean, where true is success,
|
||||
and false is failure (e.g. an invalid DateTimeZone value was passed.)
|
||||
|
||||
#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDate, $timeZone)
|
||||
#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimeStamp($excelDate, $timeZone)
|
||||
|
||||
These functions support a timezone as an optional second parameter.
|
||||
This applies a specific timezone to that function call without affecting the default PhpSpreadsheet Timezone.
|
||||
|
||||
## Function Reference
|
||||
|
||||
### Database Functions
|
||||
@ -308,21 +330,21 @@ This is the statistical mean.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -376,21 +398,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -447,21 +469,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -518,21 +540,21 @@ in which you specify a condition for the column.
|
||||
#### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -586,21 +608,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -654,21 +676,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -722,21 +744,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -791,21 +813,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -860,21 +882,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -928,21 +950,21 @@ in which you specify a condition for the column.
|
||||
##### Examples
|
||||
|
||||
``` php
|
||||
$database = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
|
||||
array( 'Apple', 18, 20, 14, 105.00 ),
|
||||
array( 'Pear', 12, 12, 10, 96.00 ),
|
||||
array( 'Cherry', 13, 14, 9, 105.00 ),
|
||||
array( 'Apple', 14, 15, 10, 75.00 ),
|
||||
array( 'Pear', 9, 8, 8, 76.80 ),
|
||||
array( 'Apple', 8, 9, 6, 45.00 ),
|
||||
);
|
||||
$database = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ],
|
||||
[ 'Apple', 18, 20, 14, 105.00 ],
|
||||
[ 'Pear', 12, 12, 10, 96.00 ],
|
||||
[ 'Cherry', 13, 14, 9, 105.00 ],
|
||||
[ 'Apple', 14, 15, 10, 75.00 ],
|
||||
[ 'Pear', 9, 8, 8, 76.80 ],
|
||||
[ 'Apple', 8, 9, 6, 45.00 ],
|
||||
];
|
||||
|
||||
$criteria = array(
|
||||
array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
|
||||
array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
|
||||
array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
|
||||
);
|
||||
$criteria = [
|
||||
[ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ],
|
||||
[ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ],
|
||||
[ '="=Pear"', NULL, NULL, NULL, NULL, NULL ],
|
||||
];
|
||||
|
||||
$worksheet->fromArray( $criteria, NULL, 'A1' )
|
||||
->fromArray( $database, NULL, 'A4' );
|
||||
@ -1046,7 +1068,7 @@ $retVal = $worksheet->getCell('D1')->getCalculatedValue();
|
||||
``` php
|
||||
// We're going to be calling the same cell calculation multiple times,
|
||||
// and expecting different return values, so disable calculation cacheing
|
||||
\PhpOffice\PhpSpreadsheet\Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
|
||||
\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
|
||||
|
||||
$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType();
|
||||
|
||||
@ -1055,8 +1077,8 @@ $saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType
|
||||
);
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'),
|
||||
array(2008, 12, 31)
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'],
|
||||
[2008, 12, 31]
|
||||
);
|
||||
// $retVal = 39813.0
|
||||
|
||||
@ -1065,8 +1087,8 @@ $retVal = call_user_func_array(
|
||||
);
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'),
|
||||
array(2008, 12, 31)
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'],
|
||||
[2008, 12, 31]
|
||||
);
|
||||
// $retVal = 1230681600
|
||||
|
||||
@ -1167,38 +1189,38 @@ $date1 = 1193317015; // PHP timestamp for 25-Oct-2007
|
||||
$date2 = 1449579415; // PHP timestamp for 8-Dec-2015
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
|
||||
array($date1, $date2, 'd')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
|
||||
[$date1, $date2, 'd']
|
||||
);
|
||||
// $retVal = 2966
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
|
||||
array($date1, $date2, 'm')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
|
||||
[$date1, $date2, 'm']
|
||||
);
|
||||
// $retVal = 97
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
|
||||
array($date1, $date2, 'y')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
|
||||
[$date1, $date2, 'y']
|
||||
);
|
||||
// $retVal = 8
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
|
||||
array($date1, $date2, 'ym')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
|
||||
[$date1, $date2, 'ym']
|
||||
);
|
||||
// $retVal = 1
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
|
||||
array($date1, $date2, 'yd')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
|
||||
[$date1, $date2, 'yd']
|
||||
);
|
||||
// $retVal = 44
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'),
|
||||
array($date1, $date2, 'md')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'],
|
||||
[$date1, $date2, 'md']
|
||||
);
|
||||
// $retVal = 13
|
||||
```
|
||||
@ -1258,7 +1280,7 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
|
||||
``` php
|
||||
// We're going to be calling the same cell calculation multiple times,
|
||||
// and expecting different return values, so disable calculation cacheing
|
||||
\PhpOffice\PhpSpreadsheet\Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
|
||||
\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
|
||||
|
||||
$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType();
|
||||
|
||||
@ -1267,8 +1289,8 @@ $saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType
|
||||
);
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'),
|
||||
array('31-Dec-2008')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'],
|
||||
['31-Dec-2008']
|
||||
);
|
||||
// $retVal = 39813.0
|
||||
|
||||
@ -1277,8 +1299,8 @@ $retVal = call_user_func_array(
|
||||
);
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'),
|
||||
array('31-Dec-2008')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'],
|
||||
['31-Dec-2008']
|
||||
);
|
||||
// $retVal = 1230681600
|
||||
|
||||
@ -1342,8 +1364,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
|
||||
|
||||
``` php
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYOFMONTH'),
|
||||
array('25-Dec-2008')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYOFMONTH'],
|
||||
['25-Dec-2008']
|
||||
);
|
||||
// $retVal = 25
|
||||
```
|
||||
@ -1428,14 +1450,14 @@ $date1 = 37655.0; // Excel timestamp for 25-Oct-2007
|
||||
$date2 = 39233.0; // Excel timestamp for 8-Dec-2015
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'),
|
||||
array($date1, $date2)
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'],
|
||||
[$date1, $date2]
|
||||
);
|
||||
// $retVal = 1558
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'),
|
||||
array($date1, $date2, TRUE)
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'],
|
||||
[$date1, $date2, TRUE]
|
||||
);
|
||||
// $retVal = 1557
|
||||
```
|
||||
@ -1508,8 +1530,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
|
||||
);
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EDATE'),
|
||||
array('31-Oct-2008',25)
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EDATE'],
|
||||
['31-Oct-2008', 25]
|
||||
);
|
||||
// $retVal = 40512.0 (30-Nov-2010)
|
||||
```
|
||||
@ -1579,8 +1601,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
|
||||
);
|
||||
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EOMONTH'),
|
||||
array('31-Oct-2008',13)
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EOMONTH'],
|
||||
['31-Oct-2008', 13]
|
||||
);
|
||||
// $retVal = 40147.0 (30-Nov-2010)
|
||||
```
|
||||
@ -1637,8 +1659,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
|
||||
|
||||
``` php
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'HOUROFDAY'),
|
||||
array('09:30')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'HOUROFDAY'],
|
||||
['09:30']
|
||||
);
|
||||
// $retVal = 9
|
||||
```
|
||||
@ -1695,8 +1717,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
|
||||
|
||||
``` php
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MINUTE'),
|
||||
array('09:30')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MINUTE'],
|
||||
['09:30']
|
||||
);
|
||||
// $retVal = 30
|
||||
```
|
||||
@ -1748,8 +1770,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
|
||||
|
||||
``` php
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MONTHOFYEAR'),
|
||||
array('14-July-2008')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MONTHOFYEAR'],
|
||||
['14-July-2008']
|
||||
);
|
||||
// $retVal = 7
|
||||
```
|
||||
@ -1893,8 +1915,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
|
||||
|
||||
``` php
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'SECOND'),
|
||||
array('09:30:17')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'SECOND'],
|
||||
['09:30:17']
|
||||
);
|
||||
// $retVal = 17
|
||||
```
|
||||
@ -1977,8 +1999,8 @@ $retVal = $worksheet->getCell('B4')->getCalculatedValue();
|
||||
|
||||
``` php
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'WEEKDAY'),
|
||||
array('14-July-2008')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'WEEKDAY'],
|
||||
['14-July-2008']
|
||||
);
|
||||
// $retVal = 7
|
||||
```
|
||||
@ -2037,8 +2059,8 @@ $retVal = $worksheet->getCell('B3')->getCalculatedValue();
|
||||
|
||||
``` php
|
||||
$retVal = call_user_func_array(
|
||||
array('\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'YEAR'),
|
||||
array('14-July-2001')
|
||||
['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'YEAR'],
|
||||
['14-July-2001']
|
||||
);
|
||||
// $retVal = 2001
|
||||
```
|
||||
|
@ -425,3 +425,9 @@ All the following methods are affected:
|
||||
- `PHPExcel_Worksheet::unprotectCellsByColumnAndRow()`
|
||||
- `PHPExcel_Worksheet_PageSetup::addPrintAreaByColumnAndRow()`
|
||||
- `PHPExcel_Worksheet_PageSetup::setPrintAreaByColumnAndRow()`
|
||||
|
||||
### Removed default values
|
||||
|
||||
Default values for many methods were removed when it did not make sense. Typically,
|
||||
setter methods should not have default values. For a complete list of methods and
|
||||
their original default values, see [that commit](https://github.com/PHPOffice/PhpSpreadsheet/commit/033a4bdad56340795a5bf7ec3c8a2fde005cda24).
|
||||
|
@ -107,7 +107,7 @@ reader to only load the sheets with a given name:
|
||||
|
||||
``` php
|
||||
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
|
||||
$reader->setLoadSheetsOnly( array("Sheet 1", "My special sheet") );
|
||||
$reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]);
|
||||
$spreadsheet = $reader->load("05featuredemo.xlsx");
|
||||
```
|
||||
|
||||
@ -225,7 +225,7 @@ reader to only load the sheets with a given name:
|
||||
|
||||
``` php
|
||||
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
|
||||
$reader->setLoadSheetsOnly( array("Sheet 1", "My special sheet") );
|
||||
$reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]);
|
||||
$spreadsheet = $reader->load("05featuredemo.xls");
|
||||
```
|
||||
|
||||
|
@ -198,7 +198,7 @@ of sheet names as an array parameter to the `setLoadSheetsOnly()` method.
|
||||
``` php
|
||||
$inputFileType = 'Xls';
|
||||
$inputFileName = './sampleData/example1.xls';
|
||||
$sheetnames = array('Data Sheet #1','Data Sheet #3');
|
||||
$sheetnames = ['Data Sheet #1','Data Sheet #3'];
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||
@ -292,7 +292,7 @@ class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
|
||||
{
|
||||
private $startRow = 0;
|
||||
private $endRow = 0;
|
||||
private $columns = array();
|
||||
private $columns = [];
|
||||
|
||||
/** Get the list of rows and columns to read */
|
||||
public function __construct($startRow, $endRow, $columns) {
|
||||
@ -395,10 +395,11 @@ the file into that worksheet.
|
||||
|
||||
``` php
|
||||
$inputFileType = 'Csv';
|
||||
$inputFileNames = array('./sampleData/example1.csv',
|
||||
$inputFileNames = [
|
||||
'./sampleData/example1.csv',
|
||||
'./sampleData/example2.csv'
|
||||
'./sampleData/example3.csv'
|
||||
);
|
||||
];
|
||||
|
||||
/** Create a new Reader of the type defined in $inputFileType **/
|
||||
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
|
||||
|
@ -187,7 +187,7 @@ internal English coding.
|
||||
|
||||
``` php
|
||||
$formula = $spreadsheet->getActiveSheet()->getCell('B8')->getValue();
|
||||
$translatedFormula = \PhpOffice\PhpSpreadsheet\Calculation::getInstance()->_translateFormulaToLocale($formula);
|
||||
$translatedFormula = \PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->_translateFormulaToLocale($formula);
|
||||
```
|
||||
|
||||
You can also create a formula using the function names and argument
|
||||
@ -196,7 +196,7 @@ English before setting the cell value:
|
||||
|
||||
``` php
|
||||
$formula = '=ДНЕЙ360(ДАТА(2010;2;5);ДАТА(2010;12;31);ИСТИНА)';
|
||||
$internalFormula = \PhpOffice\PhpSpreadsheet\Calculation::getInstance()->translateFormulaToEnglish($formula);
|
||||
$internalFormula = \PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->translateFormulaToEnglish($formula);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('B8',$internalFormula);
|
||||
```
|
||||
|
||||
@ -461,13 +461,13 @@ To set a print break, use the following code, which sets a row break on
|
||||
row 10.
|
||||
|
||||
``` php
|
||||
$spreadsheet->getActiveSheet()->setBreak( 'A10' , \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_ROW );
|
||||
$spreadsheet->getActiveSheet()->setBreak('A10', \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_ROW);
|
||||
```
|
||||
|
||||
The following line of code sets a print break on column D:
|
||||
|
||||
``` php
|
||||
$spreadsheet->getActiveSheet()->setBreak( 'D10' , \PhpOffice\PhpSpreadsheet\Worksheet::BREAK_COLUMN );
|
||||
$spreadsheet->getActiveSheet()->setBreak('D10', \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_COLUMN);
|
||||
```
|
||||
|
||||
### Show/hide gridlines when printing
|
||||
@ -549,29 +549,29 @@ sets a cell's style to font bold, alignment right, top border thin and a
|
||||
gradient fill:
|
||||
|
||||
``` php
|
||||
$styleArray = array(
|
||||
'font' => array(
|
||||
$styleArray = [
|
||||
'font' => [
|
||||
'bold' => true,
|
||||
),
|
||||
'alignment' => array(
|
||||
],
|
||||
'alignment' => [
|
||||
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT,
|
||||
),
|
||||
'borders' => array(
|
||||
'top' => array(
|
||||
],
|
||||
'borders' => [
|
||||
'top' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||
),
|
||||
),
|
||||
'fill' => array(
|
||||
],
|
||||
],
|
||||
'fill' => [
|
||||
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR,
|
||||
'rotation' => 90,
|
||||
'startColor' => array(
|
||||
'startColor' => [
|
||||
'argb' => 'FFA0A0A0',
|
||||
),
|
||||
'endColor' => array(
|
||||
],
|
||||
'endColor' => [
|
||||
'argb' => 'FFFFFFFF',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray($styleArray);
|
||||
```
|
||||
@ -690,14 +690,14 @@ selection. Here is how to apply a thick red border outline around cells
|
||||
B2:G8.
|
||||
|
||||
``` php
|
||||
$styleArray = array(
|
||||
'borders' => array(
|
||||
'outline' => array(
|
||||
$styleArray = [
|
||||
'borders' => [
|
||||
'outline' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
|
||||
'color' => array('argb' => 'FFFF0000'),
|
||||
),
|
||||
),
|
||||
);
|
||||
'color' => ['argb' => 'FFFF0000'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$worksheet->getStyle('B2:G8')->applyFromArray($styleArray);
|
||||
```
|
||||
@ -1297,14 +1297,14 @@ foreach ($spreadsheet->getActiveSheet()->getDrawingCollection() as $drawing) {
|
||||
## Add rich text to a cell
|
||||
|
||||
Adding rich text to a cell can be done using
|
||||
`\PhpOffice\PhpSpreadsheet\RichText` instances. Here''s an example, which
|
||||
`\PhpOffice\PhpSpreadsheet\RichText\RichText` instances. Here''s an example, which
|
||||
creates the following rich text string:
|
||||
|
||||
> This invoice is ***payable within thirty days after the end of the
|
||||
> month*** unless specified otherwise on the invoice.
|
||||
|
||||
``` php
|
||||
$richText = new \PhpOffice\PhpSpreadsheet\RichText();
|
||||
$richText = new \PhpOffice\PhpSpreadsheet\RichText\RichText();
|
||||
$richText->createText('This invoice is ');
|
||||
$payable = $richText->createTextRun('payable within thirty days after the end of the month');
|
||||
$payable->getFont()->setBold(true);
|
||||
@ -1480,15 +1480,15 @@ Set a worksheet to be **hidden** using this code:
|
||||
|
||||
``` php
|
||||
$spreadsheet->getActiveSheet()
|
||||
->setSheetState(\PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_HIDDEN);
|
||||
->setSheetState(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN);
|
||||
```
|
||||
|
||||
Sometimes you may even want the worksheet to be **"very hidden"**. The
|
||||
available sheet states are :
|
||||
|
||||
- `\PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_VISIBLE`
|
||||
- `\PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_HIDDEN`
|
||||
- `\PhpOffice\PhpSpreadsheet\Worksheet::SHEETSTATE_VERYHIDDEN`
|
||||
- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VISIBLE`
|
||||
- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN`
|
||||
- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN`
|
||||
|
||||
In Excel the sheet state "very hidden" can only be set programmatically,
|
||||
e.g. with Visual Basic Macro. It is not possible to make such a sheet
|
||||
|
@ -80,7 +80,7 @@ whatever you choose) and then insert it into your workbook using the
|
||||
|
||||
``` php
|
||||
// Create a new worksheet called "My Data"
|
||||
$myWorkSheet = new \PhpOffice\PhpSpreadsheet\Worksheet($spreadsheet, 'My Data');
|
||||
$myWorkSheet = new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet($spreadsheet, 'My Data');
|
||||
|
||||
// Attach the "My Data" worksheet as the first worksheet in the Spreadsheet object
|
||||
$spreadsheet->addSheet($myWorkSheet, 0);
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -23,7 +23,7 @@ class Calculation
|
||||
// Opening bracket
|
||||
const CALCULATION_REGEXP_OPENBRACE = '\(';
|
||||
// Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it)
|
||||
const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\(';
|
||||
const CALCULATION_REGEXP_FUNCTION = '@?(?:_xlfn\.)?([A-Z][A-Z0-9\.]*)[\s]*\(';
|
||||
// Cell reference (cell or range of cells, with or without a sheet reference)
|
||||
const CALCULATION_REGEXP_CELLREF = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})';
|
||||
// Named Range of cells
|
||||
@ -1082,6 +1082,13 @@ class Calculation
|
||||
'functionCall' => [Functions::class, 'isEven'],
|
||||
'argumentCount' => '1',
|
||||
],
|
||||
'ISFORMULA' => [
|
||||
'category' => Category::CATEGORY_INFORMATION,
|
||||
'functionCall' => [Functions::class, 'isFormula'],
|
||||
'argumentCount' => '1',
|
||||
'passCellReference' => true,
|
||||
'passByReference' => [true],
|
||||
],
|
||||
'ISLOGICAL' => [
|
||||
'category' => Category::CATEGORY_INFORMATION,
|
||||
'functionCall' => [Functions::class, 'isLogical'],
|
||||
@ -1302,6 +1309,11 @@ class Calculation
|
||||
'functionCall' => [Statistical::class, 'MODE'],
|
||||
'argumentCount' => '1+',
|
||||
],
|
||||
'MODE.SNGL' => [
|
||||
'category' => Category::CATEGORY_STATISTICAL,
|
||||
'functionCall' => [Statistical::class, 'MODE'],
|
||||
'argumentCount' => '1+',
|
||||
],
|
||||
'MONTH' => [
|
||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||
'functionCall' => [DateTime::class, 'MONTHOFYEAR'],
|
||||
@ -1700,6 +1712,16 @@ class Calculation
|
||||
'functionCall' => [Statistical::class, 'STDEV'],
|
||||
'argumentCount' => '1+',
|
||||
],
|
||||
'STDEV.S' => [
|
||||
'category' => Category::CATEGORY_STATISTICAL,
|
||||
'functionCall' => [Statistical::class, 'STDEV'],
|
||||
'argumentCount' => '1+',
|
||||
],
|
||||
'STDEV.P' => [
|
||||
'category' => Category::CATEGORY_STATISTICAL,
|
||||
'functionCall' => [Statistical::class, 'STDEVP'],
|
||||
'argumentCount' => '1+',
|
||||
],
|
||||
'STDEVA' => [
|
||||
'category' => Category::CATEGORY_STATISTICAL,
|
||||
'functionCall' => [Statistical::class, 'STDEVA'],
|
||||
@ -3772,10 +3794,6 @@ class Calculation
|
||||
$namedRange = $matches[6];
|
||||
$this->debugLog->writeDebugLog('Evaluating Named Range ', $namedRange);
|
||||
|
||||
if (substr($namedRange, 0, 6) === '_xlfn.') {
|
||||
return $this->raiseFormulaError("undefined named range / function '$token'");
|
||||
}
|
||||
|
||||
$cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false);
|
||||
$pCell->attach($pCellParent);
|
||||
$this->debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->showTypeDetails($cellValue));
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||
|
||||
class Functions
|
||||
{
|
||||
const PRECISION = 8.88E-016;
|
||||
@ -642,4 +644,21 @@ class Functions
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* ISFORMULA.
|
||||
*
|
||||
* @param mixed $value The cell to check
|
||||
* @param Cell $pCell The current cell (containing this formula)
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function isFormula($value = '', Cell $pCell = null)
|
||||
{
|
||||
if ($pCell === null) {
|
||||
return self::REF();
|
||||
}
|
||||
|
||||
return substr($pCell->getWorksheet()->getCell($value)->getValue(), 0, 1) === '=';
|
||||
}
|
||||
}
|
||||
|
@ -1611,14 +1611,10 @@ class Statistical
|
||||
*
|
||||
* Returns values along a predicted emponential Trend
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param array of mixed Values of X for which we want to find Y
|
||||
* @param bool a logical value specifying whether to force the intersect to equal 0
|
||||
* @param mixed $yValues
|
||||
* @param mixed $xValues
|
||||
* @param mixed $newValues
|
||||
* @param mixed $const
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param mixed[] $xValues Data Series X
|
||||
* @param mixed[] $newValues Values of X for which we want to find Y
|
||||
* @param bool $const a logical value specifying whether to force the intersect to equal 0
|
||||
*
|
||||
* @return array of float
|
||||
*/
|
||||
@ -1735,10 +1731,8 @@ class Statistical
|
||||
*
|
||||
* Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values.
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param mixed $yValues
|
||||
* @param mixed $xValues
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param mixed[] $xValues Data Series X
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
@ -1853,14 +1847,10 @@ class Statistical
|
||||
* Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data,
|
||||
* and then returns an array that describes the line.
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param bool a logical value specifying whether to force the intersect to equal 0
|
||||
* @param bool a logical value specifying whether to return additional regression statistics
|
||||
* @param mixed $yValues
|
||||
* @param null|mixed $xValues
|
||||
* @param mixed $const
|
||||
* @param mixed $stats
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param null|mixed[] $xValues Data Series X
|
||||
* @param bool $const a logical value specifying whether to force the intersect to equal 0
|
||||
* @param bool $stats a logical value specifying whether to return additional regression statistics
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -1916,14 +1906,10 @@ class Statistical
|
||||
* Calculates an exponential curve that best fits the X and Y data series,
|
||||
* and then returns an array that describes the line.
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param bool a logical value specifying whether to force the intersect to equal 0
|
||||
* @param bool a logical value specifying whether to return additional regression statistics
|
||||
* @param mixed $yValues
|
||||
* @param null|mixed $xValues
|
||||
* @param mixed $const
|
||||
* @param mixed $stats
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param null|mixed[] $xValues Data Series X
|
||||
* @param bool $const a logical value specifying whether to force the intersect to equal 0
|
||||
* @param bool $stats a logical value specifying whether to return additional regression statistics
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -2592,12 +2578,9 @@ class Statistical
|
||||
*
|
||||
* Returns the rank of a value in a data set as a percentage of the data set.
|
||||
*
|
||||
* @param array of number An array of, or a reference to, a list of numbers
|
||||
* @param number the number whose rank you want to find
|
||||
* @param number the number of significant digits for the returned percentage value
|
||||
* @param mixed $valueSet
|
||||
* @param mixed $value
|
||||
* @param mixed $significance
|
||||
* @param float[] $valueSet An array of, or a reference to, a list of numbers
|
||||
* @param int $value the number whose rank you want to find
|
||||
* @param int $significance the number of significant digits for the returned percentage value
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
@ -2747,12 +2730,9 @@ class Statistical
|
||||
*
|
||||
* Returns the rank of a number in a list of numbers.
|
||||
*
|
||||
* @param number the number whose rank you want to find
|
||||
* @param array of number An array of, or a reference to, a list of numbers
|
||||
* @param mixed Order to sort the values in the value set
|
||||
* @param mixed $value
|
||||
* @param mixed $valueSet
|
||||
* @param mixed $order
|
||||
* @param int $value the number whose rank you want to find
|
||||
* @param float[] $valueSet An array of, or a reference to, a list of numbers
|
||||
* @param int $order Order to sort the values in the value set
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
@ -2786,10 +2766,8 @@ class Statistical
|
||||
*
|
||||
* Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's.
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param mixed $yValues
|
||||
* @param mixed $xValues
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param mixed[] $xValues Data Series X
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
@ -2856,10 +2834,8 @@ class Statistical
|
||||
*
|
||||
* Returns the slope of the linear regression line through data points in known_y's and known_x's.
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param mixed $yValues
|
||||
* @param mixed $xValues
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param mixed[] $xValues Data Series X
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
@ -3160,10 +3136,8 @@ class Statistical
|
||||
*
|
||||
* Returns the standard error of the predicted y-value for each x in the regression.
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param mixed $yValues
|
||||
* @param mixed $xValues
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param mixed[] $xValues Data Series X
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
@ -3314,14 +3288,10 @@ class Statistical
|
||||
*
|
||||
* Returns values along a linear Trend
|
||||
*
|
||||
* @param array of mixed Data Series Y
|
||||
* @param array of mixed Data Series X
|
||||
* @param array of mixed Values of X for which we want to find Y
|
||||
* @param bool a logical value specifying whether to force the intersect to equal 0
|
||||
* @param mixed $yValues
|
||||
* @param mixed $xValues
|
||||
* @param mixed $newValues
|
||||
* @param mixed $const
|
||||
* @param mixed[] $yValues Data Series Y
|
||||
* @param mixed[] $xValues Data Series X
|
||||
* @param mixed[] $newValues Values of X for which we want to find Y
|
||||
* @param bool $const a logical value specifying whether to force the intersect to equal 0
|
||||
*
|
||||
* @return array of float
|
||||
*/
|
||||
|
@ -308,7 +308,7 @@ class Cell
|
||||
* Get old calculated value (cached)
|
||||
* This returns the value last calculated by MS Excel or whichever spreadsheet program was used to
|
||||
* create the original spreadsheet file.
|
||||
* Note that this value is not guaranteed to refelect the actual calculated value because it is
|
||||
* Note that this value is not guaranteed to reflect the actual calculated value because it is
|
||||
* possible that auto-calculation was disabled in the original spreadsheet, and underlying data
|
||||
* values used by the formula have changed since it was last calculated.
|
||||
*
|
||||
|
@ -127,9 +127,9 @@ abstract class Coordinate
|
||||
*
|
||||
* @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4'
|
||||
*
|
||||
* @return array Array containg one or more arrays containing one or two coordinate strings
|
||||
* e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11'))
|
||||
* or array('B4')
|
||||
* @return array Array containing one or more arrays containing one or two coordinate strings
|
||||
* e.g. ['B4','D9'] or [['B4','D9'], ['H2','O11']]
|
||||
* or ['B4']
|
||||
*/
|
||||
public static function splitRange($pRange)
|
||||
{
|
||||
@ -179,7 +179,7 @@ abstract class Coordinate
|
||||
*
|
||||
* @param string $pRange Cell range (e.g. A1:A1)
|
||||
*
|
||||
* @return array Range coordinates array(Start Cell, End Cell)
|
||||
* @return array Range coordinates [Start Cell, End Cell]
|
||||
* where Start Cell and End Cell are arrays (Column Number, Row Number)
|
||||
*/
|
||||
public static function rangeBoundaries($pRange)
|
||||
@ -230,8 +230,8 @@ abstract class Coordinate
|
||||
*
|
||||
* @param string $pRange Cell range (e.g. A1:A1)
|
||||
*
|
||||
* @return array Range coordinates array(Start Cell, End Cell)
|
||||
* where Start Cell and End Cell are arrays (Column ID, Row Number)
|
||||
* @return array Range coordinates [Start Cell, End Cell]
|
||||
* where Start Cell and End Cell are arrays [Column ID, Row Number]
|
||||
*/
|
||||
public static function getRangeBoundaries($pRange)
|
||||
{
|
||||
|
@ -285,7 +285,7 @@ class Cells
|
||||
*/
|
||||
private function getUniqueID()
|
||||
{
|
||||
return uniqid('phpspreadsheet-', true) . '-';
|
||||
return uniqid('phpspreadsheet.', true) . '.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -476,6 +476,13 @@ class Csv extends BaseReader
|
||||
|
||||
fclose($this->fileHandle);
|
||||
|
||||
return true;
|
||||
$type = mime_content_type($pFilename);
|
||||
$supportedTypes = [
|
||||
'text/csv',
|
||||
'text/plain',
|
||||
'inode/x-empty',
|
||||
];
|
||||
|
||||
return in_array($type, $supportedTypes, true);
|
||||
}
|
||||
}
|
||||
|
@ -612,9 +612,9 @@ class Html extends BaseReader
|
||||
* - Implement to other propertie, such as border
|
||||
*
|
||||
* @param Worksheet $sheet
|
||||
* @param array $attributeArray
|
||||
* @param int $row
|
||||
* @param string $column
|
||||
* @param array $attributeArray
|
||||
*/
|
||||
private function applyInlineStyle(&$sheet, $row, $column, $attributeArray)
|
||||
{
|
||||
|
@ -7522,7 +7522,7 @@ class Xls extends BaseReader
|
||||
|
||||
/**
|
||||
* read BIFF8 constant value array from array data
|
||||
* returns e.g. array('value' => '{1,2;3,4}', 'size' => 40}
|
||||
* returns e.g. ['value' => '{1,2;3,4}', 'size' => 40]
|
||||
* section 2.5.8.
|
||||
*
|
||||
* @param string $arrayData
|
||||
@ -7562,7 +7562,7 @@ class Xls extends BaseReader
|
||||
/**
|
||||
* read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value'
|
||||
* section 2.5.7
|
||||
* returns e.g. array('value' => '5', 'size' => 9).
|
||||
* returns e.g. ['value' => '5', 'size' => 9].
|
||||
*
|
||||
* @param string $valueData
|
||||
*
|
||||
|
@ -13,7 +13,7 @@ class Color
|
||||
* @param array $palette Color palette
|
||||
* @param int $version
|
||||
*
|
||||
* @return array RGB color value, example: array('rgb' => 'FF0000')
|
||||
* @return array RGB color value, example: ['rgb' => 'FF0000']
|
||||
*/
|
||||
public static function map($color, $palette, $version)
|
||||
{
|
||||
|
@ -702,10 +702,24 @@ class Xlsx extends BaseReader
|
||||
|
||||
if (isset($xmlSheet->sheetViews, $xmlSheet->sheetViews->sheetView)) {
|
||||
if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
|
||||
$docSheet->getSheetView()->setZoomScale((int) ($xmlSheet->sheetViews->sheetView['zoomScale']));
|
||||
$zoomScale = (int) ($xmlSheet->sheetViews->sheetView['zoomScale']);
|
||||
if ($zoomScale <= 0) {
|
||||
// setZoomScale will throw an Exception if the scale is less than or equals 0
|
||||
// that is OK when manually creating documents, but we should be able to read all documents
|
||||
$zoomScale = 100;
|
||||
}
|
||||
|
||||
$docSheet->getSheetView()->setZoomScale($zoomScale);
|
||||
}
|
||||
if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) {
|
||||
$docSheet->getSheetView()->setZoomScaleNormal((int) ($xmlSheet->sheetViews->sheetView['zoomScaleNormal']));
|
||||
$zoomScaleNormal = (int) ($xmlSheet->sheetViews->sheetView['zoomScaleNormal']);
|
||||
if ($zoomScaleNormal <= 0) {
|
||||
// setZoomScaleNormal will throw an Exception if the scale is less than or equals 0
|
||||
// that is OK when manually creating documents, but we should be able to read all documents
|
||||
$zoomScaleNormal = 100;
|
||||
}
|
||||
|
||||
$docSheet->getSheetView()->setZoomScaleNormal($zoomScaleNormal);
|
||||
}
|
||||
if (isset($xmlSheet->sheetViews->sheetView['view'])) {
|
||||
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
|
||||
@ -1686,7 +1700,7 @@ class Xlsx extends BaseReader
|
||||
}
|
||||
|
||||
// Some definedNames are only applicable if we are on the same sheet...
|
||||
if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $sheetId) {
|
||||
if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $oldSheetId) {
|
||||
// Switch on type
|
||||
switch ((string) $definedName['name']) {
|
||||
case '_xlnm._FilterDatabase':
|
||||
@ -2055,7 +2069,7 @@ class Xlsx extends BaseReader
|
||||
if (is_object($is->r)) {
|
||||
foreach ($is->r as $run) {
|
||||
if (!isset($run->rPr)) {
|
||||
$objText = $value->createText(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
|
||||
$value->createText(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
|
||||
} else {
|
||||
$objText = $value->createTextRun(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
|
||||
|
||||
@ -2063,7 +2077,7 @@ class Xlsx extends BaseReader
|
||||
$objText->getFont()->setName((string) $run->rPr->rFont['val']);
|
||||
}
|
||||
if (isset($run->rPr->sz['val'])) {
|
||||
$objText->getFont()->setSize((string) $run->rPr->sz['val']);
|
||||
$objText->getFont()->setSize((float) $run->rPr->sz['val']);
|
||||
}
|
||||
if (isset($run->rPr->color)) {
|
||||
$objText->getFont()->setColor(new Color(self::readColor($run->rPr->color)));
|
||||
@ -2125,7 +2139,7 @@ class Xlsx extends BaseReader
|
||||
'SimpleXMLElement',
|
||||
Settings::getLibXmlLoaderOptions()
|
||||
);
|
||||
if ($UIRels) {
|
||||
if (false !== $UIRels) {
|
||||
// we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image
|
||||
foreach ($UIRels->Relationship as $ele) {
|
||||
if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') {
|
||||
@ -2141,11 +2155,11 @@ class Xlsx extends BaseReader
|
||||
if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) {
|
||||
$excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries);
|
||||
} else {
|
||||
$excel->setRibbonBinObjects(null);
|
||||
$excel->setRibbonBinObjects(null, null);
|
||||
}
|
||||
} else {
|
||||
$excel->setRibbonXMLData(null);
|
||||
$excel->setRibbonBinObjects(null);
|
||||
$excel->setRibbonXMLData(null, null);
|
||||
$excel->setRibbonBinObjects(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ class Date
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips an ordinal froma numeric value.
|
||||
* Strips an ordinal from a numeric value.
|
||||
*
|
||||
* @param string $day Day number with an ordinal
|
||||
*
|
||||
|
@ -164,7 +164,7 @@ class DggContainer
|
||||
}
|
||||
|
||||
/**
|
||||
* Set identifier clusters. array(<drawingId> => <max shape id>, ...).
|
||||
* Set identifier clusters. [<drawingId> => <max shape id>, ...].
|
||||
*
|
||||
* @param array $pValue
|
||||
*/
|
||||
|
@ -124,16 +124,17 @@ class Alignment extends Supervisor
|
||||
|
||||
/**
|
||||
* Apply styles from array.
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray(
|
||||
* array(
|
||||
* 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||
* 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||
* 'textRotation' => 0,
|
||||
* 'wrapText' => TRUE
|
||||
* )
|
||||
* [
|
||||
* 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||
* 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||
* 'textRotation' => 0,
|
||||
* 'wrapText' => TRUE
|
||||
* ]
|
||||
* );
|
||||
* </code>.
|
||||
* </code>
|
||||
*
|
||||
* @param array $pStyles Array containing style information
|
||||
*
|
||||
|
@ -114,12 +114,12 @@ class Border extends Supervisor
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray(
|
||||
* array(
|
||||
* [
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => array(
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* )
|
||||
* ]
|
||||
* ]
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
|
@ -160,36 +160,38 @@ class Borders extends Supervisor
|
||||
|
||||
/**
|
||||
* Apply styles from array.
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
|
||||
* array(
|
||||
* 'bottom' => array(
|
||||
* [
|
||||
* 'bottom' => [
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => array(
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* ),
|
||||
* 'top' => array(
|
||||
* ]
|
||||
* ],
|
||||
* 'top' => [
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => array(
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ]
|
||||
* ]
|
||||
* ]
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
|
||||
* array(
|
||||
* 'allBorders' => array(
|
||||
* [
|
||||
* 'allBorders' => [
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => array(
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ]
|
||||
* ]
|
||||
* ]
|
||||
* );
|
||||
* </code>.
|
||||
* </code>
|
||||
*
|
||||
* @param array $pStyles Array containing style information
|
||||
*
|
||||
|
@ -86,9 +86,10 @@ class Color extends Supervisor
|
||||
|
||||
/**
|
||||
* Apply styles from array.
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') );
|
||||
* </code>.
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray(['rgb' => '808080']);
|
||||
* </code>
|
||||
*
|
||||
* @param array $pStyles Array containing style information
|
||||
*
|
||||
|
@ -121,20 +121,21 @@ class Fill extends Supervisor
|
||||
|
||||
/**
|
||||
* Apply styles from array.
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
|
||||
* array(
|
||||
* 'fillType' => Fill::FILL_GRADIENT_LINEAR,
|
||||
* 'rotation' => 0,
|
||||
* 'startColor' => array(
|
||||
* 'rgb' => '000000'
|
||||
* ),
|
||||
* 'endColor' => array(
|
||||
* 'argb' => 'FFFFFFFF'
|
||||
* )
|
||||
* )
|
||||
* [
|
||||
* 'fillType' => Fill::FILL_GRADIENT_LINEAR,
|
||||
* 'rotation' => 0,
|
||||
* 'startColor' => [
|
||||
* 'rgb' => '000000'
|
||||
* ],
|
||||
* 'endColor' => [
|
||||
* 'argb' => 'FFFFFFFF'
|
||||
* ]
|
||||
* ]
|
||||
* );
|
||||
* </code>.
|
||||
* </code>
|
||||
*
|
||||
* @param array $pStyles Array containing style information
|
||||
*
|
||||
|
@ -141,20 +141,21 @@ class Font extends Supervisor
|
||||
|
||||
/**
|
||||
* Apply styles from array.
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
|
||||
* array(
|
||||
* 'name' => 'Arial',
|
||||
* 'bold' => TRUE,
|
||||
* 'italic' => FALSE,
|
||||
* 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
|
||||
* 'strikethrough' => FALSE,
|
||||
* 'color' => array(
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* )
|
||||
* [
|
||||
* 'name' => 'Arial',
|
||||
* 'bold' => TRUE,
|
||||
* 'italic' => FALSE,
|
||||
* 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
|
||||
* 'strikethrough' => FALSE,
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* ]
|
||||
* ]
|
||||
* );
|
||||
* </code>.
|
||||
* </code>
|
||||
*
|
||||
* @param array $pStyles Array containing style information
|
||||
*
|
||||
@ -483,8 +484,9 @@ class Font extends Supervisor
|
||||
if ($pValue == '') {
|
||||
$pValue = false;
|
||||
}
|
||||
|
||||
if ($this->isSupervisor) {
|
||||
$styleArray = $this->getStyleArray(['strike' => $pValue]);
|
||||
$styleArray = $this->getStyleArray(['strikethrough' => $pValue]);
|
||||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||
} else {
|
||||
$this->strikethrough = $pValue;
|
||||
|
@ -47,7 +47,8 @@ class NumberFormat extends Supervisor
|
||||
|
||||
const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-';
|
||||
const FORMAT_CURRENCY_USD = '$#,##0_-';
|
||||
const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-';
|
||||
const FORMAT_CURRENCY_EUR_SIMPLE = '#,##0.00_-"€"';
|
||||
const FORMAT_CURRENCY_EUR = '#,##0_-"€"';
|
||||
|
||||
/**
|
||||
* Excel built-in number formats.
|
||||
@ -123,13 +124,14 @@ class NumberFormat extends Supervisor
|
||||
|
||||
/**
|
||||
* Apply styles from array.
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray(
|
||||
* array(
|
||||
* 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
|
||||
* )
|
||||
* [
|
||||
* 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
|
||||
* ]
|
||||
* );
|
||||
* </code>.
|
||||
* </code>
|
||||
*
|
||||
* @param array $pStyles Array containing style information
|
||||
*
|
||||
|
@ -72,14 +72,15 @@ class Protection extends Supervisor
|
||||
|
||||
/**
|
||||
* Apply styles from array.
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray(
|
||||
* array(
|
||||
* 'locked' => TRUE,
|
||||
* 'hidden' => FALSE
|
||||
* )
|
||||
* [
|
||||
* 'locked' => TRUE,
|
||||
* 'hidden' => FALSE
|
||||
* ]
|
||||
* );
|
||||
* </code>.
|
||||
* </code>
|
||||
*
|
||||
* @param array $pStyles Array containing style information
|
||||
*
|
||||
|
@ -151,33 +151,33 @@ class Style extends Supervisor
|
||||
*
|
||||
* <code>
|
||||
* $spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray(
|
||||
* array(
|
||||
* 'font' => array(
|
||||
* 'name' => 'Arial',
|
||||
* 'bold' => true,
|
||||
* 'italic' => false,
|
||||
* 'underline' => Font::UNDERLINE_DOUBLE,
|
||||
* 'strikethrough' => false,
|
||||
* 'color' => array(
|
||||
* [
|
||||
* 'font' => [
|
||||
* 'name' => 'Arial',
|
||||
* 'bold' => true,
|
||||
* 'italic' => false,
|
||||
* 'underline' => Font::UNDERLINE_DOUBLE,
|
||||
* 'strikethrough' => false,
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* ]
|
||||
* ],
|
||||
* 'borders' => [
|
||||
* 'bottom' => [
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* ),
|
||||
* 'borders' => array(
|
||||
* 'bottom' => array(
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => array(
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* ),
|
||||
* 'top' => array(
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => array(
|
||||
* 'rgb' => '808080'
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
* 'quotePrefix' => true
|
||||
* )
|
||||
* ]
|
||||
* ],
|
||||
* 'top' => [
|
||||
* 'borderStyle' => Border::BORDER_DASHDOT,
|
||||
* 'color' => [
|
||||
* 'rgb' => '808080'
|
||||
* ]
|
||||
* ]
|
||||
* ],
|
||||
* 'quotePrefix' => true
|
||||
* ]
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
|
@ -365,12 +365,13 @@ class BaseDrawing implements IComparable
|
||||
}
|
||||
|
||||
/**
|
||||
* Set width and height with proportional resize
|
||||
* Set width and height with proportional resize.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* $objDrawing->setResizeProportional(true);
|
||||
* $objDrawing->setWidthAndHeight(160,120);
|
||||
* </code>.
|
||||
* </code>
|
||||
*
|
||||
* @author Vincent@luo MSN:kele_100@hotmail.com
|
||||
*
|
||||
|
@ -1971,7 +1971,7 @@ class Worksheet implements IComparable
|
||||
*
|
||||
* - A2 will freeze the rows above cell A2 (i.e row 1)
|
||||
* - B1 will freeze the columns to the left of cell B1 (i.e column A)
|
||||
* - B2 will freeze the rows above and to the left of cell A2 (i.e row 1 and column A)
|
||||
* - B2 will freeze the rows above and to the left of cell B2 (i.e row 1 and column A)
|
||||
*
|
||||
* @param null|string $cell Position of the split
|
||||
* @param null|string $topLeftCell default position of the right bottom pane
|
||||
@ -1988,7 +1988,7 @@ class Worksheet implements IComparable
|
||||
|
||||
if ($cell !== null && $topLeftCell === null) {
|
||||
$coordinate = Coordinate::coordinateFromString($cell);
|
||||
$topLeftCell = $coordinate[0] . ($coordinate[1] + 1);
|
||||
$topLeftCell = $coordinate[0] . $coordinate[1];
|
||||
}
|
||||
|
||||
$this->freezePane = $cell;
|
||||
@ -2712,7 +2712,7 @@ class Worksheet implements IComparable
|
||||
* Extract worksheet title from range.
|
||||
*
|
||||
* Example: extractSheetTitle("testSheet!A1") ==> 'A1'
|
||||
* Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1');
|
||||
* Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1'];
|
||||
*
|
||||
* @param string $pRange Range to extract title from
|
||||
* @param bool $returnRange Return range? (see example)
|
||||
|
@ -352,10 +352,10 @@ class Html extends BaseWriter
|
||||
// Construct HTML
|
||||
$properties = $this->spreadsheet->getProperties();
|
||||
$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . PHP_EOL;
|
||||
$html .= '<!-- Generated by Spreadsheet - https://github.com/PHPOffice/Spreadsheet -->' . PHP_EOL;
|
||||
$html .= '<html>' . PHP_EOL;
|
||||
$html .= ' <head>' . PHP_EOL;
|
||||
$html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL;
|
||||
$html .= ' <meta name="generator" content="PhpSpreadsheet, https://github.com/PHPOffice/PhpSpreadsheet">' . PHP_EOL;
|
||||
if ($properties->getTitle() > '') {
|
||||
$html .= ' <title>' . htmlspecialchars($properties->getTitle()) . '</title>' . PHP_EOL;
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ class Parser
|
||||
private function convertString($string)
|
||||
{
|
||||
// chop away beggining and ending quotes
|
||||
$string = substr($string, 1, -2);
|
||||
$string = substr($string, 1, -1);
|
||||
if (strlen($string) > 255) {
|
||||
throw new WriterException('String is too long');
|
||||
}
|
||||
|
@ -552,8 +552,8 @@ class Worksheet extends BIFFwriter
|
||||
$lastCell = $explodes[1];
|
||||
}
|
||||
|
||||
$firstCellCoordinates = Coordinate::coordinateFromString($firstCell); // e.g. array(0, 1)
|
||||
$lastCellCoordinates = Coordinate::coordinateFromString($lastCell); // e.g. array(1, 6)
|
||||
$firstCellCoordinates = Coordinate::coordinateFromString($firstCell); // e.g. [0, 1]
|
||||
$lastCellCoordinates = Coordinate::coordinateFromString($lastCell); // e.g. [1, 6]
|
||||
|
||||
return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, Coordinate::columnIndexFromString($firstCellCoordinates[0]) - 1, Coordinate::columnIndexFromString($lastCellCoordinates[0]) - 1);
|
||||
}
|
||||
|
@ -1054,6 +1054,8 @@ class Worksheet extends WriterPart
|
||||
$pCell->getCalculatedValue() : $cellValue;
|
||||
if (is_string($calculatedValue)) {
|
||||
$objWriter->writeAttribute('t', 'str');
|
||||
} elseif (is_bool($calculatedValue)) {
|
||||
$objWriter->writeAttribute('t', 'b');
|
||||
}
|
||||
|
||||
break;
|
||||
|
Reference in New Issue
Block a user