Merge pull request #1385 from ikeyan/feature/update-document

Update docs/references/function-list-by-*.md
This commit is contained in:
Adrien Crivelli 2020-03-07 09:25:16 +07:00 committed by GitHub
commit 560e672b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 343 additions and 43 deletions

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

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

View File

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

View File

@ -1042,6 +1042,11 @@ class Calculation
'functionCall' => [Logical::class, 'IFNA'], 'functionCall' => [Logical::class, 'IFNA'],
'argumentCount' => '2', 'argumentCount' => '2',
], ],
'IFS' => [
'category' => Category::CATEGORY_LOGICAL,
'functionCall' => [Functions::class, 'DUMMY'],
'argumentCount' => '2+',
],
'IMABS' => [ 'IMABS' => [
'category' => Category::CATEGORY_ENGINEERING, 'category' => Category::CATEGORY_ENGINEERING,
'functionCall' => [Engineering::class, 'IMABS'], 'functionCall' => [Engineering::class, 'IMABS'],
@ -1498,7 +1503,12 @@ class Calculation
'NETWORKDAYS' => [ 'NETWORKDAYS' => [
'category' => Category::CATEGORY_DATE_AND_TIME, 'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'NETWORKDAYS'], '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' => [ 'NOMINAL' => [
'category' => Category::CATEGORY_FINANCIAL, 'category' => Category::CATEGORY_FINANCIAL,
@ -2167,7 +2177,12 @@ class Calculation
'WORKDAY' => [ 'WORKDAY' => [
'category' => Category::CATEGORY_DATE_AND_TIME, 'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'WORKDAY'], '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' => [ 'XIRR' => [
'category' => Category::CATEGORY_FINANCIAL, 'category' => Category::CATEGORY_FINANCIAL,

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

@ -0,0 +1,145 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests;
use PhpOffice\PhpSpreadsheet\Calculation\Category as Cat;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Logical;
use PhpOffice\PhpSpreadsheet\DocumentGenerator;
use PHPUnit\Framework\TestCase;
class DocumentGeneratorTest extends TestCase
{
/**
* @dataProvider providerGenerateFunctionListByName
*
* @param array $phpSpreadsheetFunctions
* @param string $expected
*
* @throws \ReflectionException
*/
public function testGenerateFunctionListByName(array $phpSpreadsheetFunctions, string $expected): void
{
self::assertEquals($expected, DocumentGenerator::generateFunctionListByName($phpSpreadsheetFunctions));
}
/**
* @dataProvider providerGenerateFunctionListByCategory
*
* @param array $phpSpreadsheetFunctions
* @param string $expected
*
* @throws \ReflectionException
*/
public function testGenerateFunctionListByCategory(array $phpSpreadsheetFunctions, string $expected): void
{
self::assertEquals($expected, DocumentGenerator::generateFunctionListByCategory($phpSpreadsheetFunctions));
}
public function providerGenerateFunctionListByName(): array
{
return [
[
[
'ABS' => ['category' => Cat::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'abs'],
'AND' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Logical::class, 'logicalAnd']],
'IFS' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Functions::class, 'DUMMY']],
],
<<<'EXPECTED'
# Function list by name
## A
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
ABS | CATEGORY_MATH_AND_TRIG | abs
AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
## I
Excel Function | Category | PhpSpreadsheet Function
--------------------|--------------------------------|-------------------------------------------
IFS | CATEGORY_LOGICAL | **Not yet Implemented**
EXPECTED
],
];
}
public function providerGenerateFunctionListByCategory(): array
{
return [
[
[
'ABS' => ['category' => Cat::CATEGORY_MATH_AND_TRIG, 'functionCall' => 'abs'],
'AND' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Logical::class, 'logicalAnd']],
'IFS' => ['category' => Cat::CATEGORY_LOGICAL, 'functionCall' => [Functions::class, 'DUMMY']],
],
<<<'EXPECTED'
# Function list by category
## CATEGORY_CUBE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_DATABASE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_DATE_AND_TIME
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_ENGINEERING
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_FINANCIAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_INFORMATION
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_LOGICAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd
IFS | **Not yet Implemented**
## CATEGORY_LOOKUP_AND_REFERENCE
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_MATH_AND_TRIG
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
ABS | abs
## CATEGORY_STATISTICAL
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
## CATEGORY_TEXT_AND_DATA
Excel Function | PhpSpreadsheet Function
--------------------|-------------------------------------------
EXPECTED
],
];
}
}