Merge pull request #1 from PHPOffice/master

Resync with base project
This commit is contained in:
oleibman 2020-04-27 22:04:30 -07:00 committed by GitHub
commit 1861412d60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
331 changed files with 3236 additions and 1383 deletions

View File

@ -1,24 +0,0 @@
<?php
use Sami\RemoteRepository\GitHubRemoteRepository;
use Sami\Sami;
use Sami\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;
$iterator = Finder::create()
->files()
->name('*.php')
->in($dir = __DIR__ . '/src');
$versions = GitVersionCollection::create($dir)
->addFromTags(function ($version) {
return preg_match('~^\d+\.\d+\.\d+$~', $version);
})
->add('master');
return new Sami($iterator, [
'title' => 'PhpSpreadsheet',
'versions' => $versions,
'build_dir' => __DIR__ . '/build/%version%',
'cache_dir' => __DIR__ . '/cache/%version%',
'remote_repository' => new GitHubRemoteRepository('PHPOffice/PhpSpreadsheet', dirname($dir)),
]);

View File

@ -2,14 +2,12 @@ language: php
dist: bionic
php:
- 7.1
- 7.2
- 7.3
- 7.4
cache:
directories:
- cache
- vendor
- $HOME/.composer/cache
@ -25,36 +23,29 @@ jobs:
include:
- stage: Code style
php: 7.2
php: 7.4
script:
- ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run
- ./vendor/bin/phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PSR2 -n
- stage: Coverage
php: 7.2
php: 7.4
script:
- pecl install pcov
- composer require pcov/clobber --dev
- ./vendor/bin/pcov clobber
- ./vendor/bin/phpunit --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
- stage: API documentation
php: 7.2
- stage: API documentations
if: tag is present AND branch = master
php: 7.4
before_script:
- curl -O https://get.sensiolabs.org/sami.phar
- curl -O https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.0.0-rc/phpDocumentor.phar
script:
- git fetch origin master:master
- git fetch origin --tags
- php sami.phar update .sami.php
- echo '<html><head><meta http-equiv="Refresh" content="0; url=master/"></head><body><p>If you are not automatically redirected, please go to <a href="master/">the latest stable API documentation</a>.</p></body></html>' > build/index.html
- php phpDocumentor.phar --directory src/ --target docs/api
deploy:
provider: pages
skip-cleanup: true
local-dir: build
local-dir: docs/api
github-token: $GITHUB_TOKEN
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^master$

View File

@ -7,10 +7,44 @@ and this project adheres to [Semantic Versioning](https://semver.org).
## [Unreleased]
### Changed
- Drop support for PHP 7.1, according to https://phpspreadsheet.readthedocs.io/en/latest/#php-version-support
## [1.12.0] - 2020-04-27
### Added
- Improved the ARABIC function to also handle short-hand roman numerals
- Added support for the FLOOR.MATH and FLOOR.PRECISE functions [#1351](https://github.com/PHPOffice/PhpSpreadsheet/pull/1351)
### Fixed
- Fix ROUNDUP and ROUNDDOWN for floating-point rounding error [#1404](https://github.com/PHPOffice/PhpSpreadsheet/pull/1404)
- Fix ROUNDUP and ROUNDDOWN for negative number [#1417](https://github.com/PHPOffice/PhpSpreadsheet/pull/1417)
- Fix loading styles from vmlDrawings when containing whitespace [#1347](https://github.com/PHPOffice/PhpSpreadsheet/issues/1347)
- Fix incorrect behavior when removing last row [#1365](https://github.com/PHPOffice/PhpSpreadsheet/pull/1365)
- MATCH with a static array should return the position of the found value based on the values submitted [#1332](https://github.com/PHPOffice/PhpSpreadsheet/pull/1332)
- Fix Xlsx Reader's handling of undefined fill color [#1353](https://github.com/PHPOffice/PhpSpreadsheet/pull/1353)
## [1.11.0] - 2020-03-02
### Added
- Added support for the BASE function
- Added support for the ARABIC function
- Conditionals - Extend Support for (NOT)CONTAINSBLANKS [#1278](https://github.com/PHPOffice/PhpSpreadsheet/pull/1278)
### Fixed
- Handle Error in Formula Processing Better for Xls [#1267](https://github.com/PHPOffice/PhpSpreadsheet/pull/1267)
- Handle ConditionalStyle NumberFormat When Reading Xlsx File [#1296](https://github.com/PHPOffice/PhpSpreadsheet/pull/1296)
- Fix Xlsx Writer's handling of decimal commas [#1282](https://github.com/PHPOffice/PhpSpreadsheet/pull/1282)
- Fix for issue by removing test code mistakenly left in [#1328](https://github.com/PHPOffice/PhpSpreadsheet/pull/1328)
- Fix for Xls writer wrong selected cells and active sheet [#1256](https://github.com/PHPOffice/PhpSpreadsheet/pull/1256)
- Fix active cell when freeze pane is used [#1323](https://github.com/PHPOffice/PhpSpreadsheet/pull/1323)
- Fix XLSX file loading with autofilter containing '$' [#1326](https://github.com/PHPOffice/PhpSpreadsheet/pull/1326)
- PHPDoc - Use `@return $this` for fluent methods [#1362](https://github.com/PHPOffice/PhpSpreadsheet/pull/1362)
## [1.10.1] - 2019-12-02

View File

@ -12,7 +12,7 @@ PhpSpreadsheet is a library written in pure PHP and providing a set of classes t
## Documentation
Read more about it, including install instructions, in the [official documentation](https://phpspreadsheet.readthedocs.io). Or check out the [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master).
Read more about it, including install instructions, in the [official documentation](https://phpspreadsheet.readthedocs.io). Or check out the [API documentation](https://phpoffice.github.io/PhpSpreadsheet).
Please ask your support questions on [StackOverflow](https://stackoverflow.com/questions/tagged/phpspreadsheet), or have a quick chat on [Gitter](https://gitter.im/PHPOffice/PhpSpreadsheet).

24
bin/generate-document Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\DocumentGenerator;
require_once __DIR__ . '/../src/Bootstrap.php';
try {
$phpSpreadsheetFunctionsProperty = (new ReflectionClass(Calculation::class))->getProperty('phpSpreadsheetFunctions');
$phpSpreadsheetFunctionsProperty->setAccessible(true);
$phpSpreadsheetFunctions = $phpSpreadsheetFunctionsProperty->getValue();
ksort($phpSpreadsheetFunctions);
file_put_contents(__DIR__ . '/../docs/references/function-list-by-category.md',
DocumentGenerator::generateFunctionListByCategory($phpSpreadsheetFunctions)
);
file_put_contents(__DIR__ . '/../docs/references/function-list-by-name.md',
DocumentGenerator::generateFunctionListByName($phpSpreadsheetFunctions)
);
} catch (ReflectionException $e) {
fwrite(STDERR, (string)$e);
exit(1);
}

View File

@ -35,11 +35,11 @@
"php-cs-fixer fix --ansi"
],
"versions": [
"phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 7.1- -n"
"phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 7.2- -n"
]
},
"require": {
"php": "^7.1",
"php": "^7.2",
"ext-ctype": "*",
"ext-dom": "*",
"ext-gd": "*",
@ -58,12 +58,12 @@
"psr/simple-cache": "^1.0"
},
"require-dev": {
"dompdf/dompdf": "^0.8.3",
"dompdf/dompdf": "^0.8.5",
"friendsofphp/php-cs-fixer": "^2.16",
"jpgraph/jpgraph": "^4.0",
"mpdf/mpdf": "^8.0",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5",
"tecnickcom/tcpdf": "^6.3"
},

747
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -25,13 +25,14 @@ spreadsheet file formats, like Excel and LibreOffice Calc.
## Software requirements
PHP version 7.1 or newer to develop using PhpSpreadsheet. Other requirements, such as PHP extensions, are enforced by
PHP version 7.2 or newer to develop using PhpSpreadsheet. Other requirements, such as PHP extensions, are enforced by
composer. See the `require` section of [the composer.json file](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/composer.json)
for details.
### PHP version support
Support for PHP versions will only be maintained for a period of six months beyond the end-of-life of that PHP version
Support for PHP versions will only be maintained for a period of six months beyond the
[end of life of that PHP version](https://www.php.net/eol.php).
## Installation
@ -89,7 +90,7 @@ architecture](./topics/architecture.md),
[accessing cells](./topics/accessing-cells.md) and
[reading and writing to files](./topics/reading-and-writing-to-file.md).
Or browse the [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master).
Or browse the [API documentation](https://phpoffice.github.io/PhpSpreadsheet).
# Credits

View File

@ -69,12 +69,12 @@ BESSELK | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK
BESSELY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELY
BIN2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTODEC
BIN2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOHEX
BIN2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineeri
BIN2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOOCT
BITAND | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITAND
BITLSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITLSHIFT
BITOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
BITRSHIFT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITRSHIFT
BITXOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITXOR
BITXOR | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
COMPLEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::COMPLEX
CONVERT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::CONVERTUOM
DEC2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOBIN
@ -184,21 +184,21 @@ YIELDMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDMAT
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
CELL | **Not yet Implemented**
ERROR.TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ERROR_TYPE
ERROR.TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::errorType
INFO | **Not yet Implemented**
ISBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_BLANK
ISERR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERR
ISERROR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERROR
ISEVEN | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_EVEN
ISFORMULA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ISFORMULA
ISLOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_LOGICAL
ISNA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NA
ISNONTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NONTEXT
ISNUMBER | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NUMBER
ISODD | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ODD
ISBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isBlank
ISERR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isErr
ISERROR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isError
ISEVEN | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isEven
ISFORMULA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isFormula
ISLOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isLogical
ISNA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNa
ISNONTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNonText
ISNUMBER | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNumber
ISODD | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isOdd
ISREF | **Not yet Implemented**
ISTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_TEXT
N | \PhpOffice\PhpSpreadsheet\Calculation\Functions::N
ISTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isText
N | \PhpOffice\PhpSpreadsheet\Calculation\Functions::n
NA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA
TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::TYPE
@ -208,11 +208,13 @@ Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
FALSE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::FALSE
IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical::STATEMENT_IF
IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementIf
IFERROR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR
IFNA | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFNA
IFS | **Not yet Implemented**
NOT | \PhpOffice\PhpSpreadsheet\Calculation\Logical::NOT
OR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalOr
SWITCH | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementSwitch
TRUE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::TRUE
XOR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor
@ -220,7 +222,7 @@ XOR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CELL_ADDRESS
ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::cellAddress
AREAS | **Not yet Implemented**
CHOOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CHOOSE
COLUMN | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMN
@ -249,11 +251,13 @@ ACOS | acos
ACOSH | acosh
ACOT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT
ACOTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH
ARABIC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ARABIC
ASIN | asin
ASINH | asinh
ATAN | atan
ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::REVERSE_ATAN2
ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ATAN2
ATANH | atanh
BASE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::BASE
CEILING | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CEILING
COMBIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COMBIN
COS | cos
@ -272,7 +276,7 @@ GCD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::GCD
INT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::INT
LCM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LCM
LN | log
LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LOG_BASE
LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::logBase
LOG10 | log10
MDETERM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MDETERM
MINVERSE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MINVERSE
@ -389,8 +393,8 @@ SLOPE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SLOPE
SMALL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SMALL
STANDARDIZE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE
STDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEV.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEVA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA
STDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEVPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA

View File

@ -11,16 +11,17 @@ ACOS | CATEGORY_MATH_AND_TRIG | acos
ACOSH | CATEGORY_MATH_AND_TRIG | acosh
ACOT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT
ACOTH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH
ADDRESS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CELL_ADDRESS
ADDRESS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::cellAddress
AMORDEGRC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORDEGRC
AMORLINC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORLINC
AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
ARABIC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ARABIC
AREAS | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented**
ASC | CATEGORY_TEXT_AND_DATA | **Not yet Implemented**
ASIN | CATEGORY_MATH_AND_TRIG | asin
ASINH | CATEGORY_MATH_AND_TRIG | asinh
ATAN | CATEGORY_MATH_AND_TRIG | atan
ATAN2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::REVERSE_ATAN2
ATAN2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ATAN2
ATANH | CATEGORY_MATH_AND_TRIG | atanh
AVEDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVEDEV
AVERAGE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGE
@ -33,6 +34,7 @@ AVERAGEIFS | CATEGORY_STATISTICAL | **Not yet Implemented**
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
BAHTTEXT | CATEGORY_TEXT_AND_DATA | **Not yet Implemented**
BASE | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::BASE
BESSELI | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELI
BESSELJ | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELJ
BESSELK | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK
@ -47,7 +49,7 @@ BITAND | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet
BITLSHIFT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITLSHIFT
BITOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
BITRSHIFT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITRSHIFT
BITXOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITXOR
BITXOR | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BITOR
## C
@ -147,7 +149,7 @@ ERF | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet
ERF.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFPRECISE
ERFC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC
ERFC.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC
ERROR.TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ERROR_TYPE
ERROR.TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::errorType
EVEN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::EVEN
EXACT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::EXACT
EXP | CATEGORY_MATH_AND_TRIG | exp
@ -205,7 +207,7 @@ HYPGEOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
IF | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::STATEMENT_IF
IF | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementIf
IFERROR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR
IFNA | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFNA
IFS | CATEGORY_LOGICAL | **Not yet Implemented**
@ -242,20 +244,20 @@ INTERCEPT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet
INTRATE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::INTRATE
IPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IPMT
IRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IRR
ISBLANK | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_BLANK
ISERR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERR
ISERROR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERROR
ISEVEN | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_EVEN
ISFORMULA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ISFORMULA
ISLOGICAL | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_LOGICAL
ISNA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NA
ISNONTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NONTEXT
ISNUMBER | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NUMBER
ISODD | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ODD
ISBLANK | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isBlank
ISERR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isErr
ISERROR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isError
ISEVEN | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isEven
ISFORMULA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isFormula
ISLOGICAL | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isLogical
ISNA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNa
ISNONTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNonText
ISNUMBER | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isNumber
ISODD | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isOdd
ISOWEEKNUM | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM
ISPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ISPMT
ISREF | CATEGORY_INFORMATION | **Not yet Implemented**
ISTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_TEXT
ISTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::isText
## J
@ -281,7 +283,7 @@ LEN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet
LENB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH
LINEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LINEST
LN | CATEGORY_MATH_AND_TRIG | log
LOG | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LOG_BASE
LOG | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::logBase
LOG10 | CATEGORY_MATH_AND_TRIG | log10
LOGEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGEST
LOGINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV
@ -321,7 +323,7 @@ MULTINOMIAL | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
N | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::N
N | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::n
NA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA
NEGBINOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NEGBINOMDIST
NETWORKDAYS | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS
@ -428,8 +430,8 @@ SQRT | CATEGORY_MATH_AND_TRIG | sqrt
SQRTPI | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SQRTPI
STANDARDIZE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE
STDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEV.P | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEV.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV
STDEVA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA
STDEVP | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP
STDEVPA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA
@ -444,7 +446,7 @@ SUMSQ | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet
SUMX2MY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2MY2
SUMX2PY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2PY2
SUMXMY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMXMY2
SWITCH | CATEGORY_LOGICAL | **Not yet Implemented**
SWITCH | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::statementSwitch
SYD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SYD
## T
@ -514,7 +516,6 @@ XIRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet
XNPV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XNPV
XOR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor
## Y
Excel Function | Category | PhpSpreadsheet Function

View File

@ -14,7 +14,7 @@ installed with composer, it can be run like so:
``` sh
cd /project/to/migrate/src
/project/to/migrate/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel
php /project/to/migrate/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel
```
**Important** The tool will irreversibly modify your sources, be sure to

View File

@ -3,12 +3,12 @@
The following pages offer you some widely-used PhpSpreadsheet recipes.
Please note that these do NOT offer complete documentation on specific
PhpSpreadsheet API functions, but just a bump to get you started. If you
need specific API functions, please refer to the [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master).
need specific API functions, please refer to the [API documentation](https://phpoffice.github.io/PhpSpreadsheet).
For example, [setting a worksheet's page orientation and size
](#setting-a-worksheets-page-orientation-and-size) covers setting a page
orientation to A4. Other paper formats, like US Letter, are not covered
in this document, but in the PhpSpreadsheet [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master).
in this document, but in the PhpSpreadsheet [API documentation](https://phpoffice.github.io/PhpSpreadsheet).
## Setting a spreadsheet's metadata
@ -301,7 +301,7 @@ $spreadsheet->getActiveSheet()->getPageSetup()
```
Note that there are additional page settings available. Please refer to
the [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master) for all possible options.
the [API documentation](https://phpoffice.github.io/PhpSpreadsheet) for all possible options.
### Page Setup: Scaling options

View File

@ -4,7 +4,9 @@
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
bootstrap="./tests/bootstrap.php"
backupGlobals="true"
colors="true">
colors="true"
cacheResultFile="/tmp/.phpspreadsheet.phpunit.result.cache"
>
<php>
<ini name="memory_limit" value="2048M"/>
</php>

View File

@ -4,7 +4,6 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
require __DIR__ . '/../Header.php';
$spreadsheet = new Spreadsheet();
$helper->log('Create new Spreadsheet object');
$spreadsheet = new Spreadsheet();

View File

@ -3,7 +3,7 @@
require_once 'Header.php';
$requirements = [
'PHP 7.1.0' => version_compare(PHP_VERSION, '7.1.0', '>='),
'PHP 7.2.0' => version_compare(PHP_VERSION, '7.2.0', '>='),
'PHP extension XML' => extension_loaded('xml'),
'PHP extension xmlwriter' => extension_loaded('xmlwriter'),
'PHP extension mbstring' => extension_loaded('mbstring'),

View File

@ -263,6 +263,11 @@ class Calculation
'functionCall' => [Logical::class, 'logicalAnd'],
'argumentCount' => '1+',
],
'ARABIC' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'ARABIC'],
'argumentCount' => '1',
],
'AREAS' => [
'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE,
'functionCall' => [Functions::class, 'DUMMY'],
@ -328,6 +333,11 @@ class Calculation
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '1',
],
'BASE' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'BASE'],
'argumentCount' => '2,3',
],
'BESSELI' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'BESSELI'],
@ -904,6 +914,16 @@ class Calculation
'functionCall' => [MathTrig::class, 'FLOOR'],
'argumentCount' => '2',
],
'FLOOR.MATH' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'FLOORMATH'],
'argumentCount' => '3',
],
'FLOOR.PRECISE' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'FLOORPRECISE'],
'argumentCount' => '2',
],
'FORECAST' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'FORECAST'],
@ -1032,6 +1052,11 @@ class Calculation
'functionCall' => [Logical::class, 'IFNA'],
'argumentCount' => '2',
],
'IFS' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2+',
],
'IMABS' => [
'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMABS'],
@ -1488,7 +1513,12 @@ class Calculation
'NETWORKDAYS' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'NETWORKDAYS'],
'argumentCount' => '2+',
'argumentCount' => '2-3',
],
'NETWORKDAYS.INTL' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2-4',
],
'NOMINAL' => [
'category' => Category::CATEGORY_FINANCIAL,
@ -2157,7 +2187,12 @@ class Calculation
'WORKDAY' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'WORKDAY'],
'argumentCount' => '2+',
'argumentCount' => '2-3',
],
'WORKDAY.INTL' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2-4',
],
'XIRR' => [
'category' => Category::CATEGORY_FINANCIAL,
@ -2210,7 +2245,7 @@ class Calculation
private static $controlFunctions = [
'MKMATRIX' => [
'argumentCount' => '*',
'functionCall' => 'self::mkMatrix',
'functionCall' => [__CLASS__, 'mkMatrix'],
],
];
@ -3712,7 +3747,7 @@ class Calculation
} elseif (isset(self::$operators[$opCharacter]) && !$expectingOperator) {
return $this->raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
} else { // I don't even want to know what you did to get here
return $this->raiseFormulaError('Formula Error: An unexpected error occured');
return $this->raiseFormulaError('Formula Error: An unexpected error occurred');
}
// Test for end of formula string
if ($index == strlen($formula)) {
@ -4159,13 +4194,6 @@ class Calculation
if ($pCellParent) {
$pCell->attach($pCellParent);
}
if (($cellID == 'AC99') || (isset($pCell) && $pCell->getCoordinate() == 'AC99')) {
if (defined('RESOLVING')) {
define('RESOLVING2', true);
} else {
define('RESOLVING', true);
}
}
$functionName = $matches[1];
$argCount = $stack->pop();

View File

@ -878,6 +878,8 @@ class DateTime
*
* Excel Function:
* YEARFRAC(startDate,endDate[,method])
* See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html
* for description of algorithm used in Excel
*
* @category Date/Time Functions
*
@ -906,6 +908,11 @@ class DateTime
if (is_string($endDate = self::getDateValue($endDate))) {
return Functions::VALUE();
}
if ($startDate > $endDate) {
$temp = $startDate;
$startDate = $endDate;
$endDate = $temp;
}
if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) {
switch ($method) {
@ -916,46 +923,43 @@ class DateTime
$startYear = self::YEAR($startDate);
$endYear = self::YEAR($endDate);
$years = $endYear - $startYear + 1;
$leapDays = 0;
if ($years == 1) {
if (self::isLeapYear($endYear)) {
$startMonth = self::MONTHOFYEAR($startDate);
$endMonth = self::MONTHOFYEAR($endDate);
$endDay = self::DAYOFMONTH($endDate);
if (($startMonth < 3) ||
(($endMonth * 100 + $endDay) >= (2 * 100 + 29))) {
$leapDays += 1;
}
}
} else {
for ($year = $startYear; $year <= $endYear; ++$year) {
if ($year == $startYear) {
$startMonth = self::MONTHOFYEAR($startDate);
$startDay = self::DAYOFMONTH($startDate);
if ($startMonth < 3) {
$leapDays += (self::isLeapYear($year)) ? 1 : 0;
}
} elseif ($year == $endYear) {
$endMonth = self::MONTHOFYEAR($endDate);
$endDay = self::DAYOFMONTH($endDate);
if (($endMonth * 100 + $endDay) >= (2 * 100 + 29)) {
$leapDays += (self::isLeapYear($year)) ? 1 : 0;
$startMonthDay = 100 * $startMonth + $startDay;
$endMonthDay = 100 * $endMonth + $endDay;
if ($years == 1) {
if (self::isLeapYear($endYear)) {
$tmpCalcAnnualBasis = 366;
} else {
$tmpCalcAnnualBasis = 365;
}
} elseif ($years == 2 && $startMonthDay >= $endMonthDay) {
if (self::isLeapYear($startYear)) {
if ($startMonthDay <= 229) {
$tmpCalcAnnualBasis = 366;
} else {
$tmpCalcAnnualBasis = 365;
}
} elseif (self::isLeapYear($endYear)) {
if ($endMonthDay >= 229) {
$tmpCalcAnnualBasis = 366;
} else {
$tmpCalcAnnualBasis = 365;
}
} else {
$leapDays += (self::isLeapYear($year)) ? 1 : 0;
$tmpCalcAnnualBasis = 365;
}
} else {
$tmpCalcAnnualBasis = 0;
for ($year = $startYear; $year <= $endYear; ++$year) {
$tmpCalcAnnualBasis += self::isLeapYear($year) ? 366 : 365;
}
if ($years == 2) {
if (($leapDays == 0) && (self::isLeapYear($startYear)) && ($days > 365)) {
$leapDays = 1;
} elseif ($days < 366) {
$years = 1;
}
}
$leapDays /= $years;
$tmpCalcAnnualBasis /= $years;
}
return $days / (365 + $leapDays);
return $days / $tmpCalcAnnualBasis;
case 2:
return self::DATEDIF($startDate, $endDate) / 360;
case 3:
@ -1273,6 +1277,36 @@ class DateTime
return $DoW;
}
const STARTWEEK_SUNDAY = 1;
const STARTWEEK_MONDAY = 2;
const STARTWEEK_MONDAY_ALT = 11;
const STARTWEEK_TUESDAY = 12;
const STARTWEEK_WEDNESDAY = 13;
const STARTWEEK_THURSDAY = 14;
const STARTWEEK_FRIDAY = 15;
const STARTWEEK_SATURDAY = 16;
const STARTWEEK_SUNDAY_ALT = 17;
const DOW_SUNDAY = 1;
const DOW_MONDAY = 2;
const DOW_TUESDAY = 3;
const DOW_WEDNESDAY = 4;
const DOW_THURSDAY = 5;
const DOW_FRIDAY = 6;
const DOW_SATURDAY = 7;
const STARTWEEK_MONDAY_ISO = 21;
const METHODARR = [
self::STARTWEEK_SUNDAY => self::DOW_SUNDAY,
self::DOW_MONDAY,
self::STARTWEEK_MONDAY_ALT => self::DOW_MONDAY,
self::DOW_TUESDAY,
self::DOW_WEDNESDAY,
self::DOW_THURSDAY,
self::DOW_FRIDAY,
self::DOW_SATURDAY,
self::DOW_SUNDAY,
self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO,
];
/**
* WEEKNUM.
*
@ -1291,41 +1325,51 @@ class DateTime
* @param int $method Week begins on Sunday or Monday
* 1 or omitted Week begins on Sunday.
* 2 Week begins on Monday.
* 11 Week begins on Monday.
* 12 Week begins on Tuesday.
* 13 Week begins on Wednesday.
* 14 Week begins on Thursday.
* 15 Week begins on Friday.
* 16 Week begins on Saturday.
* 17 Week begins on Sunday.
* 21 ISO (Jan. 4 is week 1, begins on Monday).
*
* @return int|string Week Number
*/
public static function WEEKNUM($dateValue = 1, $method = 1)
public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY)
{
$dateValue = Functions::flattenSingleValue($dateValue);
$method = Functions::flattenSingleValue($method);
if (!is_numeric($method)) {
return Functions::VALUE();
} elseif (($method < 1) || ($method > 2)) {
return Functions::NAN();
}
$method = floor($method);
$method = (int) $method;
if (!array_key_exists($method, self::METHODARR)) {
return Functions::NaN();
}
$method = self::METHODARR[$method];
if ($dateValue === null) {
$dateValue = 1;
} elseif (is_string($dateValue = self::getDateValue($dateValue))) {
$dateValue = self::getDateValue($dateValue);
if (is_string($dateValue)) {
return Functions::VALUE();
} elseif ($dateValue < 0.0) {
}
if ($dateValue < 0.0) {
return Functions::NAN();
}
// Execute function
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
if ($method == self::STARTWEEK_MONDAY_ISO) {
return (int) $PHPDateObject->format('W');
}
$dayOfYear = $PHPDateObject->format('z');
$PHPDateObject->modify('-' . $dayOfYear . ' days');
$firstDayOfFirstWeek = $PHPDateObject->format('w');
$daysInFirstWeek = (6 - $firstDayOfFirstWeek + $method) % 7;
$interval = $dayOfYear - $daysInFirstWeek;
$weekOfYear = floor($interval / 7) + 1;
if ($daysInFirstWeek) {
++$weekOfYear;
}
$daysInFirstWeek += 7 * !$daysInFirstWeek;
$endFirstWeek = $daysInFirstWeek - 1;
$weekOfYear = floor(($dayOfYear - $endFirstWeek + 13) / 7);
return (int) $weekOfYear;
}

View File

@ -646,7 +646,7 @@ class Functions
public static function flattenSingleValue($value = '')
{
while (is_array($value)) {
$value = array_pop($value);
$value = array_shift($value);
}
return $value;

View File

@ -38,6 +38,88 @@ class MathTrig
return ($num - ($num % $n)) / $n;
}
/**
* ARABIC.
*
* Converts a Roman numeral to an Arabic numeral.
*
* Excel Function:
* ARABIC(text)
*
* @category Mathematical and Trigonometric Functions
*
* @param string $roman
*
* @return int|string the arabic numberal contrived from the roman numeral
*/
public static function ARABIC($roman)
{
// An empty string should return 0
$roman = substr(trim(strtoupper((string) Functions::flattenSingleValue($roman))), 0, 255);
if ($roman === '') {
return 0;
}
// Convert the roman numeral to an arabic number
$negativeNumber = $roman[0] === '-';
if ($negativeNumber) {
$roman = substr($roman, 1);
}
try {
$arabic = self::calculateArabic(str_split($roman));
} catch (\Exception $e) {
return Functions::VALUE(); // Invalid character detected
}
if ($negativeNumber) {
$arabic *= -1; // The number should be negative
}
return $arabic;
}
/**
* Recursively calculate the arabic value of a roman numeral.
*
* @param array $roman
* @param int $sum
* @param int $subtract
*
* @return int
*/
protected static function calculateArabic(array $roman, &$sum = 0, $subtract = 0)
{
$lookup = [
'M' => 1000,
'D' => 500,
'C' => 100,
'L' => 50,
'X' => 10,
'V' => 5,
'I' => 1,
];
$numeral = array_shift($roman);
if (!isset($lookup[$numeral])) {
throw new \Exception('Invalid character detected');
}
$arabic = $lookup[$numeral];
if (count($roman) > 0 && isset($lookup[$roman[0]]) && $arabic < $lookup[$roman[0]]) {
$subtract += $arabic;
} else {
$sum += ($arabic - $subtract);
$subtract = 0;
}
if (count($roman) > 0) {
self::calculateArabic($roman, $sum, $subtract);
}
return $sum;
}
/**
* ATAN2.
*
@ -84,6 +166,49 @@ class MathTrig
return Functions::VALUE();
}
/**
* BASE.
*
* Converts a number into a text representation with the given radix (base).
*
* Excel Function:
* BASE(Number, Radix [Min_length])
*
* @category Mathematical and Trigonometric Functions
*
* @param float $number
* @param float $radix
* @param int $minLength
*
* @return string the text representation with the given radix (base)
*/
public static function BASE($number, $radix, $minLength = null)
{
$number = Functions::flattenSingleValue($number);
$radix = Functions::flattenSingleValue($radix);
$minLength = Functions::flattenSingleValue($minLength);
if (is_numeric($number) && is_numeric($radix) && ($minLength === null || is_numeric($minLength))) {
// Truncate to an integer
$number = (int) $number;
$radix = (int) $radix;
$minLength = (int) $minLength;
if ($number < 0 || $number >= 2 ** 53 || $radix < 2 || $radix > 36) {
return Functions::NAN(); // Numeric range constraints
}
$outcome = strtoupper((string) base_convert($number, 10, $radix));
if ($minLength !== null) {
$outcome = str_pad($outcome, $minLength, '0', STR_PAD_LEFT); // String padding
}
return $outcome;
}
return Functions::VALUE();
}
/**
* CEILING.
*
@ -313,6 +438,80 @@ class MathTrig
return Functions::VALUE();
}
/**
* FLOOR.MATH.
*
* Round a number down to the nearest integer or to the nearest multiple of significance.
*
* Excel Function:
* FLOOR.MATH(number[,significance[,mode]])
*
* @category Mathematical and Trigonometric Functions
*
* @param float $number Number to round
* @param float $significance Significance
* @param int $mode direction to round negative numbers
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function FLOORMATH($number, $significance = null, $mode = 0)
{
$number = Functions::flattenSingleValue($number);
$significance = Functions::flattenSingleValue($significance);
$mode = Functions::flattenSingleValue($mode);
if (is_numeric($number) && $significance === null) {
$significance = $number / abs($number);
}
if (is_numeric($number) && is_numeric($significance) && is_numeric($mode)) {
if ($significance == 0.0) {
return Functions::DIV0();
} elseif ($number == 0.0) {
return 0.0;
} elseif (self::SIGN($significance) == -1 || (self::SIGN($number) == -1 && !empty($mode))) {
return ceil($number / $significance) * $significance;
}
return floor($number / $significance) * $significance;
}
return Functions::VALUE();
}
/**
* FLOOR.PRECISE.
*
* Rounds number down, toward zero, to the nearest multiple of significance.
*
* Excel Function:
* FLOOR.PRECISE(number[,significance])
*
* @category Mathematical and Trigonometric Functions
*
* @param float $number Number to round
* @param float $significance Significance
*
* @return float|string Rounded Number, or a string containing an error
*/
public static function FLOORPRECISE($number, $significance = 1)
{
$number = Functions::flattenSingleValue($number);
$significance = Functions::flattenSingleValue($significance);
if ((is_numeric($number)) && (is_numeric($significance))) {
if ($significance == 0.0) {
return Functions::DIV0();
} elseif ($number == 0.0) {
return 0.0;
}
return floor($number / abs($significance)) * abs($significance);
}
return Functions::VALUE();
}
private static function evaluateGCD($a, $b)
{
return $b ? self::evaluateGCD($b, $a % $b) : $a;
@ -939,12 +1138,11 @@ class MathTrig
$digits = Functions::flattenSingleValue($digits);
if ((is_numeric($number)) && (is_numeric($digits))) {
$significance = pow(10, (int) $digits);
if ($number < 0.0) {
return floor($number * $significance) / $significance;
return round($number - 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_DOWN);
}
return ceil($number * $significance) / $significance;
return round($number + 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_DOWN);
}
return Functions::VALUE();
@ -966,12 +1164,11 @@ class MathTrig
$digits = Functions::flattenSingleValue($digits);
if ((is_numeric($number)) && (is_numeric($digits))) {
$significance = pow(10, (int) $digits);
if ($number < 0.0) {
return ceil($number * $significance) / $significance;
return round($number + 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_UP);
}
return floor($number * $significance) / $significance;
return round($number - 0.5 * pow(0.1, $digits), $digits, PHP_ROUND_HALF_UP);
}
return Functions::VALUE();

View File

@ -9,6 +9,7 @@ ADDRESS
AMORDEGRC
AMORLINC
AND
ARABIC
AREAS
ASC
ASIN
@ -22,6 +23,7 @@ AVERAGEA
AVERAGEIF
AVERAGEIFS
BAHTTEXT
BASE
BESSELI
BESSELJ
BESSELK
@ -137,6 +139,8 @@ FISHER
FISHERINV
FIXED
FLOOR
FLOOR.MATH
FLOOR.PRECISE
FORECAST
FREQUENCY
FTEST

View File

@ -67,7 +67,7 @@ class Cell
/**
* Update the cell into the cell collection.
*
* @return self
* @return $this
*/
public function updateInCollection()
{
@ -177,7 +177,7 @@ class Cell
*
* @throws Exception
*
* @return Cell
* @return $this
*/
public function setValue($pValue)
{
@ -266,7 +266,7 @@ class Cell
// We don't yet handle array returns
if (is_array($result)) {
while (is_array($result)) {
$result = array_pop($result);
$result = array_shift($result);
}
}
} catch (Exception $ex) {
@ -672,7 +672,7 @@ class Cell
*
* @param mixed $pAttributes
*
* @return Cell
* @return $this
*/
public function setFormulaAttributes($pAttributes)
{

View File

@ -142,7 +142,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setFormula1($value)
{
@ -166,7 +166,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setFormula2($value)
{
@ -190,7 +190,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setType($value)
{
@ -214,7 +214,7 @@ class DataValidation
*
* @param string $value see self::STYLE_*
*
* @return DataValidation
* @return $this
*/
public function setErrorStyle($value)
{
@ -238,7 +238,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setOperator($value)
{
@ -262,7 +262,7 @@ class DataValidation
*
* @param bool $value
*
* @return DataValidation
* @return $this
*/
public function setAllowBlank($value)
{
@ -286,7 +286,7 @@ class DataValidation
*
* @param bool $value
*
* @return DataValidation
* @return $this
*/
public function setShowDropDown($value)
{
@ -310,7 +310,7 @@ class DataValidation
*
* @param bool $value
*
* @return DataValidation
* @return $this
*/
public function setShowInputMessage($value)
{
@ -334,7 +334,7 @@ class DataValidation
*
* @param bool $value
*
* @return DataValidation
* @return $this
*/
public function setShowErrorMessage($value)
{
@ -358,7 +358,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setErrorTitle($value)
{
@ -382,7 +382,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setError($value)
{
@ -406,7 +406,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setPromptTitle($value)
{
@ -430,7 +430,7 @@ class DataValidation
*
* @param string $value
*
* @return DataValidation
* @return $this
*/
public function setPrompt($value)
{

View File

@ -46,7 +46,7 @@ class Hyperlink
*
* @param string $value
*
* @return Hyperlink
* @return $this
*/
public function setUrl($value)
{
@ -70,7 +70,7 @@ class Hyperlink
*
* @param string $value
*
* @return Hyperlink
* @return $this
*/
public function setTooltip($value)
{

View File

@ -354,7 +354,7 @@ class Axis extends Properties
*
* @param int $shadow_presets
*
* @return Axis
* @return $this
*/
private function setShadowPresetsProperties($shadow_presets)
{
@ -370,7 +370,7 @@ class Axis extends Properties
* @param array $properties_map
* @param mixed &$reference
*
* @return Axis
* @return $this
*/
private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
@ -402,7 +402,7 @@ class Axis extends Properties
* @param int $alpha
* @param string $type
*
* @return Axis
* @return $this
*/
private function setShadowColor($color, $alpha, $type)
{
@ -416,7 +416,7 @@ class Axis extends Properties
*
* @param float $blur
*
* @return Axis
* @return $this
*/
private function setShadowBlur($blur)
{
@ -432,7 +432,7 @@ class Axis extends Properties
*
* @param int $angle
*
* @return Axis
* @return $this
*/
private function setShadowAngle($angle)
{
@ -448,7 +448,7 @@ class Axis extends Properties
*
* @param float $distance
*
* @return Axis
* @return $this
*/
private function setShadowDistance($distance)
{
@ -506,7 +506,7 @@ class Axis extends Properties
*
* @param float $size
*
* @return Axis
* @return $this
*/
private function setGlowSize($size)
{
@ -524,7 +524,7 @@ class Axis extends Properties
* @param int $alpha
* @param string $type
*
* @return Axis
* @return $this
*/
private function setGlowColor($color, $alpha, $type)
{

View File

@ -197,7 +197,7 @@ class Chart
*
* @param Worksheet $pValue
*
* @return Chart
* @return $this
*/
public function setWorksheet(Worksheet $pValue = null)
{
@ -221,7 +221,7 @@ class Chart
*
* @param Title $title
*
* @return Chart
* @return $this
*/
public function setTitle(Title $title)
{
@ -245,7 +245,7 @@ class Chart
*
* @param Legend $legend
*
* @return Chart
* @return $this
*/
public function setLegend(Legend $legend)
{
@ -269,7 +269,7 @@ class Chart
*
* @param Title $label
*
* @return Chart
* @return $this
*/
public function setXAxisLabel(Title $label)
{
@ -293,7 +293,7 @@ class Chart
*
* @param Title $label
*
* @return Chart
* @return $this
*/
public function setYAxisLabel(Title $label)
{
@ -327,7 +327,7 @@ class Chart
*
* @param bool $plotVisibleOnly
*
* @return Chart
* @return $this
*/
public function setPlotVisibleOnly($plotVisibleOnly)
{
@ -351,7 +351,7 @@ class Chart
*
* @param string $displayBlanksAs
*
* @return Chart
* @return $this
*/
public function setDisplayBlanksAs($displayBlanksAs)
{
@ -423,7 +423,7 @@ class Chart
* @param int $xOffset
* @param int $yOffset
*
* @return Chart
* @return $this
*/
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
{
@ -467,7 +467,7 @@ class Chart
*
* @param string $cell
*
* @return Chart
* @return $this
*/
public function setTopLeftCell($cell)
{
@ -482,7 +482,7 @@ class Chart
* @param int $xOffset
* @param int $yOffset
*
* @return Chart
* @return $this
*/
public function setTopLeftOffset($xOffset, $yOffset)
{
@ -541,7 +541,7 @@ class Chart
* @param int $xOffset
* @param int $yOffset
*
* @return Chart
* @return $this
*/
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
{
@ -593,7 +593,7 @@ class Chart
* @param int $xOffset
* @param int $yOffset
*
* @return Chart
* @return $this
*/
public function setBottomRightOffset($xOffset, $yOffset)
{

View File

@ -157,7 +157,7 @@ class DataSeries
*
* @param string $plotType
*
* @return DataSeries
* @return $this
*/
public function setPlotType($plotType)
{
@ -181,7 +181,7 @@ class DataSeries
*
* @param string $groupingType
*
* @return DataSeries
* @return $this
*/
public function setPlotGrouping($groupingType)
{
@ -205,7 +205,7 @@ class DataSeries
*
* @param string $plotDirection
*
* @return DataSeries
* @return $this
*/
public function setPlotDirection($plotDirection)
{
@ -297,7 +297,7 @@ class DataSeries
*
* @param null|string $plotStyle
*
* @return DataSeries
* @return $this
*/
public function setPlotStyle($plotStyle)
{
@ -360,7 +360,7 @@ class DataSeries
*
* @param bool $smoothLine
*
* @return DataSeries
* @return $this
*/
public function setSmoothLine($smoothLine)
{

View File

@ -117,7 +117,7 @@ class DataSeriesValues
*
* @throws Exception
*
* @return DataSeriesValues
* @return $this
*/
public function setDataType($dataType)
{
@ -144,7 +144,7 @@ class DataSeriesValues
*
* @param string $dataSource
*
* @return DataSeriesValues
* @return $this
*/
public function setDataSource($dataSource)
{
@ -168,7 +168,7 @@ class DataSeriesValues
*
* @param string $marker
*
* @return DataSeriesValues
* @return $this
*/
public function setPointMarker($marker)
{
@ -192,7 +192,7 @@ class DataSeriesValues
*
* @param string $formatCode
*
* @return DataSeriesValues
* @return $this
*/
public function setFormatCode($formatCode)
{
@ -275,7 +275,7 @@ class DataSeriesValues
*
* @param int $width
*
* @return DataSeriesValues
* @return $this
*/
public function setLineWidth($width)
{
@ -346,7 +346,7 @@ class DataSeriesValues
*
* @param array $dataValues
*
* @return DataSeriesValues
* @return $this
*/
public function setDataValues($dataValues)
{

View File

@ -91,7 +91,7 @@ class GridLines extends Properties
/**
* Change Object State to True.
*
* @return GridLines
* @return $this
*/
private function activateObject()
{
@ -229,7 +229,7 @@ class GridLines extends Properties
*
* @param float $size
*
* @return GridLines
* @return $this
*/
private function setGlowSize($size)
{
@ -245,7 +245,7 @@ class GridLines extends Properties
* @param int $alpha
* @param string $type
*
* @return GridLines
* @return $this
*/
private function setGlowColor($color, $alpha, $type)
{
@ -305,7 +305,7 @@ class GridLines extends Properties
*
* @param int $shadow_presets
*
* @return GridLines
* @return $this
*/
private function setShadowPresetsProperties($shadow_presets)
{
@ -321,7 +321,7 @@ class GridLines extends Properties
* @param array $properties_map
* @param mixed &$reference
*
* @return GridLines
* @return $this
*/
private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
@ -353,7 +353,7 @@ class GridLines extends Properties
* @param int $alpha
* @param string $type
*
* @return GridLines
* @return $this
*/
private function setShadowColor($color, $alpha, $type)
{
@ -375,7 +375,7 @@ class GridLines extends Properties
*
* @param float $blur
*
* @return GridLines
* @return $this
*/
private function setShadowBlur($blur)
{
@ -391,7 +391,7 @@ class GridLines extends Properties
*
* @param int $angle
*
* @return GridLines
* @return $this
*/
private function setShadowAngle($angle)
{
@ -407,7 +407,7 @@ class GridLines extends Properties
*
* @param float $distance
*
* @return GridLines
* @return $this
*/
private function setShadowDistance($distance)
{

View File

@ -153,7 +153,7 @@ class Layout
*
* @param string $value
*
* @return Layout
* @return $this
*/
public function setLayoutTarget($value)
{
@ -177,7 +177,7 @@ class Layout
*
* @param string $value
*
* @return Layout
* @return $this
*/
public function setXMode($value)
{
@ -201,7 +201,7 @@ class Layout
*
* @param string $value
*
* @return Layout
* @return $this
*/
public function setYMode($value)
{
@ -225,7 +225,7 @@ class Layout
*
* @param float $value
*
* @return Layout
* @return $this
*/
public function setXPosition($value)
{
@ -249,7 +249,7 @@ class Layout
*
* @param float $value
*
* @return Layout
* @return $this
*/
public function setYPosition($value)
{
@ -273,7 +273,7 @@ class Layout
*
* @param float $value
*
* @return Layout
* @return $this
*/
public function setWidth($value)
{
@ -297,7 +297,7 @@ class Layout
*
* @param float $value
*
* @return Layout
* @return $this
*/
public function setHeight($value)
{
@ -322,7 +322,7 @@ class Layout
*
* @param bool $value Show legend key
*
* @return Layout
* @return $this
*/
public function setShowLegendKey($value)
{
@ -347,7 +347,7 @@ class Layout
*
* @param bool $value Show val
*
* @return Layout
* @return $this
*/
public function setShowVal($value)
{
@ -372,7 +372,7 @@ class Layout
*
* @param bool $value Show cat name
*
* @return Layout
* @return $this
*/
public function setShowCatName($value)
{
@ -397,7 +397,7 @@ class Layout
*
* @param bool $value Show series name
*
* @return Layout
* @return $this
*/
public function setShowSerName($value)
{
@ -422,7 +422,7 @@ class Layout
*
* @param bool $value Show percentage
*
* @return Layout
* @return $this
*/
public function setShowPercent($value)
{
@ -447,7 +447,7 @@ class Layout
*
* @param bool $value Show bubble size
*
* @return Layout
* @return $this
*/
public function setShowBubbleSize($value)
{
@ -472,7 +472,7 @@ class Layout
*
* @param bool $value Show leader lines
*
* @return Layout
* @return $this
*/
public function setShowLeaderLines($value)
{

View File

@ -94,7 +94,7 @@ class PlotArea
*
* @param DataSeries[] $plotSeries
*
* @return PlotArea
* @return $this
*/
public function setPlotSeries(array $plotSeries)
{

View File

@ -45,7 +45,7 @@ class Title
*
* @param string $caption
*
* @return Title
* @return $this
*/
public function setCaption($caption)
{

View File

@ -96,7 +96,7 @@ class Comment implements IComparable
*
* @param string $author
*
* @return Comment
* @return $this
*/
public function setAuthor($author)
{
@ -120,7 +120,7 @@ class Comment implements IComparable
*
* @param RichText $pValue
*
* @return Comment
* @return $this
*/
public function setText(RichText $pValue)
{
@ -144,7 +144,7 @@ class Comment implements IComparable
*
* @param string $width
*
* @return Comment
* @return $this
*/
public function setWidth($width)
{
@ -168,7 +168,7 @@ class Comment implements IComparable
*
* @param string $value
*
* @return Comment
* @return $this
*/
public function setHeight($value)
{
@ -192,7 +192,7 @@ class Comment implements IComparable
*
* @param string $value
*
* @return Comment
* @return $this
*/
public function setMarginLeft($value)
{
@ -216,7 +216,7 @@ class Comment implements IComparable
*
* @param string $value
*
* @return Comment
* @return $this
*/
public function setMarginTop($value)
{
@ -240,7 +240,7 @@ class Comment implements IComparable
*
* @param bool $value
*
* @return Comment
* @return $this
*/
public function setVisible($value)
{
@ -264,7 +264,7 @@ class Comment implements IComparable
*
* @param string $alignment see Style\Alignment::HORIZONTAL_*
*
* @return Comment
* @return $this
*/
public function setAlignment($alignment)
{

View File

@ -122,7 +122,7 @@ class Properties
*
* @param string $creator
*
* @return Properties
* @return $this
*/
public function setCreator($creator)
{
@ -146,7 +146,7 @@ class Properties
*
* @param string $pValue
*
* @return Properties
* @return $this
*/
public function setLastModifiedBy($pValue)
{
@ -170,7 +170,7 @@ class Properties
*
* @param int|string $time
*
* @return Properties
* @return $this
*/
public function setCreated($time)
{
@ -204,7 +204,7 @@ class Properties
*
* @param int|string $time
*
* @return Properties
* @return $this
*/
public function setModified($time)
{
@ -238,7 +238,7 @@ class Properties
*
* @param string $title
*
* @return Properties
* @return $this
*/
public function setTitle($title)
{
@ -262,7 +262,7 @@ class Properties
*
* @param string $description
*
* @return Properties
* @return $this
*/
public function setDescription($description)
{
@ -286,7 +286,7 @@ class Properties
*
* @param string $subject
*
* @return Properties
* @return $this
*/
public function setSubject($subject)
{
@ -310,7 +310,7 @@ class Properties
*
* @param string $keywords
*
* @return Properties
* @return $this
*/
public function setKeywords($keywords)
{
@ -334,7 +334,7 @@ class Properties
*
* @param string $category
*
* @return Properties
* @return $this
*/
public function setCategory($category)
{
@ -358,7 +358,7 @@ class Properties
*
* @param string $company
*
* @return Properties
* @return $this
*/
public function setCompany($company)
{
@ -382,7 +382,7 @@ class Properties
*
* @param string $manager
*
* @return Properties
* @return $this
*/
public function setManager($manager)
{
@ -453,7 +453,7 @@ class Properties
* 'd' : Date/Time
* 'b' : Boolean
*
* @return Properties
* @return $this
*/
public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
{

View File

@ -75,7 +75,7 @@ class Security
*
* @param bool $pValue
*
* @return Security
* @return $this
*/
public function setLockRevision($pValue)
{
@ -99,7 +99,7 @@ class Security
*
* @param bool $pValue
*
* @return Security
* @return $this
*/
public function setLockStructure($pValue)
{
@ -123,7 +123,7 @@ class Security
*
* @param bool $pValue
*
* @return Security
* @return $this
*/
public function setLockWindows($pValue)
{
@ -148,7 +148,7 @@ class Security
* @param string $pValue
* @param bool $pAlreadyHashed If the password has already been hashed, set this to true
*
* @return Security
* @return $this
*/
public function setRevisionsPassword($pValue, $pAlreadyHashed = false)
{
@ -176,7 +176,7 @@ class Security
* @param string $pValue
* @param bool $pAlreadyHashed If the password has already been hashed, set this to true
*
* @return Security
* @return $this
*/
public function setWorkbookPassword($pValue, $pAlreadyHashed = false)
{

View File

@ -0,0 +1,111 @@
<?php
namespace PhpOffice\PhpSpreadsheet;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use ReflectionClass;
use ReflectionException;
use UnexpectedValueException;
class DocumentGenerator
{
/**
* @param array[] $phpSpreadsheetFunctions
*
* @throws ReflectionException
*
* @return string
*/
public static function generateFunctionListByCategory(array $phpSpreadsheetFunctions): string
{
$result = "# Function list by category\n";
foreach (self::getCategories() as $categoryConstant => $category) {
$result .= "\n";
$result .= "## {$categoryConstant}\n";
$result .= "\n";
$lengths = [20, 42];
$result .= self::tableRow($lengths, ['Excel Function', 'PhpSpreadsheet Function']) . "\n";
$result .= self::tableRow($lengths, null) . "\n";
foreach ($phpSpreadsheetFunctions as $excelFunction => $functionInfo) {
if ($category === $functionInfo['category']) {
$phpFunction = self::getPhpSpreadsheetFunctionText($functionInfo['functionCall']);
$result .= self::tableRow($lengths, [$excelFunction, $phpFunction]) . "\n";
}
}
}
return $result;
}
/**
* @throws ReflectionException
*
* @return array
*/
private static function getCategories(): array
{
return (new ReflectionClass(Category::class))->getConstants();
}
private static function tableRow(array $lengths, array $values = null): string
{
$result = '';
foreach (array_map(null, $lengths, $values ?? []) as $i => [$length, $value]) {
$pad = $value === null ? '-' : ' ';
if ($i > 0) {
$result .= '|' . $pad;
}
$result .= str_pad($value ?? '', $length, $pad);
}
return rtrim($result, ' ');
}
private static function getPhpSpreadsheetFunctionText($functionCall): string
{
if (is_string($functionCall)) {
return $functionCall;
}
if ($functionCall === [Functions::class, 'DUMMY']) {
return '**Not yet Implemented**';
}
if (is_array($functionCall)) {
return "\\{$functionCall[0]}::{$functionCall[1]}";
}
throw new UnexpectedValueException(
'$functionCall is of type ' . gettype($functionCall) . '. string or array expected'
);
}
/**
* @param array[] $phpSpreadsheetFunctions
*
* @throws ReflectionException
*
* @return string
*/
public static function generateFunctionListByName(array $phpSpreadsheetFunctions): string
{
$categoryConstants = array_flip(self::getCategories());
$result = "# Function list by name\n";
$lastAlphabet = null;
foreach ($phpSpreadsheetFunctions as $excelFunction => $functionInfo) {
$lengths = [20, 31, 42];
if ($lastAlphabet !== $excelFunction[0]) {
$lastAlphabet = $excelFunction[0];
$result .= "\n";
$result .= "## {$lastAlphabet}\n";
$result .= "\n";
$result .= self::tableRow($lengths, ['Excel Function', 'Category', 'PhpSpreadsheet Function']) . "\n";
$result .= self::tableRow($lengths, null) . "\n";
}
$category = $categoryConstants[$functionInfo['category']];
$phpFunction = self::getPhpSpreadsheetFunctionText($functionInfo['functionCall']);
$result .= self::tableRow($lengths, [$excelFunction, $category, $phpFunction]) . "\n";
}
return $result;
}
}

View File

@ -82,7 +82,7 @@ class NamedRange
*
* @param string $value
*
* @return NamedRange
* @return $this
*/
public function setName($value)
{
@ -123,7 +123,7 @@ class NamedRange
*
* @param Worksheet $value
*
* @return NamedRange
* @return $this
*/
public function setWorksheet(Worksheet $value = null)
{
@ -149,7 +149,7 @@ class NamedRange
*
* @param string $value
*
* @return NamedRange
* @return $this
*/
public function setRange($value)
{
@ -175,7 +175,7 @@ class NamedRange
*
* @param bool $value
*
* @return NamedRange
* @return $this
*/
public function setLocalOnly($value)
{
@ -200,7 +200,7 @@ class NamedRange
*
* @param null|Worksheet $value
*
* @return NamedRange
* @return $this
*/
public function setScope(Worksheet $value = null)
{

View File

@ -70,7 +70,7 @@ class Csv extends BaseReader
*
* @param string $pValue Input encoding, eg: 'UTF-8'
*
* @return Csv
* @return $this
*/
public function setInputEncoding($pValue)
{
@ -415,7 +415,7 @@ class Csv extends BaseReader
*
* @param string $delimiter Delimiter, eg: ','
*
* @return CSV
* @return $this
*/
public function setDelimiter($delimiter)
{
@ -439,7 +439,7 @@ class Csv extends BaseReader
*
* @param string $enclosure Enclosure, defaults to "
*
* @return CSV
* @return $this
*/
public function setEnclosure($enclosure)
{
@ -466,7 +466,7 @@ class Csv extends BaseReader
*
* @param int $pValue Sheet index
*
* @return CSV
* @return $this
*/
public function setSheetIndex($pValue)
{
@ -480,7 +480,7 @@ class Csv extends BaseReader
*
* @param bool $contiguous
*
* @return Csv
* @return $this
*/
public function setContiguous($contiguous)
{

View File

@ -223,7 +223,7 @@ class Html extends BaseReader
*
* @param string $pValue Input encoding, eg: 'ANSI'
*
* @return Html
* @return $this
*/
public function setInputEncoding($pValue)
{
@ -669,7 +669,7 @@ class Html extends BaseReader
*
* @param int $pValue Sheet index
*
* @return HTML
* @return $this
*/
public function setSheetIndex($pValue)
{

View File

@ -83,7 +83,7 @@ class Slk extends BaseReader
*
* @param string $pValue Input encoding, eg: 'ANSI'
*
* @return Slk
* @return $this
*/
public function setInputEncoding($pValue)
{
@ -485,7 +485,7 @@ class Slk extends BaseReader
*
* @param int $pValue Sheet index
*
* @return Slk
* @return $this
*/
public function setSheetIndex($pValue)
{

View File

@ -1620,8 +1620,6 @@ class Xlsx extends BaseReader
$docStyle->getFill()->setFillType($patternType);
if ($style->fill->patternFill->fgColor) {
$docStyle->getFill()->getStartColor()->setARGB(self::readColor($style->fill->patternFill->fgColor, true));
} else {
$docStyle->getFill()->getStartColor()->setARGB('FF000000');
}
if ($style->fill->patternFill->bgColor) {
$docStyle->getFill()->getEndColor()->setARGB(self::readColor($style->fill->patternFill->bgColor, true));
@ -1828,7 +1826,7 @@ class Xlsx extends BaseReader
private static function toCSSArray($style)
{
$style = trim(str_replace(["\r", "\n"], '', $style), ';');
$style = self::stripWhiteSpaceFromStyleString($style);
$temp = explode(';', $style);
$style = [];
@ -1857,6 +1855,11 @@ class Xlsx extends BaseReader
return $style;
}
public static function stripWhiteSpaceFromStyleString($string)
{
return trim(str_replace(["\r", "\n", ' '], '', $string), ';');
}
private static function boolean($value)
{
if (is_object($value)) {

View File

@ -20,7 +20,8 @@ class AutoFilter
public function load()
{
$autoFilterRange = (string) $this->worksheetXml->autoFilter['ref'];
// Remove all "$" in the auto filter range
$autoFilterRange = preg_replace('/\$/', '', $this->worksheetXml->autoFilter['ref']);
if (strpos($autoFilterRange, ':') !== false) {
$this->readAutoFilter($autoFilterRange, $this->worksheetXml);
}

View File

@ -47,7 +47,7 @@ class RichText implements IComparable
*
* @param ITextElement $pText Rich text element
*
* @return RichText
* @return $this
*/
public function addText(ITextElement $pText)
{
@ -133,7 +133,7 @@ class RichText implements IComparable
*
* @param ITextElement[] $textElements Array of elements
*
* @return RichText
* @return $this
*/
public function setRichTextElements(array $textElements)
{

View File

@ -40,7 +40,7 @@ class Run extends TextElement implements ITextElement
*
* @param Font $pFont Font
*
* @return ITextElement
* @return $this
*/
public function setFont(Font $pFont = null)
{

View File

@ -37,7 +37,7 @@ class TextElement implements ITextElement
*
* @param $text string Text
*
* @return ITextElement
* @return $this
*/
public function setText($text)
{

View File

@ -28,8 +28,6 @@ class Settings
* Allow/disallow libxml_disable_entity_loader() call when not thread safe.
* Default behaviour is to do the check, but if you're running PHP versions
* 7.2 < 7.2.1
* 7.1 < 7.1.13
* 7.0 < 7.0.27
* then you may need to disable this check to prevent unwanted behaviour in other threads
* SECURITY WARNING: Changing this flag is not recommended.
*
@ -119,8 +117,6 @@ class Settings
* Allow/disallow libxml_disable_entity_loader() call when not thread safe.
* Default behaviour is to do the check, but if you're running PHP versions
* 7.2 < 7.2.1
* 7.1 < 7.1.13
* 7.0 < 7.0.27
* then you may need to disable this check to prevent unwanted behaviour in other threads
* SECURITY WARNING: Changing this flag to false is not recommended.
*

View File

@ -524,7 +524,7 @@ class Matrix
*
* @param mixed $B Matrix/Array
*
* @return Matrix Sum
* @return $this
*/
public function plusEquals(...$args)
{
@ -628,7 +628,7 @@ class Matrix
*
* @param mixed $B Matrix/Array
*
* @return Matrix Sum
* @return $this
*/
public function minusEquals(...$args)
{
@ -734,7 +734,7 @@ class Matrix
*
* @param mixed $B Matrix/Array
*
* @return Matrix Matrix Aij
* @return $this
*/
public function arrayTimesEquals(...$args)
{
@ -1091,7 +1091,7 @@ class Matrix
*
* @param mixed $B Matrix/Array
*
* @return Matrix Sum
* @return $this
*/
public function power(...$args)
{
@ -1150,7 +1150,7 @@ class Matrix
*
* @param mixed $B Matrix/Array
*
* @return Matrix Sum
* @return $this
*/
public function concat(...$args)
{

View File

@ -955,7 +955,7 @@ class Spreadsheet
* @param string $namedRange
* @param null|Worksheet $pSheet scope: use null for global scope
*
* @return Spreadsheet
* @return $this
*/
public function removeNamedRange($namedRange, Worksheet $pSheet = null)
{

View File

@ -140,7 +140,7 @@ class Alignment extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Alignment
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -193,7 +193,7 @@ class Alignment extends Supervisor
*
* @param string $pValue see self::HORIZONTAL_*
*
* @return Alignment
* @return $this
*/
public function setHorizontal($pValue)
{
@ -230,7 +230,7 @@ class Alignment extends Supervisor
*
* @param string $pValue see self::VERTICAL_*
*
* @return Alignment
* @return $this
*/
public function setVertical($pValue)
{
@ -269,7 +269,7 @@ class Alignment extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Alignment
* @return $this
*/
public function setTextRotation($pValue)
{
@ -312,7 +312,7 @@ class Alignment extends Supervisor
*
* @param bool $pValue
*
* @return Alignment
* @return $this
*/
public function setWrapText($pValue)
{
@ -348,7 +348,7 @@ class Alignment extends Supervisor
*
* @param bool $pValue
*
* @return Alignment
* @return $this
*/
public function setShrinkToFit($pValue)
{
@ -384,7 +384,7 @@ class Alignment extends Supervisor
*
* @param int $pValue
*
* @return Alignment
* @return $this
*/
public function setIndent($pValue)
{
@ -424,7 +424,7 @@ class Alignment extends Supervisor
*
* @param int $pValue
*
* @return Alignment
* @return $this
*/
public function setReadOrder($pValue)
{

View File

@ -127,7 +127,7 @@ class Border extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Border
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -166,7 +166,7 @@ class Border extends Supervisor
* When passing a boolean, FALSE equates Border::BORDER_NONE
* and TRUE to Border::BORDER_MEDIUM
*
* @return Border
* @return $this
*/
public function setBorderStyle($pValue)
{
@ -202,7 +202,7 @@ class Border extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Border
* @return $this
*/
public function setColor(Color $pValue)
{

View File

@ -197,7 +197,7 @@ class Borders extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Borders
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -382,7 +382,7 @@ class Borders extends Supervisor
*
* @param int $pValue see self::DIAGONAL_*
*
* @return Borders
* @return $this
*/
public function setDiagonalDirection($pValue)
{

View File

@ -106,7 +106,7 @@ class Color extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Color
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -143,7 +143,7 @@ class Color extends Supervisor
*
* @param string $pValue see self::COLOR_*
*
* @return Color
* @return $this
*/
public function setARGB($pValue)
{
@ -179,7 +179,7 @@ class Color extends Supervisor
*
* @param string $pValue RGB value
*
* @return Color
* @return $this
*/
public function setRGB($pValue)
{
@ -312,7 +312,7 @@ class Color extends Supervisor
* @param bool $background Flag to indicate whether default background or foreground colour
* should be returned if the indexed colour doesn't exist
*
* @return Color
* @return self
*/
public static function indexedColor($pIndex, $background = false)
{

View File

@ -27,6 +27,7 @@ class Conditional implements IComparable
const OPERATOR_CONTAINSTEXT = 'containsText';
const OPERATOR_NOTCONTAINS = 'notContains';
const OPERATOR_BETWEEN = 'between';
const OPERATOR_NOTBETWEEN = 'notBetween';
/**
* Condition type.
@ -94,7 +95,7 @@ class Conditional implements IComparable
*
* @param string $pValue Condition type, see self::CONDITION_*
*
* @return Conditional
* @return $this
*/
public function setConditionType($pValue)
{
@ -118,7 +119,7 @@ class Conditional implements IComparable
*
* @param string $pValue Conditional operator type, see self::OPERATOR_*
*
* @return Conditional
* @return $this
*/
public function setOperatorType($pValue)
{
@ -142,7 +143,7 @@ class Conditional implements IComparable
*
* @param string $value
*
* @return Conditional
* @return $this
*/
public function setText($value)
{
@ -166,7 +167,7 @@ class Conditional implements IComparable
*
* @param bool $value
*
* @return Conditional
* @return $this
*/
public function setStopIfTrue($value)
{
@ -190,7 +191,7 @@ class Conditional implements IComparable
*
* @param string[] $pValue Condition
*
* @return Conditional
* @return $this
*/
public function setConditions($pValue)
{
@ -207,7 +208,7 @@ class Conditional implements IComparable
*
* @param string $pValue Condition
*
* @return Conditional
* @return $this
*/
public function addCondition($pValue)
{
@ -231,7 +232,7 @@ class Conditional implements IComparable
*
* @param Style $pValue
*
* @return Conditional
* @return $this
*/
public function setStyle(Style $pValue = null)
{

View File

@ -141,7 +141,7 @@ class Fill extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Fill
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -188,7 +188,7 @@ class Fill extends Supervisor
*
* @param string $pValue Fill type, see self::FILL_*
*
* @return Fill
* @return $this
*/
public function setFillType($pValue)
{
@ -221,7 +221,7 @@ class Fill extends Supervisor
*
* @param float $pValue
*
* @return Fill
* @return $this
*/
public function setRotation($pValue)
{
@ -252,7 +252,7 @@ class Fill extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Fill
* @return $this
*/
public function setStartColor(Color $pValue)
{
@ -286,7 +286,7 @@ class Fill extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Fill
* @return $this
*/
public function setEndColor(Color $pValue)
{

View File

@ -161,7 +161,7 @@ class Font extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Font
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -219,7 +219,7 @@ class Font extends Supervisor
*
* @param string $pValue
*
* @return Font
* @return $this
*/
public function setName($pValue)
{
@ -255,7 +255,7 @@ class Font extends Supervisor
*
* @param float $pValue
*
* @return Font
* @return $this
*/
public function setSize($pValue)
{
@ -291,7 +291,7 @@ class Font extends Supervisor
*
* @param bool $pValue
*
* @return Font
* @return $this
*/
public function setBold($pValue)
{
@ -327,7 +327,7 @@ class Font extends Supervisor
*
* @param bool $pValue
*
* @return Font
* @return $this
*/
public function setItalic($pValue)
{
@ -363,7 +363,7 @@ class Font extends Supervisor
*
* @param bool $pValue
*
* @return Font
* @return $this
*/
public function setSuperscript($pValue)
{
@ -400,7 +400,7 @@ class Font extends Supervisor
*
* @param bool $pValue
*
* @return Font
* @return $this
*/
public function setSubscript($pValue)
{
@ -439,7 +439,7 @@ class Font extends Supervisor
* If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE,
* false equates to UNDERLINE_NONE
*
* @return Font
* @return $this
*/
public function setUnderline($pValue)
{
@ -477,7 +477,7 @@ class Font extends Supervisor
*
* @param bool $pValue
*
* @return Font
* @return $this
*/
public function setStrikethrough($pValue)
{
@ -512,7 +512,7 @@ class Font extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Font
* @return $this
*/
public function setColor(Color $pValue)
{

View File

@ -139,7 +139,7 @@ class NumberFormat extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return NumberFormat
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -176,7 +176,7 @@ class NumberFormat extends Supervisor
*
* @param string $pValue see self::FORMAT_*
*
* @return NumberFormat
* @return $this
*/
public function setFormatCode($pValue)
{
@ -213,7 +213,7 @@ class NumberFormat extends Supervisor
*
* @param int $pValue
*
* @return NumberFormat
* @return $this
*/
public function setBuiltInFormatCode($pValue)
{

View File

@ -86,7 +86,7 @@ class Protection extends Supervisor
*
* @throws PhpSpreadsheetException
*
* @return Protection
* @return $this
*/
public function applyFromArray(array $pStyles)
{
@ -123,7 +123,7 @@ class Protection extends Supervisor
*
* @param string $pValue see self::PROTECTION_*
*
* @return Protection
* @return $this
*/
public function setLocked($pValue)
{
@ -156,7 +156,7 @@ class Protection extends Supervisor
*
* @param string $pValue see self::PROTECTION_*
*
* @return Protection
* @return $this
*/
public function setHidden($pValue)
{

View File

@ -189,7 +189,7 @@ class Style extends Supervisor
* @param array $pStyles Array containing style information
* @param bool $pAdvanced advanced mode for setting borders
*
* @return Style
* @return $this
*/
public function applyFromArray(array $pStyles, $pAdvanced = true)
{
@ -485,7 +485,7 @@ class Style extends Supervisor
*
* @param Font $font
*
* @return Style
* @return $this
*/
public function setFont(Font $font)
{
@ -539,7 +539,7 @@ class Style extends Supervisor
*
* @param Conditional[] $pValue Array of conditional styles
*
* @return Style
* @return $this
*/
public function setConditionalStyles(array $pValue)
{
@ -577,7 +577,7 @@ class Style extends Supervisor
*
* @param bool $pValue
*
* @return Style
* @return $this
*/
public function setQuotePrefix($pValue)
{

View File

@ -48,7 +48,7 @@ abstract class Supervisor implements IComparable
* @param Spreadsheet|Style $parent
* @param null|string $parentPropertyName
*
* @return Supervisor
* @return $this
*/
public function bindParent($parent, $parentPropertyName = null)
{

View File

@ -59,7 +59,7 @@ class AutoFilter
*
* @param Worksheet $pSheet
*
* @return AutoFilter
* @return $this
*/
public function setParent(Worksheet $pSheet = null)
{
@ -85,7 +85,7 @@ class AutoFilter
*
* @throws PhpSpreadsheetException
*
* @return AutoFilter
* @return $this
*/
public function setRange($pRange)
{
@ -210,7 +210,7 @@ class AutoFilter
*
* @throws PhpSpreadsheetException
*
* @return AutoFilter
* @return $this
*/
public function setColumn($pColumn)
{
@ -241,7 +241,7 @@ class AutoFilter
*
* @throws PhpSpreadsheetException
*
* @return AutoFilter
* @return $this
*/
public function clearColumn($pColumn)
{
@ -264,7 +264,7 @@ class AutoFilter
* @param string $fromColumn Column name (e.g. A)
* @param string $toColumn Column name (e.g. B)
*
* @return AutoFilter
* @return $this
*/
public function shiftColumn($fromColumn, $toColumn)
{
@ -617,7 +617,7 @@ class AutoFilter
*
* @throws PhpSpreadsheetException
*
* @return AutoFilter
* @return $this
*/
public function showHideRows()
{

View File

@ -117,7 +117,7 @@ class Column
*
* @throws PhpSpreadsheetException
*
* @return Column
* @return $this
*/
public function setColumnIndex($pColumn)
{
@ -147,7 +147,7 @@ class Column
*
* @param AutoFilter $pParent
*
* @return Column
* @return $this
*/
public function setParent(AutoFilter $pParent = null)
{
@ -173,7 +173,7 @@ class Column
*
* @throws PhpSpreadsheetException
*
* @return Column
* @return $this
*/
public function setFilterType($pFilterType)
{
@ -203,7 +203,7 @@ class Column
*
* @throws PhpSpreadsheetException
*
* @return Column
* @return $this
*/
public function setJoin($pJoin)
{
@ -223,7 +223,7 @@ class Column
*
* @param string[] $attributes
*
* @return Column
* @return $this
*/
public function setAttributes(array $attributes)
{
@ -238,7 +238,7 @@ class Column
* @param string $pName Attribute Name
* @param string $pValue Attribute Value
*
* @return Column
* @return $this
*/
public function setAttribute($pName, $pValue)
{
@ -316,7 +316,7 @@ class Column
*
* @param Column\Rule $pRule
*
* @return Column
* @return $this
*/
public function addRule(Column\Rule $pRule)
{
@ -332,7 +332,7 @@ class Column
*
* @param int $pIndex Rule index in the ruleset array
*
* @return Column
* @return $this
*/
public function deleteRule($pIndex)
{
@ -350,7 +350,7 @@ class Column
/**
* Delete all AutoFilter Column Rules.
*
* @return Column
* @return $this
*/
public function clearRules()
{

View File

@ -262,7 +262,7 @@ class Rule
*
* @throws PhpSpreadsheetException
*
* @return Rule
* @return $this
*/
public function setRuleType($pRuleType)
{
@ -292,7 +292,7 @@ class Rule
*
* @throws PhpSpreadsheetException
*
* @return Rule
* @return $this
*/
public function setValue($pValue)
{
@ -336,7 +336,7 @@ class Rule
*
* @throws PhpSpreadsheetException
*
* @return Rule
* @return $this
*/
public function setOperator($pOperator)
{
@ -369,7 +369,7 @@ class Rule
*
* @throws PhpSpreadsheetException
*
* @return Rule
* @return $this
*/
public function setGrouping($pGrouping)
{
@ -393,7 +393,7 @@ class Rule
*
* @throws PhpSpreadsheetException
*
* @return Rule
* @return $this
*/
public function setRule($pOperator, $pValue, $pGrouping = null)
{
@ -424,7 +424,7 @@ class Rule
*
* @param Column $pParent
*
* @return Rule
* @return $this
*/
public function setParent(Column $pParent = null)
{

View File

@ -154,7 +154,7 @@ class BaseDrawing implements IComparable
*
* @param string $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setName($pValue)
{
@ -178,7 +178,7 @@ class BaseDrawing implements IComparable
*
* @param string $description
*
* @return BaseDrawing
* @return $this
*/
public function setDescription($description)
{
@ -205,7 +205,7 @@ class BaseDrawing implements IComparable
*
* @throws PhpSpreadsheetException
*
* @return BaseDrawing
* @return $this
*/
public function setWorksheet(Worksheet $pValue = null, $pOverrideOld = false)
{
@ -253,7 +253,7 @@ class BaseDrawing implements IComparable
*
* @param string $pValue eg: 'A1'
*
* @return BaseDrawing
* @return $this
*/
public function setCoordinates($pValue)
{
@ -277,7 +277,7 @@ class BaseDrawing implements IComparable
*
* @param int $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setOffsetX($pValue)
{
@ -301,7 +301,7 @@ class BaseDrawing implements IComparable
*
* @param int $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setOffsetY($pValue)
{
@ -325,7 +325,7 @@ class BaseDrawing implements IComparable
*
* @param int $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setWidth($pValue)
{
@ -356,7 +356,7 @@ class BaseDrawing implements IComparable
*
* @param int $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setHeight($pValue)
{
@ -386,7 +386,7 @@ class BaseDrawing implements IComparable
* @param int $width
* @param int $height
*
* @return BaseDrawing
* @return $this
*/
public function setWidthAndHeight($width, $height)
{
@ -423,7 +423,7 @@ class BaseDrawing implements IComparable
*
* @param bool $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setResizeProportional($pValue)
{
@ -447,7 +447,7 @@ class BaseDrawing implements IComparable
*
* @param int $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setRotation($pValue)
{
@ -471,7 +471,7 @@ class BaseDrawing implements IComparable
*
* @param Drawing\Shadow $pValue
*
* @return BaseDrawing
* @return $this
*/
public function setShadow(Drawing\Shadow $pValue = null)
{

View File

@ -59,7 +59,7 @@ class ColumnCellIterator extends CellIterator
*
* @throws PhpSpreadsheetException
*
* @return ColumnCellIterator
* @return $this
*/
public function resetStart($startRow = 1)
{
@ -77,7 +77,7 @@ class ColumnCellIterator extends CellIterator
*
* @throws PhpSpreadsheetException
*
* @return ColumnCellIterator
* @return $this
*/
public function resetEnd($endRow = null)
{
@ -94,7 +94,7 @@ class ColumnCellIterator extends CellIterator
*
* @throws PhpSpreadsheetException
*
* @return ColumnCellIterator
* @return $this
*/
public function seek($row = 1)
{

View File

@ -56,7 +56,7 @@ class ColumnDimension extends Dimension
*
* @param string $pValue
*
* @return ColumnDimension
* @return $this
*/
public function setColumnIndex($pValue)
{
@ -80,7 +80,7 @@ class ColumnDimension extends Dimension
*
* @param float $pValue
*
* @return ColumnDimension
* @return $this
*/
public function setWidth($pValue)
{
@ -104,7 +104,7 @@ class ColumnDimension extends Dimension
*
* @param bool $pValue
*
* @return ColumnDimension
* @return $this
*/
public function setAutoSize($pValue)
{

View File

@ -66,7 +66,7 @@ class ColumnIterator implements \Iterator
*
* @throws Exception
*
* @return ColumnIterator
* @return $this
*/
public function resetStart($startColumn = 'A')
{
@ -89,7 +89,7 @@ class ColumnIterator implements \Iterator
*
* @param string $endColumn The column address at which to stop iterating
*
* @return ColumnIterator
* @return $this
*/
public function resetEnd($endColumn = null)
{
@ -106,7 +106,7 @@ class ColumnIterator implements \Iterator
*
* @throws PhpSpreadsheetException
*
* @return ColumnIterator
* @return $this
*/
public function seek($column = 'A')
{

View File

@ -60,7 +60,7 @@ abstract class Dimension
*
* @param bool $pValue
*
* @return Dimension
* @return $this
*/
public function setVisible($pValue)
{
@ -87,7 +87,7 @@ abstract class Dimension
*
* @throws PhpSpreadsheetException
*
* @return Dimension
* @return $this
*/
public function setOutlineLevel($pValue)
{
@ -115,7 +115,7 @@ abstract class Dimension
*
* @param bool $pValue
*
* @return Dimension
* @return $this
*/
public function setCollapsed($pValue)
{
@ -139,7 +139,7 @@ abstract class Dimension
*
* @param int $pValue
*
* @return Dimension
* @return $this
*/
public function setXfIndex($pValue)
{

View File

@ -78,7 +78,7 @@ class Drawing extends BaseDrawing
*
* @throws PhpSpreadsheetException
*
* @return Drawing
* @return $this
*/
public function setPath($pValue, $pVerifyFile = true)
{

View File

@ -100,7 +100,7 @@ class Shadow implements IComparable
*
* @param bool $pValue
*
* @return Shadow
* @return $this
*/
public function setVisible($pValue)
{
@ -124,7 +124,7 @@ class Shadow implements IComparable
*
* @param int $pValue
*
* @return Shadow
* @return $this
*/
public function setBlurRadius($pValue)
{
@ -148,7 +148,7 @@ class Shadow implements IComparable
*
* @param int $pValue
*
* @return Shadow
* @return $this
*/
public function setDistance($pValue)
{
@ -172,7 +172,7 @@ class Shadow implements IComparable
*
* @param int $pValue
*
* @return Shadow
* @return $this
*/
public function setDirection($pValue)
{
@ -196,7 +196,7 @@ class Shadow implements IComparable
*
* @param int $pValue
*
* @return Shadow
* @return $this
*/
public function setAlignment($pValue)
{
@ -220,7 +220,7 @@ class Shadow implements IComparable
*
* @param Color $pValue
*
* @return Shadow
* @return $this
*/
public function setColor(Color $pValue = null)
{
@ -244,7 +244,7 @@ class Shadow implements IComparable
*
* @param int $pValue
*
* @return Shadow
* @return $this
*/
public function setAlpha($pValue)
{

View File

@ -172,7 +172,7 @@ class HeaderFooter
*
* @param string $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setOddHeader($pValue)
{
@ -196,7 +196,7 @@ class HeaderFooter
*
* @param string $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setOddFooter($pValue)
{
@ -220,7 +220,7 @@ class HeaderFooter
*
* @param string $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setEvenHeader($pValue)
{
@ -244,7 +244,7 @@ class HeaderFooter
*
* @param string $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setEvenFooter($pValue)
{
@ -268,7 +268,7 @@ class HeaderFooter
*
* @param string $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setFirstHeader($pValue)
{
@ -292,7 +292,7 @@ class HeaderFooter
*
* @param string $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setFirstFooter($pValue)
{
@ -316,7 +316,7 @@ class HeaderFooter
*
* @param bool $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setDifferentOddEven($pValue)
{
@ -340,7 +340,7 @@ class HeaderFooter
*
* @param bool $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setDifferentFirst($pValue)
{
@ -364,7 +364,7 @@ class HeaderFooter
*
* @param bool $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setScaleWithDocument($pValue)
{
@ -388,7 +388,7 @@ class HeaderFooter
*
* @param bool $pValue
*
* @return HeaderFooter
* @return $this
*/
public function setAlignWithMargins($pValue)
{
@ -403,7 +403,7 @@ class HeaderFooter
* @param HeaderFooterDrawing $image
* @param string $location
*
* @return HeaderFooter
* @return $this
*/
public function addImage(HeaderFooterDrawing $image, $location = self::IMAGE_HEADER_LEFT)
{
@ -417,7 +417,7 @@ class HeaderFooter
*
* @param string $location
*
* @return HeaderFooter
* @return $this
*/
public function removeImage($location = self::IMAGE_HEADER_LEFT)
{
@ -433,7 +433,7 @@ class HeaderFooter
*
* @param HeaderFooterDrawing[] $images
*
* @return HeaderFooter
* @return $this
*/
public function setImages(array $images)
{

View File

@ -74,7 +74,7 @@ class MemoryDrawing extends BaseDrawing
*
* @param resource $value
*
* @return MemoryDrawing
* @return $this
*/
public function setImageResource($value)
{
@ -104,7 +104,7 @@ class MemoryDrawing extends BaseDrawing
*
* @param string $value see self::RENDERING_*
*
* @return MemoryDrawing
* @return $this
*/
public function setRenderingFunction($value)
{
@ -128,7 +128,7 @@ class MemoryDrawing extends BaseDrawing
*
* @param string $value see self::MIMETYPE_*
*
* @return MemoryDrawing
* @return $this
*/
public function setMimeType($value)
{

View File

@ -68,7 +68,7 @@ class PageMargins
*
* @param float $pValue
*
* @return PageMargins
* @return $this
*/
public function setLeft($pValue)
{
@ -92,7 +92,7 @@ class PageMargins
*
* @param float $pValue
*
* @return PageMargins
* @return $this
*/
public function setRight($pValue)
{
@ -116,7 +116,7 @@ class PageMargins
*
* @param float $pValue
*
* @return PageMargins
* @return $this
*/
public function setTop($pValue)
{
@ -140,7 +140,7 @@ class PageMargins
*
* @param float $pValue
*
* @return PageMargins
* @return $this
*/
public function setBottom($pValue)
{
@ -164,7 +164,7 @@ class PageMargins
*
* @param float $pValue
*
* @return PageMargins
* @return $this
*/
public function setHeader($pValue)
{
@ -188,7 +188,7 @@ class PageMargins
*
* @param float $pValue
*
* @return PageMargins
* @return $this
*/
public function setFooter($pValue)
{

View File

@ -180,7 +180,7 @@ class PageSetup
* Print scaling. Valid values range from 10 to 400
* This setting is overridden when fitToWidth and/or fitToHeight are in use
*
* @var int?
* @var null|int
*/
private $scale = 100;
@ -196,7 +196,7 @@ class PageSetup
* Fit To Height
* Number of vertical pages to fit on.
*
* @var int?
* @var null|int
*/
private $fitToHeight = 1;
@ -204,7 +204,7 @@ class PageSetup
* Fit To Width
* Number of horizontal pages to fit on.
*
* @var int?
* @var null|int
*/
private $fitToWidth = 1;
@ -272,7 +272,7 @@ class PageSetup
*
* @param int $pValue see self::PAPERSIZE_*
*
* @return PageSetup
* @return $this
*/
public function setPaperSize($pValue)
{
@ -296,7 +296,7 @@ class PageSetup
*
* @param string $pValue see self::ORIENTATION_*
*
* @return PageSetup
* @return $this
*/
public function setOrientation($pValue)
{
@ -308,7 +308,7 @@ class PageSetup
/**
* Get Scale.
*
* @return int?
* @return null|int
*/
public function getScale()
{
@ -325,7 +325,7 @@ class PageSetup
*
* @throws PhpSpreadsheetException
*
* @return PageSetup
* @return $this
*/
public function setScale($pValue, $pUpdate = true)
{
@ -358,7 +358,7 @@ class PageSetup
*
* @param bool $pValue
*
* @return PageSetup
* @return $this
*/
public function setFitToPage($pValue)
{
@ -370,7 +370,7 @@ class PageSetup
/**
* Get Fit To Height.
*
* @return int?
* @return null|int
*/
public function getFitToHeight()
{
@ -383,7 +383,7 @@ class PageSetup
* @param null|int $pValue
* @param bool $pUpdate Update fitToPage so it applies rather than scaling
*
* @return PageSetup
* @return $this
*/
public function setFitToHeight($pValue, $pUpdate = true)
{
@ -398,7 +398,7 @@ class PageSetup
/**
* Get Fit To Width.
*
* @return int?
* @return null|int
*/
public function getFitToWidth()
{
@ -411,7 +411,7 @@ class PageSetup
* @param null|int $pValue
* @param bool $pUpdate Update fitToPage so it applies rather than scaling
*
* @return PageSetup
* @return $this
*/
public function setFitToWidth($pValue, $pUpdate = true)
{
@ -454,7 +454,7 @@ class PageSetup
*
* @param array $pValue Containing start column and end column, empty array if option unset
*
* @return PageSetup
* @return $this
*/
public function setColumnsToRepeatAtLeft(array $pValue)
{
@ -469,7 +469,7 @@ class PageSetup
* @param string $pStart eg: 'A'
* @param string $pEnd eg: 'B'
*
* @return PageSetup
* @return $this
*/
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart, $pEnd)
{
@ -509,7 +509,7 @@ class PageSetup
*
* @param array $pValue Containing start column and end column, empty array if option unset
*
* @return PageSetup
* @return $this
*/
public function setRowsToRepeatAtTop(array $pValue)
{
@ -524,7 +524,7 @@ class PageSetup
* @param int $pStart eg: 1
* @param int $pEnd eg: 1
*
* @return PageSetup
* @return $this
*/
public function setRowsToRepeatAtTopByStartAndEnd($pStart, $pEnd)
{
@ -548,7 +548,7 @@ class PageSetup
*
* @param bool $value
*
* @return PageSetup
* @return $this
*/
public function setHorizontalCentered($value)
{
@ -572,7 +572,7 @@ class PageSetup
*
* @param bool $value
*
* @return PageSetup
* @return $this
*/
public function setVerticalCentered($value)
{
@ -634,7 +634,7 @@ class PageSetup
* Otherwise, the range identified by the value of $index will be removed from the series
* Print areas are numbered from 1
*
* @return PageSetup
* @return $this
*/
public function clearPrintArea($index = 0)
{
@ -671,7 +671,7 @@ class PageSetup
*
* @throws PhpSpreadsheetException
*
* @return PageSetup
* @return $this
*/
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
@ -732,7 +732,7 @@ class PageSetup
*
* @throws PhpSpreadsheetException
*
* @return PageSetup
* @return $this
*/
public function addPrintArea($value, $index = -1)
{
@ -762,7 +762,7 @@ class PageSetup
*
* @throws PhpSpreadsheetException
*
* @return PageSetup
* @return $this
*/
public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
@ -789,7 +789,7 @@ class PageSetup
*
* @throws PhpSpreadsheetException
*
* @return PageSetup
* @return $this
*/
public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1)
{
@ -815,7 +815,7 @@ class PageSetup
*
* @param int $value
*
* @return PageSetup
* @return $this
*/
public function setFirstPageNumber($value)
{
@ -827,7 +827,7 @@ class PageSetup
/**
* Reset first page number.
*
* @return PageSetup
* @return $this
*/
public function resetFirstPageNumber()
{

View File

@ -172,7 +172,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setSheet($pValue)
{
@ -196,7 +196,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setObjects($pValue)
{
@ -220,7 +220,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setScenarios($pValue)
{
@ -244,7 +244,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setFormatCells($pValue)
{
@ -268,7 +268,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setFormatColumns($pValue)
{
@ -292,7 +292,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setFormatRows($pValue)
{
@ -316,7 +316,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setInsertColumns($pValue)
{
@ -340,7 +340,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setInsertRows($pValue)
{
@ -364,7 +364,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setInsertHyperlinks($pValue)
{
@ -388,7 +388,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setDeleteColumns($pValue)
{
@ -412,7 +412,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setDeleteRows($pValue)
{
@ -436,7 +436,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setSelectLockedCells($pValue)
{
@ -460,7 +460,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setSort($pValue)
{
@ -484,7 +484,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setAutoFilter($pValue)
{
@ -508,7 +508,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setPivotTables($pValue)
{
@ -532,7 +532,7 @@ class Protection
*
* @param bool $pValue
*
* @return Protection
* @return $this
*/
public function setSelectUnlockedCells($pValue)
{
@ -557,7 +557,7 @@ class Protection
* @param string $pValue
* @param bool $pAlreadyHashed If the password has already been hashed, set this to true
*
* @return Protection
* @return $this
*/
public function setPassword($pValue, $pAlreadyHashed = false)
{

View File

@ -59,7 +59,7 @@ class RowCellIterator extends CellIterator
*
* @throws PhpSpreadsheetException
*
* @return RowCellIterator
* @return $this
*/
public function resetStart($startColumn = 'A')
{
@ -77,7 +77,7 @@ class RowCellIterator extends CellIterator
*
* @throws PhpSpreadsheetException
*
* @return RowCellIterator
* @return $this
*/
public function resetEnd($endColumn = null)
{
@ -95,7 +95,7 @@ class RowCellIterator extends CellIterator
*
* @throws PhpSpreadsheetException
*
* @return RowCellIterator
* @return $this
*/
public function seek($column = 'A')
{

View File

@ -56,7 +56,7 @@ class RowDimension extends Dimension
*
* @param int $pValue
*
* @return RowDimension
* @return $this
*/
public function setRowIndex($pValue)
{
@ -80,7 +80,7 @@ class RowDimension extends Dimension
*
* @param float $pValue
*
* @return RowDimension
* @return $this
*/
public function setRowHeight($pValue)
{
@ -104,7 +104,7 @@ class RowDimension extends Dimension
*
* @param bool $pValue
*
* @return RowDimension
* @return $this
*/
public function setZeroHeight($pValue)
{

View File

@ -64,7 +64,7 @@ class RowIterator implements \Iterator
*
* @throws PhpSpreadsheetException
*
* @return RowIterator
* @return $this
*/
public function resetStart($startRow = 1)
{
@ -86,7 +86,7 @@ class RowIterator implements \Iterator
*
* @param int $endRow The row number at which to stop iterating
*
* @return RowIterator
* @return $this
*/
public function resetEnd($endRow = null)
{
@ -102,7 +102,7 @@ class RowIterator implements \Iterator
*
* @throws PhpSpreadsheetException
*
* @return RowIterator
* @return $this
*/
public function seek($row = 1)
{

View File

@ -79,7 +79,7 @@ class SheetView
*
* @throws PhpSpreadsheetException
*
* @return SheetView
* @return $this
*/
public function setZoomScale($pValue)
{
@ -112,7 +112,7 @@ class SheetView
*
* @throws PhpSpreadsheetException
*
* @return SheetView
* @return $this
*/
public function setZoomScaleNormal($pValue)
{
@ -165,7 +165,7 @@ class SheetView
*
* @throws PhpSpreadsheetException
*
* @return SheetView
* @return $this
*/
public function setView($pValue)
{

View File

@ -647,7 +647,7 @@ class Worksheet implements IComparable
/**
* Refresh column dimensions.
*
* @return Worksheet
* @return $this
*/
public function refreshColumnDimensions()
{
@ -666,7 +666,7 @@ class Worksheet implements IComparable
/**
* Refresh row dimensions.
*
* @return Worksheet
* @return $this
*/
public function refreshRowDimensions()
{
@ -707,7 +707,7 @@ class Worksheet implements IComparable
/**
* Calculate widths for auto-size columns.
*
* @return Worksheet;
* @return $this
*/
public function calculateColumnWidths()
{
@ -797,7 +797,7 @@ class Worksheet implements IComparable
*
* @param Spreadsheet $parent
*
* @return Worksheet
* @return $this
*/
public function rebindParent(Spreadsheet $parent)
{
@ -838,7 +838,7 @@ class Worksheet implements IComparable
* @param bool $validate False to skip validation of new title. WARNING: This should only be set
* at parse time (by Readers), where titles can be assumed to be valid.
*
* @return Worksheet
* @return $this
*/
public function setTitle($pValue, $updateFormulaCellReferences = true, $validate = true)
{
@ -913,7 +913,7 @@ class Worksheet implements IComparable
*
* @param string $value Sheet state (visible, hidden, veryHidden)
*
* @return Worksheet
* @return $this
*/
public function setSheetState($value)
{
@ -937,7 +937,7 @@ class Worksheet implements IComparable
*
* @param PageSetup $pValue
*
* @return Worksheet
* @return $this
*/
public function setPageSetup(PageSetup $pValue)
{
@ -961,7 +961,7 @@ class Worksheet implements IComparable
*
* @param PageMargins $pValue
*
* @return Worksheet
* @return $this
*/
public function setPageMargins(PageMargins $pValue)
{
@ -985,7 +985,7 @@ class Worksheet implements IComparable
*
* @param HeaderFooter $pValue
*
* @return Worksheet
* @return $this
*/
public function setHeaderFooter(HeaderFooter $pValue)
{
@ -1009,7 +1009,7 @@ class Worksheet implements IComparable
*
* @param SheetView $pValue
*
* @return Worksheet
* @return $this
*/
public function setSheetView(SheetView $pValue)
{
@ -1033,7 +1033,7 @@ class Worksheet implements IComparable
*
* @param Protection $pValue
*
* @return Worksheet
* @return $this
*/
public function setProtection(Protection $pValue)
{
@ -1119,7 +1119,7 @@ class Worksheet implements IComparable
* @param string $pCoordinate Coordinate of the cell, eg: 'A1'
* @param mixed $pValue Value of the cell
*
* @return Worksheet
* @return $this
*/
public function setCellValue($pCoordinate, $pValue)
{
@ -1135,7 +1135,7 @@ class Worksheet implements IComparable
* @param int $row Numeric row coordinate of the cell
* @param mixed $value Value of the cell
*
* @return Worksheet
* @return $this
*/
public function setCellValueByColumnAndRow($columnIndex, $row, $value)
{
@ -1151,7 +1151,7 @@ class Worksheet implements IComparable
* @param mixed $pValue Value of the cell
* @param string $pDataType Explicit data type, see DataType::TYPE_*
*
* @return Worksheet
* @return $this
*/
public function setCellValueExplicit($pCoordinate, $pValue, $pDataType)
{
@ -1169,7 +1169,7 @@ class Worksheet implements IComparable
* @param mixed $value Value of the cell
* @param string $dataType Explicit data type, see DataType::TYPE_*
*
* @return Worksheet
* @return $this
*/
public function setCellValueExplicitByColumnAndRow($columnIndex, $row, $value, $dataType)
{
@ -1480,7 +1480,7 @@ class Worksheet implements IComparable
*
* @param string $pCoordinate eg: 'A1'
*
* @return Worksheet
* @return $this
*/
public function removeConditionalStyles($pCoordinate)
{
@ -1505,7 +1505,7 @@ class Worksheet implements IComparable
* @param string $pCoordinate eg: 'A1'
* @param $pValue Conditional[]
*
* @return Worksheet
* @return $this
*/
public function setConditionalStyles($pCoordinate, $pValue)
{
@ -1545,7 +1545,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function duplicateStyle(Style $pCellStyle, $pRange)
{
@ -1590,7 +1590,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function duplicateConditionalStyle(array $pCellStyle, $pRange = '')
{
@ -1628,7 +1628,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function setBreak($pCoordinate, $pBreak)
{
@ -1657,7 +1657,7 @@ class Worksheet implements IComparable
* @param int $row Numeric row coordinate of the cell
* @param int $break Break type (type of Worksheet::BREAK_*)
*
* @return Worksheet
* @return $this
*/
public function setBreakByColumnAndRow($columnIndex, $row, $break)
{
@ -1681,7 +1681,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function mergeCells($pRange)
{
@ -1726,7 +1726,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function mergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)
{
@ -1742,7 +1742,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function unmergeCells($pRange)
{
@ -1772,7 +1772,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function unmergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)
{
@ -1797,7 +1797,7 @@ class Worksheet implements IComparable
*
* @param array $pValue
*
* @return Worksheet
* @return $this
*/
public function setMergeCells(array $pValue)
{
@ -1813,7 +1813,7 @@ class Worksheet implements IComparable
* @param string $pPassword Password to unlock the protection
* @param bool $pAlreadyHashed If the password has already been hashed, set this to true
*
* @return Worksheet
* @return $this
*/
public function protectCells($pRange, $pPassword, $pAlreadyHashed = false)
{
@ -1838,7 +1838,7 @@ class Worksheet implements IComparable
* @param string $password Password to unlock the protection
* @param bool $alreadyHashed If the password has already been hashed, set this to true
*
* @return Worksheet
* @return $this
*/
public function protectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2, $password, $alreadyHashed = false)
{
@ -1854,7 +1854,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function unprotectCells($pRange)
{
@ -1880,7 +1880,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function unprotectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)
{
@ -1917,7 +1917,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function setAutoFilter($pValue)
{
@ -1940,7 +1940,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function setAutoFilterByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2)
{
@ -1954,7 +1954,7 @@ class Worksheet implements IComparable
/**
* Remove autofilter.
*
* @return Worksheet
* @return $this
*/
public function removeAutoFilter()
{
@ -1987,7 +1987,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function freezePane($cell, $topLeftCell = null)
{
@ -2012,7 +2012,7 @@ class Worksheet implements IComparable
* @param int $columnIndex Numeric column coordinate of the cell
* @param int $row Numeric row coordinate of the cell
*
* @return Worksheet
* @return $this
*/
public function freezePaneByColumnAndRow($columnIndex, $row)
{
@ -2022,7 +2022,7 @@ class Worksheet implements IComparable
/**
* Unfreeze Pane.
*
* @return Worksheet
* @return $this
*/
public function unfreezePane()
{
@ -2047,7 +2047,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function insertNewRowBefore($pBefore, $pNumRows = 1)
{
@ -2069,7 +2069,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function insertNewColumnBefore($pBefore, $pNumCols = 1)
{
@ -2091,7 +2091,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function insertNewColumnBeforeByIndex($beforeColumnIndex, $pNumCols = 1)
{
@ -2110,25 +2110,30 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function removeRow($pRow, $pNumRows = 1)
{
if ($pRow >= 1) {
for ($r = 0; $r < $pNumRows; ++$r) {
$this->getCellCollection()->removeRow($pRow + $r);
if ($pRow < 1) {
throw new Exception('Rows to be deleted should at least start from row 1.');
}
$highestRow = $this->getHighestDataRow();
$removedRowsCounter = 0;
for ($r = 0; $r < $pNumRows; ++$r) {
if ($pRow + $r <= $highestRow) {
$this->getCellCollection()->removeRow($pRow + $r);
++$removedRowsCounter;
}
}
$objReferenceHelper = ReferenceHelper::getInstance();
$objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
for ($r = 0; $r < $pNumRows; ++$r) {
for ($r = 0; $r < $removedRowsCounter; ++$r) {
$this->getCellCollection()->removeRow($highestRow);
--$highestRow;
}
} else {
throw new Exception('Rows to be deleted should at least start from row 1.');
}
return $this;
}
@ -2141,7 +2146,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function removeColumn($pColumn, $pNumCols = 1)
{
@ -2181,7 +2186,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function removeColumnByIndex($columnIndex, $numColumns = 1)
{
@ -2207,7 +2212,7 @@ class Worksheet implements IComparable
*
* @param bool $pValue Show gridlines (true/false)
*
* @return Worksheet
* @return $this
*/
public function setShowGridlines($pValue)
{
@ -2231,7 +2236,7 @@ class Worksheet implements IComparable
*
* @param bool $pValue Print gridlines (true/false)
*
* @return Worksheet
* @return $this
*/
public function setPrintGridlines($pValue)
{
@ -2255,7 +2260,7 @@ class Worksheet implements IComparable
*
* @param bool $pValue Show row and column headers (true/false)
*
* @return Worksheet
* @return $this
*/
public function setShowRowColHeaders($pValue)
{
@ -2279,7 +2284,7 @@ class Worksheet implements IComparable
*
* @param bool $pValue Show summary below (true/false)
*
* @return Worksheet
* @return $this
*/
public function setShowSummaryBelow($pValue)
{
@ -2303,7 +2308,7 @@ class Worksheet implements IComparable
*
* @param bool $pValue Show summary right (true/false)
*
* @return Worksheet
* @return $this
*/
public function setShowSummaryRight($pValue)
{
@ -2327,7 +2332,7 @@ class Worksheet implements IComparable
*
* @param Comment[] $pValue
*
* @return Worksheet
* @return $this
*/
public function setComments(array $pValue)
{
@ -2408,7 +2413,7 @@ class Worksheet implements IComparable
*
* @param string $pCoordinate Cell (i.e. A1)
*
* @return Worksheet
* @return $this
*/
public function setSelectedCell($pCoordinate)
{
@ -2420,7 +2425,7 @@ class Worksheet implements IComparable
*
* @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6'
*
* @return Worksheet
* @return $this
*/
public function setSelectedCells($pCoordinate)
{
@ -2458,7 +2463,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function setSelectedCellByColumnAndRow($columnIndex, $row)
{
@ -2480,7 +2485,7 @@ class Worksheet implements IComparable
*
* @param bool $value Right-to-left true/false
*
* @return Worksheet
* @return $this
*/
public function setRightToLeft($value)
{
@ -2499,7 +2504,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function fromArray(array $source, $nullValue = null, $startCell = 'A1', $strictNullComparison = false)
{
@ -2684,7 +2689,7 @@ class Worksheet implements IComparable
/**
* Run PhpSpreadsheet garbage collector.
*
* @return Worksheet
* @return $this
*/
public function garbageCollect()
{
@ -2784,7 +2789,7 @@ class Worksheet implements IComparable
* @param string $pCellCoordinate Cell coordinate to insert hyperlink, eg: 'A1'
* @param null|Hyperlink $pHyperlink
*
* @return Worksheet
* @return $this
*/
public function setHyperlink($pCellCoordinate, Hyperlink $pHyperlink = null)
{
@ -2845,7 +2850,7 @@ class Worksheet implements IComparable
* @param string $pCellCoordinate Cell coordinate to insert data validation, eg: 'A1'
* @param null|DataValidation $pDataValidation
*
* @return Worksheet
* @return $this
*/
public function setDataValidation($pCellCoordinate, DataValidation $pDataValidation = null)
{
@ -2933,7 +2938,7 @@ class Worksheet implements IComparable
/**
* Reset tab color.
*
* @return Worksheet
* @return $this
*/
public function resetTabColor()
{
@ -2956,7 +2961,7 @@ class Worksheet implements IComparable
/**
* Copy worksheet (!= clone!).
*
* @return Worksheet
* @return static
*/
public function copy()
{
@ -3007,7 +3012,7 @@ class Worksheet implements IComparable
*
* @throws Exception
*
* @return Worksheet
* @return $this
*/
public function setCodeName($pValue, $validate = true)
{

View File

@ -147,7 +147,7 @@ class Csv extends BaseWriter
*
* @param string $pValue Delimiter, defaults to ','
*
* @return CSV
* @return $this
*/
public function setDelimiter($pValue)
{
@ -171,7 +171,7 @@ class Csv extends BaseWriter
*
* @param string $pValue Enclosure, defaults to "
*
* @return CSV
* @return $this
*/
public function setEnclosure($pValue)
{
@ -198,7 +198,7 @@ class Csv extends BaseWriter
*
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
*
* @return CSV
* @return $this
*/
public function setLineEnding($pValue)
{
@ -222,7 +222,7 @@ class Csv extends BaseWriter
*
* @param bool $pValue Use UTF-8 byte-order mark? Defaults to false
*
* @return CSV
* @return $this
*/
public function setUseBOM($pValue)
{
@ -246,7 +246,7 @@ class Csv extends BaseWriter
*
* @param bool $pValue Use separator line? Defaults to false
*
* @return CSV
* @return $this
*/
public function setIncludeSeparatorLine($pValue)
{
@ -271,7 +271,7 @@ class Csv extends BaseWriter
* @param bool $pValue Set the file to be written as a fully Excel compatible csv file
* Note that this overrides other settings such as useBOM, enclosure and delimiter
*
* @return CSV
* @return $this
*/
public function setExcelCompatibility($pValue)
{
@ -295,7 +295,7 @@ class Csv extends BaseWriter
*
* @param int $pValue Sheet index
*
* @return CSV
* @return $this
*/
public function setSheetIndex($pValue)
{

View File

@ -297,7 +297,7 @@ class Html extends BaseWriter
*
* @param int $pValue Sheet index
*
* @return HTML
* @return $this
*/
public function setSheetIndex($pValue)
{
@ -321,7 +321,7 @@ class Html extends BaseWriter
*
* @param bool $pValue Flag indicating whether the sheet navigation block should be generated or not
*
* @return HTML
* @return $this
*/
public function setGenerateSheetNavigationBlock($pValue)
{
@ -332,6 +332,8 @@ class Html extends BaseWriter
/**
* Write all sheets (resets sheetIndex to NULL).
*
* @return $this
*/
public function writeAllSheets()
{
@ -1438,7 +1440,7 @@ class Html extends BaseWriter
*
* @param string $pValue
*
* @return HTML
* @return $this
*/
public function setImagesRoot($pValue)
{
@ -1462,7 +1464,7 @@ class Html extends BaseWriter
*
* @param bool $pValue
*
* @return HTML
* @return $this
*/
public function setEmbedImages($pValue)
{
@ -1486,7 +1488,7 @@ class Html extends BaseWriter
*
* @param bool $pValue
*
* @return HTML
* @return $this
*/
public function setUseInlineCss($pValue)
{
@ -1510,7 +1512,7 @@ class Html extends BaseWriter
*
* @param bool $pValue
*
* @return HTML
* @return $this
*/
public function setUseEmbeddedCSS($pValue)
{

View File

@ -167,7 +167,7 @@ class Ods extends BaseWriter
*
* @param Spreadsheet $spreadsheet PhpSpreadsheet object
*
* @return self
* @return $this
*/
public function setSpreadsheet(Spreadsheet $spreadsheet)
{

View File

@ -150,7 +150,7 @@ abstract class Pdf extends Html
*
* @param string $fontName
*
* @return Pdf
* @return $this
*/
public function setFont($fontName)
{

View File

@ -281,6 +281,10 @@ class Worksheet extends BIFFwriter
{
$phpSheet = $this->phpSheet;
// Storing selected cells and active sheet because it changes while parsing cells with formulas.
$selectedCells = $this->phpSheet->getSelectedCells();
$activeSheetIndex = $this->phpSheet->getParent()->getActiveSheetIndex();
// Write BOF record
$this->storeBof(0x0010);
@ -481,6 +485,9 @@ class Worksheet extends BIFFwriter
// Append
$this->writeMsoDrawing();
// Restoring active sheet.
$this->phpSheet->getParent()->setActiveSheetIndex($activeSheetIndex);
// Write WINDOW2 record
$this->writeWindow2();
@ -493,6 +500,9 @@ class Worksheet extends BIFFwriter
$this->writePanes();
}
// Restoring selected cells.
$this->phpSheet->setSelectedCells($selectedCells);
// Write SELECTION record
$this->writeSelection();
@ -1250,7 +1260,6 @@ class Worksheet extends BIFFwriter
$fFrozenNoSplit = 0; // 0 - bit
// no support in PhpSpreadsheet for selected sheet, therefore sheet is only selected if it is the active sheet
$fSelected = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0;
$fPaged = 1; // 2
$fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW;
$grbit = $fDspFmla;
@ -1262,8 +1271,8 @@ class Worksheet extends BIFFwriter
$grbit |= $fArabic << 6;
$grbit |= $fDspGuts << 7;
$grbit |= $fFrozenNoSplit << 8;
$grbit |= $fSelected << 9;
$grbit |= $fPaged << 10;
$grbit |= $fSelected << 9; // Selected sheets.
$grbit |= $fSelected << 10; // Active sheet.
$grbit |= $fPageBreakPreview << 11;
$header = pack('vv', $record, $length);

View File

@ -443,7 +443,7 @@ class Xlsx extends BaseWriter
*
* @param Spreadsheet $spreadsheet PhpSpreadsheet object
*
* @return Xlsx
* @return $this
*/
public function setSpreadsheet(Spreadsheet $spreadsheet)
{
@ -547,7 +547,7 @@ class Xlsx extends BaseWriter
*
* @param bool $pValue Office2003 compatibility?
*
* @return Xlsx
* @return $this
*/
public function setOffice2003Compatibility($pValue)
{

View File

@ -262,8 +262,6 @@ class Worksheet extends WriterPart
--$ySplit;
$topLeftCell = $pSheet->getTopLeftCell();
$activeCell = $topLeftCell;
$sqref = $topLeftCell;
// pane
$pane = 'topRight';

View File

@ -9,12 +9,12 @@ use PHPUnit\Framework\TestCase;
class CalculationTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
public function tearDown()
protected function tearDown(): void
{
$calculation = Calculation::getInstance();
$calculation->setLocale('en_us');

View File

@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase;
class FinancialTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
@ -21,7 +21,7 @@ class FinancialTest extends TestCase
public function testAMORDEGRC($expectedResult, ...$args)
{
$result = Financial::AMORDEGRC(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerAMORDEGRC()
@ -37,7 +37,7 @@ class FinancialTest extends TestCase
public function testAMORLINC($expectedResult, ...$args)
{
$result = Financial::AMORLINC(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerAMORLINC()
@ -53,7 +53,7 @@ class FinancialTest extends TestCase
public function testCOUPDAYBS($expectedResult, ...$args)
{
$result = Financial::COUPDAYBS(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCOUPDAYBS()
@ -69,7 +69,7 @@ class FinancialTest extends TestCase
public function testCOUPDAYS($expectedResult, ...$args)
{
$result = Financial::COUPDAYS(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCOUPDAYS()
@ -85,7 +85,7 @@ class FinancialTest extends TestCase
public function testCOUPDAYSNC($expectedResult, ...$args)
{
$result = Financial::COUPDAYSNC(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCOUPDAYSNC()
@ -101,7 +101,7 @@ class FinancialTest extends TestCase
public function testCOUPNCD($expectedResult, ...$args)
{
$result = Financial::COUPNCD(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCOUPNCD()
@ -117,7 +117,7 @@ class FinancialTest extends TestCase
public function testCOUPNUM($expectedResult, ...$args)
{
$result = Financial::COUPNUM(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCOUPNUM()
@ -133,7 +133,7 @@ class FinancialTest extends TestCase
public function testCOUPPCD($expectedResult, ...$args)
{
$result = Financial::COUPPCD(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCOUPPCD()
@ -149,7 +149,7 @@ class FinancialTest extends TestCase
public function testCUMIPMT($expectedResult, ...$args)
{
$result = Financial::CUMIPMT(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCUMIPMT()
@ -165,7 +165,7 @@ class FinancialTest extends TestCase
public function testCUMPRINC($expectedResult, ...$args)
{
$result = Financial::CUMPRINC(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerCUMPRINC()
@ -181,7 +181,7 @@ class FinancialTest extends TestCase
public function testDB($expectedResult, ...$args)
{
$result = Financial::DB(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDB()
@ -197,7 +197,7 @@ class FinancialTest extends TestCase
public function testDDB($expectedResult, ...$args)
{
$result = Financial::DDB(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDDB()
@ -213,7 +213,7 @@ class FinancialTest extends TestCase
public function testDISC($expectedResult, ...$args)
{
$result = Financial::DISC(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDISC()
@ -229,7 +229,7 @@ class FinancialTest extends TestCase
public function testDOLLARDE($expectedResult, ...$args)
{
$result = Financial::DOLLARDE(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDOLLARDE()
@ -245,7 +245,7 @@ class FinancialTest extends TestCase
public function testDOLLARFR($expectedResult, ...$args)
{
$result = Financial::DOLLARFR(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDOLLARFR()
@ -261,7 +261,7 @@ class FinancialTest extends TestCase
public function testEFFECT($expectedResult, ...$args)
{
$result = Financial::EFFECT(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerEFFECT()
@ -277,7 +277,7 @@ class FinancialTest extends TestCase
public function testFV($expectedResult, ...$args)
{
$result = Financial::FV(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerFV()
@ -293,7 +293,7 @@ class FinancialTest extends TestCase
public function testFVSCHEDULE($expectedResult, ...$args)
{
$result = Financial::FVSCHEDULE(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerFVSCHEDULE()
@ -309,7 +309,7 @@ class FinancialTest extends TestCase
public function testINTRATE($expectedResult, ...$args)
{
$result = Financial::INTRATE(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerINTRATE()
@ -325,7 +325,7 @@ class FinancialTest extends TestCase
public function testIPMT($expectedResult, ...$args)
{
$result = Financial::IPMT(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerIPMT()
@ -341,7 +341,7 @@ class FinancialTest extends TestCase
public function testIRR($expectedResult, ...$args)
{
$result = Financial::IRR(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerIRR()
@ -357,7 +357,7 @@ class FinancialTest extends TestCase
public function testISPMT($expectedResult, ...$args)
{
$result = Financial::ISPMT(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerISPMT()
@ -373,7 +373,7 @@ class FinancialTest extends TestCase
public function testMIRR($expectedResult, ...$args)
{
$result = Financial::MIRR(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerMIRR()
@ -389,7 +389,7 @@ class FinancialTest extends TestCase
public function testNOMINAL($expectedResult, ...$args)
{
$result = Financial::NOMINAL(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerNOMINAL()
@ -405,7 +405,7 @@ class FinancialTest extends TestCase
public function testNPER($expectedResult, ...$args)
{
$result = Financial::NPER(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerNPER()
@ -421,7 +421,7 @@ class FinancialTest extends TestCase
public function testNPV($expectedResult, ...$args)
{
$result = Financial::NPV(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerNPV()
@ -439,7 +439,7 @@ class FinancialTest extends TestCase
$this->markTestIncomplete('TODO: This test should be fixed');
$result = Financial::PRICE(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerPRICE()
@ -455,7 +455,7 @@ class FinancialTest extends TestCase
public function testPRICEDISC($expectedResult, array $args)
{
$result = Financial::PRICEDISC(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerPRICEDISC()
@ -471,7 +471,7 @@ class FinancialTest extends TestCase
public function testPV($expectedResult, array $args)
{
$result = Financial::PV(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerPV()
@ -489,7 +489,7 @@ class FinancialTest extends TestCase
$this->markTestIncomplete('TODO: This test should be fixed');
$result = Financial::RATE(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerRATE()
@ -506,7 +506,7 @@ class FinancialTest extends TestCase
public function testXIRR($expectedResult, $message, ...$args)
{
$result = Financial::XIRR(...$args);
self::assertEquals($expectedResult, $result, $message, Financial::FINANCIAL_PRECISION);
self::assertEqualsWithDelta($expectedResult, $result, Financial::FINANCIAL_PRECISION, $message);
}
public function providerXIRR()
@ -522,7 +522,7 @@ class FinancialTest extends TestCase
public function testPDURATION($expectedResult, array $args)
{
$result = Financial::PDURATION(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerPDURATION()
@ -538,7 +538,7 @@ class FinancialTest extends TestCase
public function testRRI($expectedResult, array $args)
{
$result = Financial::RRI(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerRRI()
@ -554,7 +554,7 @@ class FinancialTest extends TestCase
public function testSLN($expectedResult, array $args)
{
$result = Financial::SLN(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerSLN()
@ -570,7 +570,7 @@ class FinancialTest extends TestCase
public function testSYD($expectedResult, array $args)
{
$result = Financial::SYD(...$args);
self::assertEquals($expectedResult, $result, '', 1E-8);
self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerSYD()

View File

@ -0,0 +1,46 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\TestCase;
class FormulaAsStringTest extends TestCase
{
/**
* @dataProvider providerFunctionsAsString
*
* @param mixed $expectedResult
* @param string $formula
*/
public function testFunctionsAsString($expectedResult, $formula)
{
$spreadsheet = new Spreadsheet();
$workSheet = $spreadsheet->getActiveSheet();
$workSheet->setCellValue('A1', 10);
$workSheet->setCellValue('A2', 20);
$workSheet->setCellValue('A3', 30);
$workSheet->setCellValue('A4', 40);
$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('namedCell', $workSheet, 'A4'));
$workSheet->setCellValue('B1', 'uPPER');
$workSheet->setCellValue('B2', '=TRUE()');
$workSheet->setCellValue('B3', '=FALSE()');
$ws2 = $spreadsheet->createSheet();
$ws2->setCellValue('A1', 100);
$ws2->setCellValue('A2', 200);
$ws2->setTitle('Sheet2');
$spreadsheet->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('A2B', $ws2, 'A2'));
$spreadsheet->setActiveSheetIndex(0);
$cell2 = $workSheet->getCell('D1');
$cell2->setValue($formula);
$result = $cell2->getCalculatedValue();
self::assertEquals($expectedResult, $result);
}
public function providerFunctionsAsString()
{
return require 'data/Calculation/FunctionsAsString.php';
}
}

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class DateDifTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -27,7 +27,7 @@ class DateDifTest extends TestCase
public function testDATEDIF($expectedResult, $startDate, $endDate, $unit)
{
$result = DateTime::DATEDIF($startDate, $endDate, $unit);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDATEDIF()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class DateTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -27,7 +27,7 @@ class DateTest extends TestCase
public function testDATE($expectedResult, $year, $month, $day)
{
$result = DateTime::DATE($year, $month, $day);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDATE()
@ -40,7 +40,8 @@ class DateTest extends TestCase
Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP);
$result = DateTime::DATE(2012, 1, 31);
$this->assertEquals(1327968000, $result, '', 1E-8);
$this->assertEquals(1327968000, $result);
$this->assertEqualsWithDelta(1327968000, $result, 1E-8);
}
public function testDATEtoDateTimeObject()

View File

@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
class DateValueTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -26,7 +26,7 @@ class DateValueTest extends TestCase
public function testDATEVALUE($expectedResult, $dateValue)
{
$result = DateTime::DATEVALUE($dateValue);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDATEVALUE()
@ -39,7 +39,8 @@ class DateValueTest extends TestCase
Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP);
$result = DateTime::DATEVALUE('2012-1-31');
$this->assertEquals(1327968000, $result, '', 1E-8);
$this->assertEquals(1327968000, $result);
$this->assertEqualsWithDelta(1327968000, $result, 1E-8);
}
public function testDATEVALUEtoDateTimeObject()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class DayTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -26,12 +26,12 @@ class DayTest extends TestCase
public function testDAY($expectedResultExcel, $expectedResultOpenOffice, $dateTimeValue)
{
$resultExcel = DateTime::DAYOFMONTH($dateTimeValue);
$this->assertEquals($expectedResultExcel, $resultExcel, '', 1E-8);
$this->assertEqualsWithDelta($expectedResultExcel, $resultExcel, 1E-8);
Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
$resultOpenOffice = DateTime::DAYOFMONTH($dateTimeValue);
$this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, '', 1E-8);
$this->assertEqualsWithDelta($expectedResultOpenOffice, $resultOpenOffice, 1E-8);
}
public function providerDAY()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class Days360Test extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -27,7 +27,7 @@ class Days360Test extends TestCase
public function testDAYS360($expectedResult, $startDate, $endDate, $method)
{
$result = DateTime::DAYS360($startDate, $endDate, $method);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDAYS360()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class DaysTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -26,7 +26,7 @@ class DaysTest extends TestCase
public function testDAYS($expectedResult, $endDate, $startDate)
{
$result = DateTime::DAYS($endDate, $startDate);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerDAYS()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class EDateTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -26,7 +26,7 @@ class EDateTest extends TestCase
public function testEDATE($expectedResult, $dateValue, $adjustmentMonths)
{
$result = DateTime::EDATE($dateValue, $adjustmentMonths);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerEDATE()
@ -39,7 +39,8 @@ class EDateTest extends TestCase
Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP);
$result = DateTime::EDATE('2012-1-26', -1);
$this->assertEquals(1324857600, $result, '', 1E-8);
$this->assertEquals(1324857600, $result);
$this->assertEqualsWithDelta(1324857600, $result, 1E-8);
}
public function testEDATEtoDateTimeObject()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class EoMonthTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -26,7 +26,7 @@ class EoMonthTest extends TestCase
public function testEOMONTH($expectedResult, $dateValue, $adjustmentMonths)
{
$result = DateTime::EOMONTH($dateValue, $adjustmentMonths);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerEOMONTH()
@ -39,7 +39,8 @@ class EoMonthTest extends TestCase
Functions::setReturnDateType(Functions::RETURNDATE_UNIX_TIMESTAMP);
$result = DateTime::EOMONTH('2012-1-26', -1);
$this->assertEquals(1325289600, $result, '', 1E-8);
$this->assertEquals(1325289600, $result);
$this->assertEqualsWithDelta(1325289600, $result, 1E-8);
}
public function testEOMONTHtoDateTimeObject()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class HourTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -25,7 +25,7 @@ class HourTest extends TestCase
public function testHOUR($expectedResult, $dateTimeValue)
{
$result = DateTime::HOUROFDAY($dateTimeValue);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerHOUR()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class IsoWeekNumTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -25,7 +25,7 @@ class IsoWeekNumTest extends TestCase
public function testISOWEEKNUM($expectedResult, $dateValue)
{
$result = DateTime::ISOWEEKNUM($dateValue);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerISOWEEKNUM()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class MinuteTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -25,7 +25,7 @@ class MinuteTest extends TestCase
public function testMINUTE($expectedResult, $dateTimeValue)
{
$result = DateTime::MINUTE($dateTimeValue);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerMINUTE()

View File

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
class MonthTest extends TestCase
{
public function setUp()
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
@ -25,7 +25,7 @@ class MonthTest extends TestCase
public function testMONTH($expectedResult, $dateTimeValue)
{
$result = DateTime::MONTHOFYEAR($dateTimeValue);
$this->assertEquals($expectedResult, $result, '', 1E-8);
$this->assertEqualsWithDelta($expectedResult, $result, 1E-8);
}
public function providerMONTH()

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