34 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../');
35 require(PHPEXCEL_ROOT .
'PHPExcel/Autoloader.php');
39if (!
defined(
'CALCULATION_REGEXP_CELLREF')) {
41 if(
defined(
'PREG_BAD_UTF8_ERROR')) {
43 define(
'CALCULATION_REGEXP_CELLREF',
'((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})');
45 define(
'CALCULATION_REGEXP_NAMEDRANGE',
'((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)');
48 define(
'CALCULATION_REGEXP_CELLREF',
'(((\w*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+)');
50 define(
'CALCULATION_REGEXP_NAMEDRANGE',
'(((\w*)|(\'.*\')|(\".*\"))!)?([_A-Z][_A-Z0-9\.]*)');
140 private static $_operators = array(
'+' => TRUE,
'-' => TRUE,
'*' => TRUE,
'/' => TRUE,
141 '^' => TRUE,
'&' => TRUE,
'%' => FALSE,
'~' => FALSE,
142 '>' => TRUE,
'<' => TRUE,
'=' => TRUE,
'>=' => TRUE,
143 '<=' => TRUE,
'<>' => TRUE,
'|' => TRUE,
':' => TRUE
154 '^' => TRUE,
'&' => TRUE,
'>' => TRUE,
'<' => TRUE,
155 '=' => TRUE,
'>=' => TRUE,
'<=' => TRUE,
'<>' => TRUE,
156 '|' => TRUE,
':' => TRUE
281 'functionCall' =>
'abs',
282 'argumentCount' =>
'1'
285 'functionCall' =>
'PHPExcel_Calculation_Financial::ACCRINT',
286 'argumentCount' =>
'4-7'
289 'functionCall' =>
'PHPExcel_Calculation_Financial::ACCRINTM',
290 'argumentCount' =>
'3-5'
293 'functionCall' =>
'acos',
294 'argumentCount' =>
'1'
297 'functionCall' =>
'acosh',
298 'argumentCount' =>
'1'
301 'functionCall' =>
'PHPExcel_Calculation_LookupRef::CELL_ADDRESS',
302 'argumentCount' =>
'2-5'
305 'functionCall' =>
'PHPExcel_Calculation_Financial::AMORDEGRC',
306 'argumentCount' =>
'6,7'
309 'functionCall' =>
'PHPExcel_Calculation_Financial::AMORLINC',
310 'argumentCount' =>
'6,7'
313 'functionCall' =>
'PHPExcel_Calculation_Logical::LOGICAL_AND',
314 'argumentCount' =>
'1+'
317 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
318 'argumentCount' =>
'1'
321 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
322 'argumentCount' =>
'1'
325 'functionCall' =>
'asin',
326 'argumentCount' =>
'1'
329 'functionCall' =>
'asinh',
330 'argumentCount' =>
'1'
333 'functionCall' =>
'atan',
334 'argumentCount' =>
'1'
337 'functionCall' =>
'PHPExcel_Calculation_MathTrig::ATAN2',
338 'argumentCount' =>
'2'
341 'functionCall' =>
'atanh',
342 'argumentCount' =>
'1'
345 'functionCall' =>
'PHPExcel_Calculation_Statistical::AVEDEV',
346 'argumentCount' =>
'1+'
349 'functionCall' =>
'PHPExcel_Calculation_Statistical::AVERAGE',
350 'argumentCount' =>
'1+'
353 'functionCall' =>
'PHPExcel_Calculation_Statistical::AVERAGEA',
354 'argumentCount' =>
'1+'
357 'functionCall' =>
'PHPExcel_Calculation_Statistical::AVERAGEIF',
358 'argumentCount' =>
'2,3'
361 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
362 'argumentCount' =>
'3+'
365 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
366 'argumentCount' =>
'1'
369 'functionCall' =>
'PHPExcel_Calculation_Engineering::BESSELI',
370 'argumentCount' =>
'2'
373 'functionCall' =>
'PHPExcel_Calculation_Engineering::BESSELJ',
374 'argumentCount' =>
'2'
377 'functionCall' =>
'PHPExcel_Calculation_Engineering::BESSELK',
378 'argumentCount' =>
'2'
381 'functionCall' =>
'PHPExcel_Calculation_Engineering::BESSELY',
382 'argumentCount' =>
'2'
385 'functionCall' =>
'PHPExcel_Calculation_Statistical::BETADIST',
386 'argumentCount' =>
'3-5'
389 'functionCall' =>
'PHPExcel_Calculation_Statistical::BETAINV',
390 'argumentCount' =>
'3-5'
393 'functionCall' =>
'PHPExcel_Calculation_Engineering::BINTODEC',
394 'argumentCount' =>
'1'
397 'functionCall' =>
'PHPExcel_Calculation_Engineering::BINTOHEX',
398 'argumentCount' =>
'1,2'
401 'functionCall' =>
'PHPExcel_Calculation_Engineering::BINTOOCT',
402 'argumentCount' =>
'1,2'
405 'functionCall' =>
'PHPExcel_Calculation_Statistical::BINOMDIST',
406 'argumentCount' =>
'4'
409 'functionCall' =>
'PHPExcel_Calculation_MathTrig::CEILING',
410 'argumentCount' =>
'2'
413 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
414 'argumentCount' =>
'1,2'
417 'functionCall' =>
'PHPExcel_Calculation_TextData::CHARACTER',
418 'argumentCount' =>
'1'
421 'functionCall' =>
'PHPExcel_Calculation_Statistical::CHIDIST',
422 'argumentCount' =>
'2'
425 'functionCall' =>
'PHPExcel_Calculation_Statistical::CHIINV',
426 'argumentCount' =>
'2'
429 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
430 'argumentCount' =>
'2'
433 'functionCall' =>
'PHPExcel_Calculation_LookupRef::CHOOSE',
434 'argumentCount' =>
'2+'
437 'functionCall' =>
'PHPExcel_Calculation_TextData::TRIMNONPRINTABLE',
438 'argumentCount' =>
'1'
441 'functionCall' =>
'PHPExcel_Calculation_TextData::ASCIICODE',
442 'argumentCount' =>
'1'
445 'functionCall' =>
'PHPExcel_Calculation_LookupRef::COLUMN',
446 'argumentCount' =>
'-1',
447 'passByReference' => array(TRUE)
450 'functionCall' =>
'PHPExcel_Calculation_LookupRef::COLUMNS',
451 'argumentCount' =>
'1'
454 'functionCall' =>
'PHPExcel_Calculation_MathTrig::COMBIN',
455 'argumentCount' =>
'2'
458 'functionCall' =>
'PHPExcel_Calculation_Engineering::COMPLEX',
459 'argumentCount' =>
'2,3'
462 'functionCall' =>
'PHPExcel_Calculation_TextData::CONCATENATE',
463 'argumentCount' =>
'1+'
466 'functionCall' =>
'PHPExcel_Calculation_Statistical::CONFIDENCE',
467 'argumentCount' =>
'3'
470 'functionCall' =>
'PHPExcel_Calculation_Engineering::CONVERTUOM',
471 'argumentCount' =>
'3'
474 'functionCall' =>
'PHPExcel_Calculation_Statistical::CORREL',
475 'argumentCount' =>
'2'
478 'functionCall' =>
'cos',
479 'argumentCount' =>
'1'
482 'functionCall' =>
'cosh',
483 'argumentCount' =>
'1'
486 'functionCall' =>
'PHPExcel_Calculation_Statistical::COUNT',
487 'argumentCount' =>
'1+'
490 'functionCall' =>
'PHPExcel_Calculation_Statistical::COUNTA',
491 'argumentCount' =>
'1+'
494 'functionCall' =>
'PHPExcel_Calculation_Statistical::COUNTBLANK',
495 'argumentCount' =>
'1'
498 'functionCall' =>
'PHPExcel_Calculation_Statistical::COUNTIF',
499 'argumentCount' =>
'2'
502 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
503 'argumentCount' =>
'2'
506 'functionCall' =>
'PHPExcel_Calculation_Financial::COUPDAYBS',
507 'argumentCount' =>
'3,4'
510 'functionCall' =>
'PHPExcel_Calculation_Financial::COUPDAYS',
511 'argumentCount' =>
'3,4'
514 'functionCall' =>
'PHPExcel_Calculation_Financial::COUPDAYSNC',
515 'argumentCount' =>
'3,4'
518 'functionCall' =>
'PHPExcel_Calculation_Financial::COUPNCD',
519 'argumentCount' =>
'3,4'
522 'functionCall' =>
'PHPExcel_Calculation_Financial::COUPNUM',
523 'argumentCount' =>
'3,4'
526 'functionCall' =>
'PHPExcel_Calculation_Financial::COUPPCD',
527 'argumentCount' =>
'3,4'
530 'functionCall' =>
'PHPExcel_Calculation_Statistical::COVAR',
531 'argumentCount' =>
'2'
534 'functionCall' =>
'PHPExcel_Calculation_Statistical::CRITBINOM',
535 'argumentCount' =>
'3'
538 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
539 'argumentCount' =>
'?'
542 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
543 'argumentCount' =>
'?'
546 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
547 'argumentCount' =>
'?'
550 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
551 'argumentCount' =>
'?'
554 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
555 'argumentCount' =>
'?'
558 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
559 'argumentCount' =>
'?'
562 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
563 'argumentCount' =>
'?'
566 'functionCall' =>
'PHPExcel_Calculation_Financial::CUMIPMT',
567 'argumentCount' =>
'6'
570 'functionCall' =>
'PHPExcel_Calculation_Financial::CUMPRINC',
571 'argumentCount' =>
'6'
574 'functionCall' =>
'PHPExcel_Calculation_DateTime::DATE',
575 'argumentCount' =>
'3'
578 'functionCall' =>
'PHPExcel_Calculation_DateTime::DATEDIF',
579 'argumentCount' =>
'2,3'
582 'functionCall' =>
'PHPExcel_Calculation_DateTime::DATEVALUE',
583 'argumentCount' =>
'1'
586 'functionCall' =>
'PHPExcel_Calculation_Database::DAVERAGE',
587 'argumentCount' =>
'3'
590 'functionCall' =>
'PHPExcel_Calculation_DateTime::DAYOFMONTH',
591 'argumentCount' =>
'1'
594 'functionCall' =>
'PHPExcel_Calculation_DateTime::DAYS360',
595 'argumentCount' =>
'2,3'
598 'functionCall' =>
'PHPExcel_Calculation_Financial::DB',
599 'argumentCount' =>
'4,5'
602 'functionCall' =>
'PHPExcel_Calculation_Database::DCOUNT',
603 'argumentCount' =>
'3'
606 'functionCall' =>
'PHPExcel_Calculation_Database::DCOUNTA',
607 'argumentCount' =>
'3'
610 'functionCall' =>
'PHPExcel_Calculation_Financial::DDB',
611 'argumentCount' =>
'4,5'
614 'functionCall' =>
'PHPExcel_Calculation_Engineering::DECTOBIN',
615 'argumentCount' =>
'1,2'
618 'functionCall' =>
'PHPExcel_Calculation_Engineering::DECTOHEX',
619 'argumentCount' =>
'1,2'
622 'functionCall' =>
'PHPExcel_Calculation_Engineering::DECTOOCT',
623 'argumentCount' =>
'1,2'
626 'functionCall' =>
'rad2deg',
627 'argumentCount' =>
'1'
630 'functionCall' =>
'PHPExcel_Calculation_Engineering::DELTA',
631 'argumentCount' =>
'1,2'
634 'functionCall' =>
'PHPExcel_Calculation_Statistical::DEVSQ',
635 'argumentCount' =>
'1+'
638 'functionCall' =>
'PHPExcel_Calculation_Database::DGET',
639 'argumentCount' =>
'3'
642 'functionCall' =>
'PHPExcel_Calculation_Financial::DISC',
643 'argumentCount' =>
'4,5'
646 'functionCall' =>
'PHPExcel_Calculation_Database::DMAX',
647 'argumentCount' =>
'3'
650 'functionCall' =>
'PHPExcel_Calculation_Database::DMIN',
651 'argumentCount' =>
'3'
654 'functionCall' =>
'PHPExcel_Calculation_TextData::DOLLAR',
655 'argumentCount' =>
'1,2'
658 'functionCall' =>
'PHPExcel_Calculation_Financial::DOLLARDE',
659 'argumentCount' =>
'2'
662 'functionCall' =>
'PHPExcel_Calculation_Financial::DOLLARFR',
663 'argumentCount' =>
'2'
666 'functionCall' =>
'PHPExcel_Calculation_Database::DPRODUCT',
667 'argumentCount' =>
'3'
670 'functionCall' =>
'PHPExcel_Calculation_Database::DSTDEV',
671 'argumentCount' =>
'3'
674 'functionCall' =>
'PHPExcel_Calculation_Database::DSTDEVP',
675 'argumentCount' =>
'3'
678 'functionCall' =>
'PHPExcel_Calculation_Database::DSUM',
679 'argumentCount' =>
'3'
682 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
683 'argumentCount' =>
'5,6'
686 'functionCall' =>
'PHPExcel_Calculation_Database::DVAR',
687 'argumentCount' =>
'3'
690 'functionCall' =>
'PHPExcel_Calculation_Database::DVARP',
691 'argumentCount' =>
'3'
694 'functionCall' =>
'PHPExcel_Calculation_DateTime::EDATE',
695 'argumentCount' =>
'2'
698 'functionCall' =>
'PHPExcel_Calculation_Financial::EFFECT',
699 'argumentCount' =>
'2'
702 'functionCall' =>
'PHPExcel_Calculation_DateTime::EOMONTH',
703 'argumentCount' =>
'2'
706 'functionCall' =>
'PHPExcel_Calculation_Engineering::ERF',
707 'argumentCount' =>
'1,2'
710 'functionCall' =>
'PHPExcel_Calculation_Engineering::ERFC',
711 'argumentCount' =>
'1'
714 'functionCall' =>
'PHPExcel_Calculation_Functions::ERROR_TYPE',
715 'argumentCount' =>
'1'
718 'functionCall' =>
'PHPExcel_Calculation_MathTrig::EVEN',
719 'argumentCount' =>
'1'
722 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
723 'argumentCount' =>
'2'
726 'functionCall' =>
'exp',
727 'argumentCount' =>
'1'
730 'functionCall' =>
'PHPExcel_Calculation_Statistical::EXPONDIST',
731 'argumentCount' =>
'3'
734 'functionCall' =>
'PHPExcel_Calculation_MathTrig::FACT',
735 'argumentCount' =>
'1'
738 'functionCall' =>
'PHPExcel_Calculation_MathTrig::FACTDOUBLE',
739 'argumentCount' =>
'1'
742 'functionCall' =>
'PHPExcel_Calculation_Logical::FALSE',
743 'argumentCount' =>
'0'
746 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
747 'argumentCount' =>
'3'
750 'functionCall' =>
'PHPExcel_Calculation_TextData::SEARCHSENSITIVE',
751 'argumentCount' =>
'2,3'
754 'functionCall' =>
'PHPExcel_Calculation_TextData::SEARCHSENSITIVE',
755 'argumentCount' =>
'2,3'
758 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
759 'argumentCount' =>
'3'
762 'functionCall' =>
'PHPExcel_Calculation_Statistical::FISHER',
763 'argumentCount' =>
'1'
766 'functionCall' =>
'PHPExcel_Calculation_Statistical::FISHERINV',
767 'argumentCount' =>
'1'
770 'functionCall' =>
'PHPExcel_Calculation_TextData::FIXEDFORMAT',
771 'argumentCount' =>
'1-3'
774 'functionCall' =>
'PHPExcel_Calculation_MathTrig::FLOOR',
775 'argumentCount' =>
'2'
778 'functionCall' =>
'PHPExcel_Calculation_Statistical::FORECAST',
779 'argumentCount' =>
'3'
782 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
783 'argumentCount' =>
'2'
786 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
787 'argumentCount' =>
'2'
790 'functionCall' =>
'PHPExcel_Calculation_Financial::FV',
791 'argumentCount' =>
'3-5'
794 'functionCall' =>
'PHPExcel_Calculation_Financial::FVSCHEDULE',
795 'argumentCount' =>
'2'
798 'functionCall' =>
'PHPExcel_Calculation_Statistical::GAMMADIST',
799 'argumentCount' =>
'4'
802 'functionCall' =>
'PHPExcel_Calculation_Statistical::GAMMAINV',
803 'argumentCount' =>
'3'
806 'functionCall' =>
'PHPExcel_Calculation_Statistical::GAMMALN',
807 'argumentCount' =>
'1'
810 'functionCall' =>
'PHPExcel_Calculation_MathTrig::GCD',
811 'argumentCount' =>
'1+'
814 'functionCall' =>
'PHPExcel_Calculation_Statistical::GEOMEAN',
815 'argumentCount' =>
'1+'
818 'functionCall' =>
'PHPExcel_Calculation_Engineering::GESTEP',
819 'argumentCount' =>
'1,2'
822 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
823 'argumentCount' =>
'2+'
826 'functionCall' =>
'PHPExcel_Calculation_Statistical::GROWTH',
827 'argumentCount' =>
'1-4'
830 'functionCall' =>
'PHPExcel_Calculation_Statistical::HARMEAN',
831 'argumentCount' =>
'1+'
834 'functionCall' =>
'PHPExcel_Calculation_Engineering::HEXTOBIN',
835 'argumentCount' =>
'1,2'
838 'functionCall' =>
'PHPExcel_Calculation_Engineering::HEXTODEC',
839 'argumentCount' =>
'1'
842 'functionCall' =>
'PHPExcel_Calculation_Engineering::HEXTOOCT',
843 'argumentCount' =>
'1,2'
846 'functionCall' =>
'PHPExcel_Calculation_LookupRef::HLOOKUP',
847 'argumentCount' =>
'3,4'
850 'functionCall' =>
'PHPExcel_Calculation_DateTime::HOUROFDAY',
851 'argumentCount' =>
'1'
854 'functionCall' =>
'PHPExcel_Calculation_LookupRef::HYPERLINK',
855 'argumentCount' =>
'1,2',
856 'passCellReference'=> TRUE
859 'functionCall' =>
'PHPExcel_Calculation_Statistical::HYPGEOMDIST',
860 'argumentCount' =>
'4'
863 'functionCall' =>
'PHPExcel_Calculation_Logical::STATEMENT_IF',
864 'argumentCount' =>
'1-3'
867 'functionCall' =>
'PHPExcel_Calculation_Logical::IFERROR',
868 'argumentCount' =>
'2'
871 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMABS',
872 'argumentCount' =>
'1'
875 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMAGINARY',
876 'argumentCount' =>
'1'
879 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMARGUMENT',
880 'argumentCount' =>
'1'
883 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMCONJUGATE',
884 'argumentCount' =>
'1'
887 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMCOS',
888 'argumentCount' =>
'1'
891 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMDIV',
892 'argumentCount' =>
'2'
895 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMEXP',
896 'argumentCount' =>
'1'
899 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMLN',
900 'argumentCount' =>
'1'
903 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMLOG10',
904 'argumentCount' =>
'1'
907 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMLOG2',
908 'argumentCount' =>
'1'
911 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMPOWER',
912 'argumentCount' =>
'2'
915 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMPRODUCT',
916 'argumentCount' =>
'1+'
919 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMREAL',
920 'argumentCount' =>
'1'
923 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMSIN',
924 'argumentCount' =>
'1'
927 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMSQRT',
928 'argumentCount' =>
'1'
931 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMSUB',
932 'argumentCount' =>
'2'
935 'functionCall' =>
'PHPExcel_Calculation_Engineering::IMSUM',
936 'argumentCount' =>
'1+'
939 'functionCall' =>
'PHPExcel_Calculation_LookupRef::INDEX',
940 'argumentCount' =>
'1-4'
943 'functionCall' =>
'PHPExcel_Calculation_LookupRef::INDIRECT',
944 'argumentCount' =>
'1,2',
945 'passCellReference'=> TRUE
948 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
949 'argumentCount' =>
'1'
952 'functionCall' =>
'PHPExcel_Calculation_MathTrig::INT',
953 'argumentCount' =>
'1'
956 'functionCall' =>
'PHPExcel_Calculation_Statistical::INTERCEPT',
957 'argumentCount' =>
'2'
960 'functionCall' =>
'PHPExcel_Calculation_Financial::INTRATE',
961 'argumentCount' =>
'4,5'
964 'functionCall' =>
'PHPExcel_Calculation_Financial::IPMT',
965 'argumentCount' =>
'4-6'
968 'functionCall' =>
'PHPExcel_Calculation_Financial::IRR',
969 'argumentCount' =>
'1,2'
972 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_BLANK',
973 'argumentCount' =>
'1'
976 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_ERR',
977 'argumentCount' =>
'1'
980 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_ERROR',
981 'argumentCount' =>
'1'
984 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_EVEN',
985 'argumentCount' =>
'1'
988 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_LOGICAL',
989 'argumentCount' =>
'1'
992 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_NA',
993 'argumentCount' =>
'1'
996 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_NONTEXT',
997 'argumentCount' =>
'1'
1000 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_NUMBER',
1001 'argumentCount' =>
'1'
1004 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_ODD',
1005 'argumentCount' =>
'1'
1008 'functionCall' =>
'PHPExcel_Calculation_Financial::ISPMT',
1009 'argumentCount' =>
'4'
1012 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1013 'argumentCount' =>
'1'
1016 'functionCall' =>
'PHPExcel_Calculation_Functions::IS_TEXT',
1017 'argumentCount' =>
'1'
1020 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1021 'argumentCount' =>
'1'
1024 'functionCall' =>
'PHPExcel_Calculation_Statistical::KURT',
1025 'argumentCount' =>
'1+'
1028 'functionCall' =>
'PHPExcel_Calculation_Statistical::LARGE',
1029 'argumentCount' =>
'2'
1032 'functionCall' =>
'PHPExcel_Calculation_MathTrig::LCM',
1033 'argumentCount' =>
'1+'
1036 'functionCall' =>
'PHPExcel_Calculation_TextData::LEFT',
1037 'argumentCount' =>
'1,2'
1040 'functionCall' =>
'PHPExcel_Calculation_TextData::LEFT',
1041 'argumentCount' =>
'1,2'
1044 'functionCall' =>
'PHPExcel_Calculation_TextData::STRINGLENGTH',
1045 'argumentCount' =>
'1'
1048 'functionCall' =>
'PHPExcel_Calculation_TextData::STRINGLENGTH',
1049 'argumentCount' =>
'1'
1052 'functionCall' =>
'PHPExcel_Calculation_Statistical::LINEST',
1053 'argumentCount' =>
'1-4'
1056 'functionCall' =>
'log',
1057 'argumentCount' =>
'1'
1060 'functionCall' =>
'PHPExcel_Calculation_MathTrig::LOG_BASE',
1061 'argumentCount' =>
'1,2'
1064 'functionCall' =>
'log10',
1065 'argumentCount' =>
'1'
1068 'functionCall' =>
'PHPExcel_Calculation_Statistical::LOGEST',
1069 'argumentCount' =>
'1-4'
1072 'functionCall' =>
'PHPExcel_Calculation_Statistical::LOGINV',
1073 'argumentCount' =>
'3'
1076 'functionCall' =>
'PHPExcel_Calculation_Statistical::LOGNORMDIST',
1077 'argumentCount' =>
'3'
1080 'functionCall' =>
'PHPExcel_Calculation_LookupRef::LOOKUP',
1081 'argumentCount' =>
'2,3'
1084 'functionCall' =>
'PHPExcel_Calculation_TextData::LOWERCASE',
1085 'argumentCount' =>
'1'
1088 'functionCall' =>
'PHPExcel_Calculation_LookupRef::MATCH',
1089 'argumentCount' =>
'2,3'
1092 'functionCall' =>
'PHPExcel_Calculation_Statistical::MAX',
1093 'argumentCount' =>
'1+'
1096 'functionCall' =>
'PHPExcel_Calculation_Statistical::MAXA',
1097 'argumentCount' =>
'1+'
1100 'functionCall' =>
'PHPExcel_Calculation_Statistical::MAXIF',
1101 'argumentCount' =>
'2+'
1104 'functionCall' =>
'PHPExcel_Calculation_MathTrig::MDETERM',
1105 'argumentCount' =>
'1'
1108 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1109 'argumentCount' =>
'5,6'
1112 'functionCall' =>
'PHPExcel_Calculation_Statistical::MEDIAN',
1113 'argumentCount' =>
'1+'
1116 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1117 'argumentCount' =>
'2+'
1120 'functionCall' =>
'PHPExcel_Calculation_TextData::MID',
1121 'argumentCount' =>
'3'
1124 'functionCall' =>
'PHPExcel_Calculation_TextData::MID',
1125 'argumentCount' =>
'3'
1128 'functionCall' =>
'PHPExcel_Calculation_Statistical::MIN',
1129 'argumentCount' =>
'1+'
1132 'functionCall' =>
'PHPExcel_Calculation_Statistical::MINA',
1133 'argumentCount' =>
'1+'
1136 'functionCall' =>
'PHPExcel_Calculation_Statistical::MINIF',
1137 'argumentCount' =>
'2+'
1140 'functionCall' =>
'PHPExcel_Calculation_DateTime::MINUTEOFHOUR',
1141 'argumentCount' =>
'1'
1144 'functionCall' =>
'PHPExcel_Calculation_MathTrig::MINVERSE',
1145 'argumentCount' =>
'1'
1148 'functionCall' =>
'PHPExcel_Calculation_Financial::MIRR',
1149 'argumentCount' =>
'3'
1152 'functionCall' =>
'PHPExcel_Calculation_MathTrig::MMULT',
1153 'argumentCount' =>
'2'
1156 'functionCall' =>
'PHPExcel_Calculation_MathTrig::MOD',
1157 'argumentCount' =>
'2'
1160 'functionCall' =>
'PHPExcel_Calculation_Statistical::MODE',
1161 'argumentCount' =>
'1+'
1164 'functionCall' =>
'PHPExcel_Calculation_DateTime::MONTHOFYEAR',
1165 'argumentCount' =>
'1'
1168 'functionCall' =>
'PHPExcel_Calculation_MathTrig::MROUND',
1169 'argumentCount' =>
'2'
1172 'functionCall' =>
'PHPExcel_Calculation_MathTrig::MULTINOMIAL',
1173 'argumentCount' =>
'1+'
1176 'functionCall' =>
'PHPExcel_Calculation_Functions::N',
1177 'argumentCount' =>
'1'
1180 'functionCall' =>
'PHPExcel_Calculation_Functions::NA',
1181 'argumentCount' =>
'0'
1184 'functionCall' =>
'PHPExcel_Calculation_Statistical::NEGBINOMDIST',
1185 'argumentCount' =>
'3'
1188 'functionCall' =>
'PHPExcel_Calculation_DateTime::NETWORKDAYS',
1189 'argumentCount' =>
'2+'
1192 'functionCall' =>
'PHPExcel_Calculation_Financial::NOMINAL',
1193 'argumentCount' =>
'2'
1196 'functionCall' =>
'PHPExcel_Calculation_Statistical::NORMDIST',
1197 'argumentCount' =>
'4'
1200 'functionCall' =>
'PHPExcel_Calculation_Statistical::NORMINV',
1201 'argumentCount' =>
'3'
1204 'functionCall' =>
'PHPExcel_Calculation_Statistical::NORMSDIST',
1205 'argumentCount' =>
'1'
1208 'functionCall' =>
'PHPExcel_Calculation_Statistical::NORMSINV',
1209 'argumentCount' =>
'1'
1212 'functionCall' =>
'PHPExcel_Calculation_Logical::NOT',
1213 'argumentCount' =>
'1'
1216 'functionCall' =>
'PHPExcel_Calculation_DateTime::DATETIMENOW',
1217 'argumentCount' =>
'0'
1220 'functionCall' =>
'PHPExcel_Calculation_Financial::NPER',
1221 'argumentCount' =>
'3-5'
1224 'functionCall' =>
'PHPExcel_Calculation_Financial::NPV',
1225 'argumentCount' =>
'2+'
1228 'functionCall' =>
'PHPExcel_Calculation_Engineering::OCTTOBIN',
1229 'argumentCount' =>
'1,2'
1232 'functionCall' =>
'PHPExcel_Calculation_Engineering::OCTTODEC',
1233 'argumentCount' =>
'1'
1236 'functionCall' =>
'PHPExcel_Calculation_Engineering::OCTTOHEX',
1237 'argumentCount' =>
'1,2'
1240 'functionCall' =>
'PHPExcel_Calculation_MathTrig::ODD',
1241 'argumentCount' =>
'1'
1244 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1245 'argumentCount' =>
'8,9'
1248 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1249 'argumentCount' =>
'8,9'
1252 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1253 'argumentCount' =>
'7,8'
1256 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1257 'argumentCount' =>
'7,8'
1260 'functionCall' =>
'PHPExcel_Calculation_LookupRef::OFFSET',
1261 'argumentCount' =>
'3,5',
1262 'passCellReference'=> TRUE,
1263 'passByReference' => array(TRUE)
1266 'functionCall' =>
'PHPExcel_Calculation_Logical::LOGICAL_OR',
1267 'argumentCount' =>
'1+'
1270 'functionCall' =>
'PHPExcel_Calculation_Statistical::CORREL',
1271 'argumentCount' =>
'2'
1274 'functionCall' =>
'PHPExcel_Calculation_Statistical::PERCENTILE',
1275 'argumentCount' =>
'2'
1278 'functionCall' =>
'PHPExcel_Calculation_Statistical::PERCENTRANK',
1279 'argumentCount' =>
'2,3'
1282 'functionCall' =>
'PHPExcel_Calculation_Statistical::PERMUT',
1283 'argumentCount' =>
'2'
1286 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1287 'argumentCount' =>
'1'
1290 'functionCall' =>
'pi',
1291 'argumentCount' =>
'0'
1294 'functionCall' =>
'PHPExcel_Calculation_Financial::PMT',
1295 'argumentCount' =>
'3-5'
1298 'functionCall' =>
'PHPExcel_Calculation_Statistical::POISSON',
1299 'argumentCount' =>
'3'
1302 'functionCall' =>
'PHPExcel_Calculation_MathTrig::POWER',
1303 'argumentCount' =>
'2'
1306 'functionCall' =>
'PHPExcel_Calculation_Financial::PPMT',
1307 'argumentCount' =>
'4-6'
1310 'functionCall' =>
'PHPExcel_Calculation_Financial::PRICE',
1311 'argumentCount' =>
'6,7'
1314 'functionCall' =>
'PHPExcel_Calculation_Financial::PRICEDISC',
1315 'argumentCount' =>
'4,5'
1318 'functionCall' =>
'PHPExcel_Calculation_Financial::PRICEMAT',
1319 'argumentCount' =>
'5,6'
1322 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1323 'argumentCount' =>
'3,4'
1326 'functionCall' =>
'PHPExcel_Calculation_MathTrig::PRODUCT',
1327 'argumentCount' =>
'1+'
1330 'functionCall' =>
'PHPExcel_Calculation_TextData::PROPERCASE',
1331 'argumentCount' =>
'1'
1334 'functionCall' =>
'PHPExcel_Calculation_Financial::PV',
1335 'argumentCount' =>
'3-5'
1338 'functionCall' =>
'PHPExcel_Calculation_Statistical::QUARTILE',
1339 'argumentCount' =>
'2'
1342 'functionCall' =>
'PHPExcel_Calculation_MathTrig::QUOTIENT',
1343 'argumentCount' =>
'2'
1346 'functionCall' =>
'deg2rad',
1347 'argumentCount' =>
'1'
1350 'functionCall' =>
'PHPExcel_Calculation_MathTrig::RAND',
1351 'argumentCount' =>
'0'
1354 'functionCall' =>
'PHPExcel_Calculation_MathTrig::RAND',
1355 'argumentCount' =>
'2'
1358 'functionCall' =>
'PHPExcel_Calculation_Statistical::RANK',
1359 'argumentCount' =>
'2,3'
1362 'functionCall' =>
'PHPExcel_Calculation_Financial::RATE',
1363 'argumentCount' =>
'3-6'
1366 'functionCall' =>
'PHPExcel_Calculation_Financial::RECEIVED',
1367 'argumentCount' =>
'4-5'
1370 'functionCall' =>
'PHPExcel_Calculation_TextData::REPLACE',
1371 'argumentCount' =>
'4'
1374 'functionCall' =>
'PHPExcel_Calculation_TextData::REPLACE',
1375 'argumentCount' =>
'4'
1378 'functionCall' =>
'str_repeat',
1379 'argumentCount' =>
'2'
1382 'functionCall' =>
'PHPExcel_Calculation_TextData::RIGHT',
1383 'argumentCount' =>
'1,2'
1386 'functionCall' =>
'PHPExcel_Calculation_TextData::RIGHT',
1387 'argumentCount' =>
'1,2'
1390 'functionCall' =>
'PHPExcel_Calculation_MathTrig::ROMAN',
1391 'argumentCount' =>
'1,2'
1394 'functionCall' =>
'round',
1395 'argumentCount' =>
'2'
1398 'functionCall' =>
'PHPExcel_Calculation_MathTrig::ROUNDDOWN',
1399 'argumentCount' =>
'2'
1402 'functionCall' =>
'PHPExcel_Calculation_MathTrig::ROUNDUP',
1403 'argumentCount' =>
'2'
1406 'functionCall' =>
'PHPExcel_Calculation_LookupRef::ROW',
1407 'argumentCount' =>
'-1',
1408 'passByReference' => array(TRUE)
1411 'functionCall' =>
'PHPExcel_Calculation_LookupRef::ROWS',
1412 'argumentCount' =>
'1'
1415 'functionCall' =>
'PHPExcel_Calculation_Statistical::RSQ',
1416 'argumentCount' =>
'2'
1419 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1420 'argumentCount' =>
'1+'
1423 'functionCall' =>
'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE',
1424 'argumentCount' =>
'2,3'
1427 'functionCall' =>
'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE',
1428 'argumentCount' =>
'2,3'
1431 'functionCall' =>
'PHPExcel_Calculation_DateTime::SECONDOFMINUTE',
1432 'argumentCount' =>
'1'
1435 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SERIESSUM',
1436 'argumentCount' =>
'4'
1439 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SIGN',
1440 'argumentCount' =>
'1'
1443 'functionCall' =>
'sin',
1444 'argumentCount' =>
'1'
1447 'functionCall' =>
'sinh',
1448 'argumentCount' =>
'1'
1451 'functionCall' =>
'PHPExcel_Calculation_Statistical::SKEW',
1452 'argumentCount' =>
'1+'
1455 'functionCall' =>
'PHPExcel_Calculation_Financial::SLN',
1456 'argumentCount' =>
'3'
1459 'functionCall' =>
'PHPExcel_Calculation_Statistical::SLOPE',
1460 'argumentCount' =>
'2'
1463 'functionCall' =>
'PHPExcel_Calculation_Statistical::SMALL',
1464 'argumentCount' =>
'2'
1467 'functionCall' =>
'sqrt',
1468 'argumentCount' =>
'1'
1471 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SQRTPI',
1472 'argumentCount' =>
'1'
1475 'functionCall' =>
'PHPExcel_Calculation_Statistical::STANDARDIZE',
1476 'argumentCount' =>
'3'
1479 'functionCall' =>
'PHPExcel_Calculation_Statistical::STDEV',
1480 'argumentCount' =>
'1+'
1483 'functionCall' =>
'PHPExcel_Calculation_Statistical::STDEVA',
1484 'argumentCount' =>
'1+'
1487 'functionCall' =>
'PHPExcel_Calculation_Statistical::STDEVP',
1488 'argumentCount' =>
'1+'
1491 'functionCall' =>
'PHPExcel_Calculation_Statistical::STDEVPA',
1492 'argumentCount' =>
'1+'
1495 'functionCall' =>
'PHPExcel_Calculation_Statistical::STEYX',
1496 'argumentCount' =>
'2'
1499 'functionCall' =>
'PHPExcel_Calculation_TextData::SUBSTITUTE',
1500 'argumentCount' =>
'3,4'
1503 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUBTOTAL',
1504 'argumentCount' =>
'2+'
1507 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUM',
1508 'argumentCount' =>
'1+'
1511 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUMIF',
1512 'argumentCount' =>
'2,3'
1515 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1516 'argumentCount' =>
'?'
1519 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUMPRODUCT',
1520 'argumentCount' =>
'1+'
1523 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUMSQ',
1524 'argumentCount' =>
'1+'
1527 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUMX2MY2',
1528 'argumentCount' =>
'2'
1531 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUMX2PY2',
1532 'argumentCount' =>
'2'
1535 'functionCall' =>
'PHPExcel_Calculation_MathTrig::SUMXMY2',
1536 'argumentCount' =>
'2'
1539 'functionCall' =>
'PHPExcel_Calculation_Financial::SYD',
1540 'argumentCount' =>
'4'
1543 'functionCall' =>
'PHPExcel_Calculation_TextData::RETURNSTRING',
1544 'argumentCount' =>
'1'
1547 'functionCall' =>
'tan',
1548 'argumentCount' =>
'1'
1551 'functionCall' =>
'tanh',
1552 'argumentCount' =>
'1'
1555 'functionCall' =>
'PHPExcel_Calculation_Financial::TBILLEQ',
1556 'argumentCount' =>
'3'
1559 'functionCall' =>
'PHPExcel_Calculation_Financial::TBILLPRICE',
1560 'argumentCount' =>
'3'
1563 'functionCall' =>
'PHPExcel_Calculation_Financial::TBILLYIELD',
1564 'argumentCount' =>
'3'
1567 'functionCall' =>
'PHPExcel_Calculation_Statistical::TDIST',
1568 'argumentCount' =>
'3'
1571 'functionCall' =>
'PHPExcel_Calculation_TextData::TEXTFORMAT',
1572 'argumentCount' =>
'2'
1575 'functionCall' =>
'PHPExcel_Calculation_DateTime::TIME',
1576 'argumentCount' =>
'3'
1579 'functionCall' =>
'PHPExcel_Calculation_DateTime::TIMEVALUE',
1580 'argumentCount' =>
'1'
1583 'functionCall' =>
'PHPExcel_Calculation_Statistical::TINV',
1584 'argumentCount' =>
'2'
1587 'functionCall' =>
'PHPExcel_Calculation_DateTime::DATENOW',
1588 'argumentCount' =>
'0'
1591 'functionCall' =>
'PHPExcel_Calculation_LookupRef::TRANSPOSE',
1592 'argumentCount' =>
'1'
1595 'functionCall' =>
'PHPExcel_Calculation_Statistical::TREND',
1596 'argumentCount' =>
'1-4'
1599 'functionCall' =>
'PHPExcel_Calculation_TextData::TRIMSPACES',
1600 'argumentCount' =>
'1'
1603 'functionCall' =>
'PHPExcel_Calculation_Statistical::TRIMMEAN',
1604 'argumentCount' =>
'2'
1607 'functionCall' =>
'PHPExcel_Calculation_Logical::TRUE',
1608 'argumentCount' =>
'0'
1611 'functionCall' =>
'PHPExcel_Calculation_MathTrig::TRUNC',
1612 'argumentCount' =>
'1,2'
1615 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1616 'argumentCount' =>
'4'
1619 'functionCall' =>
'PHPExcel_Calculation_Functions::TYPE',
1620 'argumentCount' =>
'1'
1623 'functionCall' =>
'PHPExcel_Calculation_TextData::UPPERCASE',
1624 'argumentCount' =>
'1'
1627 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1628 'argumentCount' =>
'2'
1631 'functionCall' =>
'PHPExcel_Calculation_TextData::VALUE',
1632 'argumentCount' =>
'1'
1635 'functionCall' =>
'PHPExcel_Calculation_Statistical::VARFunc',
1636 'argumentCount' =>
'1+'
1639 'functionCall' =>
'PHPExcel_Calculation_Statistical::VARA',
1640 'argumentCount' =>
'1+'
1643 'functionCall' =>
'PHPExcel_Calculation_Statistical::VARP',
1644 'argumentCount' =>
'1+'
1647 'functionCall' =>
'PHPExcel_Calculation_Statistical::VARPA',
1648 'argumentCount' =>
'1+'
1651 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1652 'argumentCount' =>
'5-7'
1655 'functionCall' =>
'PHPExcel_Calculation_Functions::VERSION',
1656 'argumentCount' =>
'0'
1659 'functionCall' =>
'PHPExcel_Calculation_LookupRef::VLOOKUP',
1660 'argumentCount' =>
'3,4'
1663 'functionCall' =>
'PHPExcel_Calculation_DateTime::DAYOFWEEK',
1664 'argumentCount' =>
'1,2'
1667 'functionCall' =>
'PHPExcel_Calculation_DateTime::WEEKOFYEAR',
1668 'argumentCount' =>
'1,2'
1671 'functionCall' =>
'PHPExcel_Calculation_Statistical::WEIBULL',
1672 'argumentCount' =>
'4'
1675 'functionCall' =>
'PHPExcel_Calculation_DateTime::WORKDAY',
1676 'argumentCount' =>
'2+'
1679 'functionCall' =>
'PHPExcel_Calculation_Financial::XIRR',
1680 'argumentCount' =>
'2,3'
1683 'functionCall' =>
'PHPExcel_Calculation_Financial::XNPV',
1684 'argumentCount' =>
'3'
1687 'functionCall' =>
'PHPExcel_Calculation_DateTime::YEAR',
1688 'argumentCount' =>
'1'
1691 'functionCall' =>
'PHPExcel_Calculation_DateTime::YEARFRAC',
1692 'argumentCount' =>
'2,3'
1695 'functionCall' =>
'PHPExcel_Calculation_Functions::DUMMY',
1696 'argumentCount' =>
'6,7'
1699 'functionCall' =>
'PHPExcel_Calculation_Financial::YIELDDISC',
1700 'argumentCount' =>
'4,5'
1703 'functionCall' =>
'PHPExcel_Calculation_Financial::YIELDMAT',
1704 'argumentCount' =>
'5,6'
1707 'functionCall' =>
'PHPExcel_Calculation_Statistical::ZTEST',
1708 'argumentCount' =>
'2-3'
1715 'MKMATRIX' => array(
'argumentCount' =>
'*',
1716 'functionCall' =>
'self::_mkMatrix'
1724 $setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16;
1725 $this->_savedPrecision = ini_get(
'precision');
1726 if ($this->_savedPrecision < $setPrecision) {
1727 ini_set(
'precision',$setPrecision);
1729 $this->delta = 1 * pow(10, -$setPrecision);
1731 if ($workbook !== NULL) {
1732 self::$_workbookSets[$workbook->getID()] = $this;
1735 $this->_workbook = $workbook;
1742 if ($this->_savedPrecision != ini_get(
'precision')) {
1743 ini_set(
'precision',$this->_savedPrecision);
1748 $localeFileDirectory = PHPEXCEL_ROOT.
'PHPExcel/locale/';
1749 foreach (glob($localeFileDirectory.
'/*',GLOB_ONLYDIR) as
$filename) {
1752 self::$_validLocaleLanguages[] =
$filename;
1766 if ($workbook !== NULL) {
1767 if (isset(self::$_workbookSets[$workbook->getID()])) {
1768 return self::$_workbookSets[$workbook->getID()];
1773 if (!isset(self::$_instance) || (self::$_instance === NULL)) {
1787 if ($workbook !== NULL) {
1788 if (isset(self::$_workbookSets[$workbook->getID()])) {
1789 unset(self::$_workbookSets[$workbook->getID()]);
1813 return $this->_debugLog;
1834 return self::$_localeBoolean[
'TRUE'];
1844 return self::$_localeBoolean[
'FALSE'];
1855 if (($returnType == self::RETURN_ARRAY_AS_VALUE) ||
1856 ($returnType == self::RETURN_ARRAY_AS_ERROR) ||
1857 ($returnType == self::RETURN_ARRAY_AS_ARRAY)) {
1858 self::$returnArrayAsType = $returnType;
1893 $this->_calculationCacheEnabled = $pValue;
1918 $this->_calculationCache = array();
1927 if (isset($this->_calculationCache[$worksheetName])) {
1928 unset($this->_calculationCache[$worksheetName]);
1939 if (isset($this->_calculationCache[$fromWorksheetName])) {
1940 $this->_calculationCache[$toWorksheetName] = &$this->_calculationCache[$fromWorksheetName];
1941 unset($this->_calculationCache[$fromWorksheetName]);
1964 $language = $locale = strtolower($locale);
1965 if (strpos($locale,
'_') !== FALSE) {
1966 list($language) = explode(
'_',$locale);
1969 if (count(self::$_validLocaleLanguages) == 1)
1973 if (in_array($language,self::$_validLocaleLanguages)) {
1975 self::$_localeFunctions = array();
1976 self::$_localeArgumentSeparator =
',';
1977 self::$_localeBoolean = array(
'TRUE' =>
'TRUE',
'FALSE' =>
'FALSE',
'NULL' =>
'NULL');
1979 if ($locale !=
'en_us') {
1981 $functionNamesFile = PHPEXCEL_ROOT .
'PHPExcel'.DIRECTORY_SEPARATOR.
'locale'.DIRECTORY_SEPARATOR.str_replace(
'_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.
'functions';
1982 if (!file_exists($functionNamesFile)) {
1984 $functionNamesFile = PHPEXCEL_ROOT .
'PHPExcel'.DIRECTORY_SEPARATOR.
'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.
'functions';
1985 if (!file_exists($functionNamesFile)) {
1990 $localeFunctions = file($functionNamesFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
1991 foreach ($localeFunctions as $localeFunction) {
1992 list($localeFunction) = explode(
'##',$localeFunction);
1993 if (strpos($localeFunction,
'=') !== FALSE) {
1994 list($fName,$lfName) = explode(
'=',$localeFunction);
1995 $fName = trim($fName);
1996 $lfName = trim($lfName);
1997 if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName !=
'') && ($fName != $lfName)) {
1998 self::$_localeFunctions[$fName] = $lfName;
2003 if (isset(self::$_localeFunctions[
'TRUE'])) { self::$_localeBoolean[
'TRUE'] = self::$_localeFunctions[
'TRUE']; }
2004 if (isset(self::$_localeFunctions[
'FALSE'])) { self::$_localeBoolean[
'FALSE'] = self::$_localeFunctions[
'FALSE']; }
2006 $configFile = PHPEXCEL_ROOT .
'PHPExcel'.DIRECTORY_SEPARATOR.
'locale'.DIRECTORY_SEPARATOR.str_replace(
'_',DIRECTORY_SEPARATOR,$locale).DIRECTORY_SEPARATOR.
'config';
2007 if (!file_exists($configFile)) {
2008 $configFile = PHPEXCEL_ROOT .
'PHPExcel'.DIRECTORY_SEPARATOR.
'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.
'config';
2010 if (file_exists($configFile)) {
2011 $localeSettings = file($configFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
2012 foreach ($localeSettings as $localeSetting) {
2013 list($localeSetting) = explode(
'##',$localeSetting);
2014 if (strpos($localeSetting,
'=') !== FALSE) {
2015 list($settingName,$settingValue) = explode(
'=',$localeSetting);
2016 $settingName = strtoupper(trim($settingName));
2017 switch ($settingName) {
2018 case 'ARGUMENTSEPARATOR' :
2019 self::$_localeArgumentSeparator = trim($settingValue);
2027 self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
2028 self::$functionReplaceFromLocale = self::$functionReplaceToLocale = NULL;
2029 self::$_localeLanguage = $locale;
2038 $strlen = mb_strlen($formula);
2039 for ($i = 0; $i < $strlen; ++$i) {
2040 $chr = mb_substr($formula,$i,1);
2042 case '{' : $inBraces = TRUE;
2044 case '}' : $inBraces = FALSE;
2046 case $fromSeparator :
2048 $formula = mb_substr($formula,0,$i).$toSeparator.mb_substr($formula,$i+1);
2057 if (self::$_localeLanguage !==
'en_us') {
2060 if (strpos($formula,
'"') !== FALSE) {
2063 $temp = explode(
'"',$formula);
2065 foreach($temp as &$value) {
2068 $value = preg_replace($from,$to,$value);
2074 $formula = implode(
'"',$temp);
2077 $formula = preg_replace($from,$to,$formula);
2089 if (self::$functionReplaceFromExcel === NULL) {
2090 self::$functionReplaceFromExcel = array();
2091 foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
2092 self::$functionReplaceFromExcel[] =
'/(@?[^\w\.])'.preg_quote($excelFunctionName).
'([\s]*\()/Ui';
2094 foreach(array_keys(self::$_localeBoolean) as $excelBoolean) {
2095 self::$functionReplaceFromExcel[] =
'/(@?[^\w\.])'.preg_quote($excelBoolean).
'([^\w\.])/Ui';
2100 if (self::$functionReplaceToLocale === NULL) {
2101 self::$functionReplaceToLocale = array();
2102 foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
2103 self::$functionReplaceToLocale[] =
'$1'.trim($localeFunctionName).
'$2';
2105 foreach(array_values(self::$_localeBoolean) as $localeBoolean) {
2106 self::$functionReplaceToLocale[] =
'$1'.trim($localeBoolean).
'$2';
2110 return self::_translateFormula(self::$functionReplaceFromExcel,self::$functionReplaceToLocale,$formula,
',',self::$_localeArgumentSeparator);
2118 if (self::$functionReplaceFromLocale === NULL) {
2119 self::$functionReplaceFromLocale = array();
2120 foreach(array_values(self::$_localeFunctions) as $localeFunctionName) {
2121 self::$functionReplaceFromLocale[] =
'/(@?[^\w\.])'.preg_quote($localeFunctionName).
'([\s]*\()/Ui';
2123 foreach(array_values(self::$_localeBoolean) as $excelBoolean) {
2124 self::$functionReplaceFromLocale[] =
'/(@?[^\w\.])'.preg_quote($excelBoolean).
'([^\w\.])/Ui';
2128 if (self::$functionReplaceToExcel === NULL) {
2129 self::$functionReplaceToExcel = array();
2130 foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) {
2131 self::$functionReplaceToExcel[] =
'$1'.trim($excelFunctionName).
'$2';
2133 foreach(array_keys(self::$_localeBoolean) as $excelBoolean) {
2134 self::$functionReplaceToExcel[] =
'$1'.trim($excelBoolean).
'$2';
2138 return self::_translateFormula(self::$functionReplaceFromLocale,self::$functionReplaceToExcel,$formula,self::$_localeArgumentSeparator,
',');
2143 if (self::$_localeLanguage !==
'en_us') {
2144 $functionName = trim($function,
'(');
2145 if (isset(self::$_localeFunctions[$functionName])) {
2146 $brace = ($functionName != $function);
2147 $function = self::$_localeFunctions[$functionName];
2148 if ($brace) { $function .=
'('; }
2164 if (is_string($value)) {
2166 if (preg_match(
'/^'.self::CALCULATION_REGEXP_ERROR.
'$/i', $value, $match)) {
2171 return '"'.$value.
'"';
2173 }
else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
2188 if (is_string($value)) {
2189 if ((isset($value{0})) && ($value{0} ==
'"') && (substr($value,-1) ==
'"')) {
2190 return substr($value,1,-1);
2193 }
else if((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
2230 if ($pCell === NULL) {
2237 $this->formulaError =
null;
2238 $this->_debugLog->clearLog();
2239 $this->_cyclicReferenceStack->clear();
2240 $this->_cyclicFormulaCount = 1;
2246 $this->_cellStack[] = array(
2247 'sheet' => $pCell->getWorksheet()->getTitle(),
2248 'cell' => $pCell->getCoordinate(),
2252 $cellAddress = array_pop($this->_cellStack);
2253 $this->_workbook->getSheetByName($cellAddress[
'sheet'])->getCell($cellAddress[
'cell']);
2255 $cellAddress = array_pop($this->_cellStack);
2256 $this->_workbook->getSheetByName($cellAddress[
'sheet'])->getCell($cellAddress[
'cell']);
2260 if ((is_array(
$result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
2263 if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) {
2267 if (count($testResult) != 1) {
2270 $r = array_shift(
$r);
2274 $c = array_shift($c);
2275 if (!is_numeric($c)) {
2280 $result = array_shift($testResult);
2304 $formula = trim($formula);
2305 if ((!isset($formula{0})) || ($formula{0} !=
'='))
return array();
2306 $formula = ltrim(substr($formula,1));
2307 if (!isset($formula{0}))
return array();
2325 $this->formulaError =
null;
2326 $this->_debugLog->clearLog();
2327 $this->_cyclicReferenceStack->clear();
2332 $this->_calculationCacheEnabled = FALSE;
2341 $this->_calculationCacheEnabled = $resetCache;
2350 $this->_debugLog->writeDebugLog(
'Testing cache value for cell ', $cellReference);
2351 if (($this->_calculationCacheEnabled) && (isset($this->_calculationCache[$cellReference]))) {
2352 $this->_debugLog->writeDebugLog(
'Retrieving value for cell ', $cellReference,
' from cache');
2354 $cellValue = $this->_calculationCache[$cellReference];
2361 if ($this->_calculationCacheEnabled) {
2362 $this->_calculationCache[$cellReference] = $cellValue;
2380 $formula = trim($formula);
2381 if ($formula{0} !=
'=')
return self::_wrapResult($formula);
2382 $formula = ltrim(substr($formula, 1));
2385 $pCellParent = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL;
2386 $wsTitle = ($pCellParent !== NULL) ? $pCellParent->getTitle() :
"\x00Wrk";
2387 $wsCellReference = $wsTitle .
'!' . $cellID;
2389 if (($cellID !== NULL) && ($this->
getValueFromCache($wsCellReference, $cellValue))) {
2393 if (($wsTitle{0} !==
"\x00") && ($this->_cyclicReferenceStack->onStack($wsCellReference))) {
2394 if ($this->cyclicFormulaCount <= 0) {
2395 $this->_cyclicFormulaCell =
'';
2397 } elseif ($this->_cyclicFormulaCell === $wsCellReference) {
2399 if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) {
2400 $this->_cyclicFormulaCell =
'';
2403 } elseif ($this->_cyclicFormulaCell ==
'') {
2404 if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) {
2407 $this->_cyclicFormulaCell = $wsCellReference;
2412 $this->_cyclicReferenceStack->push($wsCellReference);
2414 $this->_cyclicReferenceStack->pop();
2417 if ($cellID !== NULL) {
2441 if (!is_array($operand1)) {
2443 $operand1 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand1));
2445 } elseif (!is_array($operand2)) {
2447 $operand2 = array_fill(0,$matrixRows,array_fill(0,$matrixColumns,$operand2));
2453 if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) {
2460 } elseif ($resize == 1) {
2464 return array( $matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
2475 $matrixRows = count($matrix);
2477 foreach($matrix as $rowKey => $rowValue) {
2478 $matrixColumns = max(count($rowValue),$matrixColumns);
2479 if (!is_array($rowValue)) {
2480 $matrix[$rowKey] = array($rowValue);
2482 $matrix[$rowKey] = array_values($rowValue);
2485 $matrix = array_values($matrix);
2486 return array($matrixRows,$matrixColumns);
2500 private static function _resizeMatricesShrink(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
2501 if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
2502 if ($matrix2Rows < $matrix1Rows) {
2503 for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) {
2504 unset($matrix1[$i]);
2507 if ($matrix2Columns < $matrix1Columns) {
2508 for ($i = 0; $i < $matrix1Rows; ++$i) {
2509 for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) {
2510 unset($matrix1[$i][$j]);
2516 if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) {
2517 if ($matrix1Rows < $matrix2Rows) {
2518 for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) {
2519 unset($matrix2[$i]);
2522 if ($matrix1Columns < $matrix2Columns) {
2523 for ($i = 0; $i < $matrix2Rows; ++$i) {
2524 for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) {
2525 unset($matrix2[$i][$j]);
2543 private static function _resizeMatricesExtend(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
2544 if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
2545 if ($matrix2Columns < $matrix1Columns) {
2546 for ($i = 0; $i < $matrix2Rows; ++$i) {
2547 $x = $matrix2[$i][$matrix2Columns-1];
2548 for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) {
2549 $matrix2[$i][$j] =
$x;
2553 if ($matrix2Rows < $matrix1Rows) {
2554 $x = $matrix2[$matrix2Rows-1];
2555 for ($i = 0; $i < $matrix1Rows; ++$i) {
2561 if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) {
2562 if ($matrix1Columns < $matrix2Columns) {
2563 for ($i = 0; $i < $matrix1Rows; ++$i) {
2564 $x = $matrix1[$i][$matrix1Columns-1];
2565 for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) {
2566 $matrix1[$i][$j] =
$x;
2570 if ($matrix1Rows < $matrix2Rows) {
2571 $x = $matrix1[$matrix1Rows-1];
2572 for ($i = 0; $i < $matrix2Rows; ++$i) {
2587 if ($this->_debugLog->getWriteDebugLog()) {
2589 if (count($testArray) == 1) {
2590 $value = array_pop($testArray);
2593 if (is_array($value)) {
2594 $returnMatrix = array();
2595 $pad = $rpad =
', ';
2596 foreach($value as
$row) {
2597 if (is_array(
$row)) {
2598 $returnMatrix[] = implode($pad,array_map(array($this,
'_showValue'),
$row));
2604 return '{ '.implode($rpad,$returnMatrix).
' }';
2605 } elseif(is_string($value) && (trim($value,
'"') == $value)) {
2606 return '"'.$value.
'"';
2607 } elseif(is_bool($value)) {
2608 return ($value) ? self::$_localeBoolean[
'TRUE'] : self::$_localeBoolean[
'FALSE'];
2622 if ($this->_debugLog->getWriteDebugLog()) {
2624 if (count($testArray) == 1) {
2625 $value = array_pop($testArray);
2628 if ($value === NULL) {
2629 return 'a NULL value';
2630 } elseif (is_float($value)) {
2631 $typeString =
'a floating point number';
2632 } elseif(is_int($value)) {
2633 $typeString =
'an integer number';
2634 } elseif(is_bool($value)) {
2635 $typeString =
'a boolean';
2636 } elseif(is_array($value)) {
2637 $typeString =
'a matrix';
2640 return 'an empty string';
2641 } elseif ($value{0} ==
'#') {
2642 return 'a '.$value.
' error';
2644 $typeString =
'a string';
2647 return $typeString.
' with a value of '.$this->
_showValue($value);
2653 static $matrixReplaceFrom = array(
'{',
';',
'}');
2654 static $matrixReplaceTo = array(
'MKMATRIX(MKMATRIX(',
'),MKMATRIX(',
'))');
2657 if (strpos($formula,
'{') !== FALSE) {
2659 if (strpos($formula,
'"') !== FALSE) {
2662 $temp = explode(
'"',$formula);
2664 $openCount = $closeCount = 0;
2666 foreach($temp as &$value) {
2669 $openCount += substr_count($value,
'{');
2670 $closeCount += substr_count($value,
'}');
2671 $value = str_replace($matrixReplaceFrom,$matrixReplaceTo,$value);
2676 $formula = implode(
'"',$temp);
2679 $openCount = substr_count($formula,
'{');
2680 $closeCount = substr_count($formula,
'}');
2681 $formula = str_replace($matrixReplaceFrom,$matrixReplaceTo,$formula);
2684 if ($openCount < $closeCount) {
2685 if ($openCount > 0) {
2690 } elseif ($openCount > $closeCount) {
2691 if ($closeCount > 0) {
2704 return func_get_args();
2717 '>' => 0,
'<' => 0,
'=' => 0,
'>=' => 0,
'<=' => 0,
'<>' => 0
2722 private static $_comparisonOperators = array(
'>' => TRUE,
'<' => TRUE,
'=' => TRUE,
'>=' => TRUE,
'<=' => TRUE,
'<>' => TRUE);
2736 '>' => 0,
'<' => 0,
'=' => 0,
'>=' => 0,
'<=' => 0,
'<>' => 0
2747 $pCellParent = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL;
2749 $regexpMatchString =
'/^('.self::CALCULATION_REGEXP_FUNCTION.
2750 '|'.self::CALCULATION_REGEXP_CELLREF.
2751 '|'.self::CALCULATION_REGEXP_NUMBER.
2752 '|'.self::CALCULATION_REGEXP_STRING.
2753 '|'.self::CALCULATION_REGEXP_OPENBRACE.
2754 '|'.self::CALCULATION_REGEXP_NAMEDRANGE.
2755 '|'.self::CALCULATION_REGEXP_ERROR.
2762 $expectingOperator = FALSE;
2764 $expectingOperand = FALSE;
2770 $opCharacter = $formula{$index};
2772 if ((isset(self::$_comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$_comparisonOperators[$formula{$index+1}]))) {
2773 $opCharacter .= $formula{++$index};
2778 $isOperandOrFunction = preg_match($regexpMatchString, substr($formula, $index), $match);
2782 if ($opCharacter ==
'-' && !$expectingOperator) {
2784 $stack->push(
'Unary Operator',
'~');
2786 } elseif ($opCharacter ==
'%' && $expectingOperator) {
2788 $stack->push(
'Unary Operator',
'%');
2790 } elseif ($opCharacter ==
'+' && !$expectingOperator) {
2793 } elseif ((($opCharacter ==
'~') || ($opCharacter ==
'|')) && (!$isOperandOrFunction)) {
2796 } elseif ((isset(self::$_operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) {
2798 while($stack->count() > 0 &&
2799 ($o2 = $stack->last()) &&
2800 isset(self::$_operators[$o2[
'value']]) &&
2801 @(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2[
'value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2[
'value']])) {
2804 $stack->push(
'Binary Operator',$opCharacter);
2806 $expectingOperator = FALSE;
2808 } elseif ($opCharacter ==
')' && $expectingOperator) {
2810 $expectingOperand = FALSE;
2811 while (($o2 = $stack->pop()) && $o2[
'value'] !=
'(') {
2812 if ($o2 === NULL)
return $this->
_raiseFormulaError(
'Formula Error: Unexpected closing brace ")"');
2815 $d = $stack->last(2);
2816 if (preg_match(
'/^'.self::CALCULATION_REGEXP_FUNCTION.
'$/i',
$d[
'value'], $matches)) {
2817 $functionName = $matches[1];
2820 $argumentCount =
$d[
'value'];
2830 if (isset(self::$_controlFunctions[$functionName])) {
2832 $expectedArgumentCount = self::$_controlFunctions[$functionName][
'argumentCount'];
2833 $functionCall = self::$_controlFunctions[$functionName][
'functionCall'];
2834 } elseif (isset(self::$_PHPExcelFunctions[$functionName])) {
2836 $expectedArgumentCount = self::$_PHPExcelFunctions[$functionName][
'argumentCount'];
2837 $functionCall = self::$_PHPExcelFunctions[$functionName][
'functionCall'];
2839 return $this->
_raiseFormulaError(
"Formula Error: Internal error, non-function on stack");
2842 $argumentCountError = FALSE;
2843 if (is_numeric($expectedArgumentCount)) {
2844 if ($expectedArgumentCount < 0) {
2846 if ($argumentCount > abs($expectedArgumentCount)) {
2847 $argumentCountError = TRUE;
2848 $expectedArgumentCountString =
'no more than '.abs($expectedArgumentCount);
2852 if ($argumentCount != $expectedArgumentCount) {
2853 $argumentCountError = TRUE;
2854 $expectedArgumentCountString = $expectedArgumentCount;
2857 } elseif ($expectedArgumentCount !=
'*') {
2858 $isOperandOrFunction = preg_match(
'/(\d*)([-+,])(\d*)/',$expectedArgumentCount,$argMatch);
2861 switch ($argMatch[2]) {
2863 if ($argumentCount < $argMatch[1]) {
2864 $argumentCountError = TRUE;
2865 $expectedArgumentCountString = $argMatch[1].
' or more ';
2869 if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) {
2870 $argumentCountError = TRUE;
2871 $expectedArgumentCountString =
'between '.$argMatch[1].
' and '.$argMatch[3];
2875 if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) {
2876 $argumentCountError = TRUE;
2877 $expectedArgumentCountString =
'either '.$argMatch[1].
' or '.$argMatch[3];
2882 if ($argumentCountError) {
2883 return $this->
_raiseFormulaError(
"Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString.
" expected");
2888 } elseif ($opCharacter ==
',') {
2890 while (($o2 = $stack->pop()) && $o2[
'value'] !=
'(') {
2896 if (($expectingOperand) || (!$expectingOperator)) {
2897 $output[] = array(
'type' =>
'NULL Value',
'value' => self::$_ExcelConstants[
'NULL'],
'reference' => NULL);
2900 $d = $stack->last(2);
2901 if (!preg_match(
'/^'.self::CALCULATION_REGEXP_FUNCTION.
'$/i',
$d[
'value'], $matches))
2904 $stack->push(
$d[
'type'],++
$d[
'value'],
$d[
'reference']);
2905 $stack->push(
'Brace',
'(');
2906 $expectingOperator = FALSE;
2907 $expectingOperand = TRUE;
2910 } elseif ($opCharacter ==
'(' && !$expectingOperator) {
2912 $stack->push(
'Brace',
'(');
2915 } elseif ($isOperandOrFunction && !$expectingOperator) {
2916 $expectingOperator = TRUE;
2917 $expectingOperand = FALSE;
2919 $length = strlen($val);
2922 if (preg_match(
'/^'.self::CALCULATION_REGEXP_FUNCTION.
'$/i', $val, $matches)) {
2923 $val = preg_replace(
'/\s/u',
'',$val);
2925 if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) {
2926 $stack->push(
'Function', strtoupper($val));
2927 $ax = preg_match(
'/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch);
2929 $stack->push(
'Operand Count for Function '.strtoupper($val).
')', 0);
2930 $expectingOperator = TRUE;
2932 $stack->push(
'Operand Count for Function '.strtoupper($val).
')', 1);
2933 $expectingOperator = FALSE;
2935 $stack->push(
'Brace',
'(');
2937 $output[] = array(
'type' =>
'Value',
'value' => $matches[1],
'reference' => NULL);
2939 } elseif (preg_match(
'/^'.self::CALCULATION_REGEXP_CELLREF.
'$/i', $val, $matches)) {
2945 $testPrevOp = $stack->last(1);
2946 if ($testPrevOp[
'value'] ==
':') {
2948 if ($matches[2] ==
'') {
2952 preg_match(
'/^'.self::CALCULATION_REGEXP_CELLREF.
'$/i', $startCellRef, $startMatches);
2953 if ($startMatches[2] >
'') {
2954 $val = $startMatches[2].
'!'.$val;
2961 $output[] = array(
'type' =>
'Cell Reference',
'value' => $val,
'reference' => $val);
2966 $testPrevOp = $stack->last(1);
2967 if ($testPrevOp[
'value'] ==
':') {
2970 if (strpos(
'!',$startRowColRef) !== FALSE) {
2971 list($rangeWS1,$startRowColRef) = explode(
'!',$startRowColRef);
2973 if ($rangeWS1 !=
'') $rangeWS1 .=
'!';
2974 $rangeWS2 = $rangeWS1;
2975 if (strpos(
'!',$val) !== FALSE) {
2976 list($rangeWS2,$val) = explode(
'!',$val);
2978 if ($rangeWS2 !=
'') $rangeWS2 .=
'!';
2979 if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
2980 ($startRowColRef <= 1048576) && ($val <= 1048576)) {
2982 $endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestColumn() :
'XFD';
2983 $output[count(
$output)-1][
'value'] = $rangeWS1.
'A'.$startRowColRef;
2984 $val = $rangeWS2.$endRowColRef.$val;
2985 } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
2986 (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
2988 $endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestRow() : 1048576;
2989 $output[count(
$output)-1][
'value'] = $rangeWS1.strtoupper($startRowColRef).
'1';
2990 $val = $rangeWS2.$val.$endRowColRef;
2994 $localeConstant = FALSE;
2995 if ($opCharacter ==
'"') {
2999 } elseif (is_numeric($val)) {
3001 if ((strpos($val,
'.') !== FALSE) || (stripos($val,
'e') !== FALSE) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
3003 $val = (float) $val;
3006 $val = (integer) $val;
3008 } elseif (isset(self::$_ExcelConstants[trim(strtoupper($val))])) {
3009 $excelConstant = trim(strtoupper($val));
3011 $val = self::$_ExcelConstants[$excelConstant];
3012 } elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$_localeBoolean)) !== FALSE) {
3014 $val = self::$_ExcelConstants[$localeConstant];
3016 $details = array(
'type' =>
'Value',
'value' => $val,
'reference' => NULL);
3017 if ($localeConstant) { $details[
'localeValue'] = $localeConstant; }
3022 } elseif ($opCharacter ==
'$') {
3024 } elseif ($opCharacter ==
')') {
3025 if ($expectingOperand) {
3026 $output[] = array(
'type' =>
'NULL Value',
'value' => self::$_ExcelConstants[
'NULL'],
'reference' => NULL);
3027 $expectingOperand = FALSE;
3028 $expectingOperator = TRUE;
3032 } elseif (isset(self::$_operators[$opCharacter]) && !$expectingOperator) {
3033 return $this->
_raiseFormulaError(
"Formula Error: Unexpected operator '$opCharacter'");
3038 if ($index == strlen($formula)) {
3041 if ((isset(self::$_operators[$opCharacter])) && ($opCharacter !=
'%')) {
3042 return $this->
_raiseFormulaError(
"Formula Error: Operator '$opCharacter' has no operands");
3048 while (($formula{$index} ==
"\n") || ($formula{$index} ==
"\r")) {
3051 if ($formula{$index} ==
' ') {
3052 while ($formula{$index} ==
' ') {
3058 if (($expectingOperator) && (preg_match(
'/^'.self::CALCULATION_REGEXP_CELLREF.
'.*/Ui', substr($formula, $index), $match)) &&
3061 while($stack->count() > 0 &&
3062 ($o2 = $stack->last()) &&
3063 isset(self::$_operators[$o2[
'value']]) &&
3064 @(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2[
'value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2[
'value']])) {
3067 $stack->push(
'Binary Operator',
'|');
3068 $expectingOperator = FALSE;
3073 while (($op = $stack->pop()) !== NULL) {
3074 if ((is_array($op) && $op[
'value'] ==
'(') || ($op ===
'('))
3084 $operand = $operandData[
'value'];
3085 if (($operandData[
'reference'] === NULL) && (is_array($operand))) {
3086 $rKeys = array_keys($operand);
3087 $rowKey = array_shift($rKeys);
3088 $cKeys = array_keys(array_keys($operand[$rowKey]));
3089 $colKey = array_shift($cKeys);
3090 if (ctype_upper($colKey)) {
3091 $operandData[
'reference'] = $colKey.$rowKey;
3099 if ($tokens == FALSE)
return FALSE;
3103 $pCellWorksheet = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL;
3104 $pCellParent = ($pCell !== NULL) ? $pCell->getParent() :
null;
3108 foreach ($tokens as $tokenData) {
3111 $token = $tokenData[
'value'];
3114 if (isset(self::$_binaryOperators[$token])) {
3117 if (($operand2Data = $stack->pop()) === NULL)
return $this->
_raiseFormulaError(
'Internal error - Operand value missing from stack');
3118 if (($operand1Data = $stack->pop()) === NULL)
return $this->
_raiseFormulaError(
'Internal error - Operand value missing from stack');
3124 if ($token ==
':') {
3125 $this->_debugLog->writeDebugLog(
'Evaluating Range ', $this->
_showValue($operand1Data[
'reference']),
' ', $token,
' ', $this->
_showValue($operand2Data[
'reference']));
3127 $this->_debugLog->writeDebugLog(
'Evaluating ', $this->
_showValue($operand1),
' ', $token,
' ', $this->
_showValue($operand2));
3143 $sheet1 = $sheet2 =
'';
3144 if (strpos($operand1Data[
'reference'],
'!') !== FALSE) {
3145 list($sheet1,$operand1Data[
'reference']) = explode(
'!',$operand1Data[
'reference']);
3147 $sheet1 = ($pCellParent !== NULL) ? $pCellWorksheet->getTitle() :
'';
3149 if (strpos($operand2Data[
'reference'],
'!') !== FALSE) {
3150 list($sheet2,$operand2Data[
'reference']) = explode(
'!',$operand2Data[
'reference']);
3154 if ($sheet1 == $sheet2) {
3155 if ($operand1Data[
'reference'] === NULL) {
3156 if ((trim($operand1Data[
'value']) !=
'') && (is_numeric($operand1Data[
'value']))) {
3157 $operand1Data[
'reference'] = $pCell->getColumn().$operand1Data[
'value'];
3158 } elseif (trim($operand1Data[
'reference']) ==
'') {
3159 $operand1Data[
'reference'] = $pCell->getCoordinate();
3161 $operand1Data[
'reference'] = $operand1Data[
'value'].$pCell->getRow();
3164 if ($operand2Data[
'reference'] === NULL) {
3165 if ((trim($operand2Data[
'value']) !=
'') && (is_numeric($operand2Data[
'value']))) {
3166 $operand2Data[
'reference'] = $pCell->getColumn().$operand2Data[
'value'];
3167 } elseif (trim($operand2Data[
'reference']) ==
'') {
3168 $operand2Data[
'reference'] = $pCell->getCoordinate();
3170 $operand2Data[
'reference'] = $operand2Data[
'value'].$pCell->getRow();
3174 $oData = array_merge(explode(
':',$operand1Data[
'reference']),explode(
':',$operand2Data[
'reference']));
3175 $oCol = $oRow = array();
3176 foreach($oData as $oDatum) {
3182 if ($pCellParent !== NULL) {
3183 $cellValue = $this->
extractCellRange($cellRef, $this->_workbook->getSheetByName($sheet1), FALSE);
3187 $stack->push(
'Cell Reference',$cellValue,$cellRef);
3212 if (is_bool($operand1)) {
3213 $operand1 = ($operand1) ? self::$_localeBoolean[
'TRUE'] : self::$_localeBoolean[
'FALSE'];
3215 if (is_bool($operand2)) {
3216 $operand2 = ($operand2) ? self::$_localeBoolean[
'TRUE'] : self::$_localeBoolean[
'FALSE'];
3218 if ((is_array($operand1)) || (is_array($operand2))) {
3225 $matrixResult = $matrix->concat($operand2);
3226 $result = $matrixResult->getArray();
3228 $this->_debugLog->writeDebugLog(
'JAMA Matrix Exception: ', $ex->getMessage());
3232 $result =
'"'.str_replace(
'""',
'"',self::_unwrapResult($operand1,
'"').self::_unwrapResult($operand2,
'"')).
'"';
3235 $stack->push(
'Value',
$result);
3238 $rowIntersect = array_intersect_key($operand1,$operand2);
3239 $cellIntersect = $oCol = $oRow = array();
3240 foreach(array_keys($rowIntersect) as
$row) {
3242 foreach($rowIntersect[
$row] as $col =>
$data) {
3244 $cellIntersect[
$row] = array_intersect_key($operand1[
$row],$operand2[
$row]);
3248 $this->_debugLog->writeDebugLog(
'Evaluation Result is ', $this->
_showTypeDetails($cellIntersect));
3249 $stack->push(
'Value',$cellIntersect,$cellRef);
3254 } elseif (($token ===
'~') || ($token ===
'%')) {
3256 if (($arg = $stack->pop()) === NULL)
return $this->
_raiseFormulaError(
'Internal error - Operand value missing from stack');
3257 $arg = $arg[
'value'];
3258 if ($token ===
'~') {
3260 $this->_debugLog->writeDebugLog(
'Evaluating Negation of ', $this->
_showValue($arg));
3264 $this->_debugLog->writeDebugLog(
'Evaluating Percentile of ', $this->
_showValue($arg));
3267 if (is_array($arg)) {
3271 $matrixResult = $matrix1->arrayTimesEquals($multiplier);
3272 $result = $matrixResult->getArray();
3274 $this->_debugLog->writeDebugLog(
'JAMA Matrix Exception: ', $ex->getMessage());
3278 $stack->push(
'Value',
$result);
3283 } elseif (preg_match(
'/^'.self::CALCULATION_REGEXP_CELLREF.
'$/i', $token, $matches)) {
3286 if (isset($matches[8])) {
3288 if ($pCell === NULL) {
3292 $cellRef = $matches[6].$matches[7].
':'.$matches[9].$matches[10];
3293 if ($matches[2] >
'') {
3294 $matches[2] = trim($matches[2],
"\"'");
3295 if ((strpos($matches[2],
'[') !== FALSE) || (strpos($matches[2],
']') !== FALSE)) {
3299 $matches[2] = trim($matches[2],
"\"'");
3301 $this->_debugLog->writeDebugLog(
'Evaluating Cell Range ', $cellRef,
' in worksheet ', $matches[2]);
3302 if ($pCellParent !== NULL) {
3303 $cellValue = $this->
extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), FALSE);
3307 $this->_debugLog->writeDebugLog(
'Evaluation Result for cells ', $cellRef,
' in worksheet ', $matches[2],
' is ', $this->
_showTypeDetails($cellValue));
3311 $this->_debugLog->writeDebugLog(
'Evaluating Cell Range ', $cellRef,
' in current worksheet');
3312 if ($pCellParent !== NULL) {
3317 $this->_debugLog->writeDebugLog(
'Evaluation Result for cells ', $cellRef,
' is ', $this->
_showTypeDetails($cellValue));
3322 if ($pCell === NULL) {
3326 $cellRef = $matches[6].$matches[7];
3327 if ($matches[2] >
'') {
3328 $matches[2] = trim($matches[2],
"\"'");
3329 if ((strpos($matches[2],
'[') !== FALSE) || (strpos($matches[2],
']') !== FALSE)) {
3334 $this->_debugLog->writeDebugLog(
'Evaluating Cell ', $cellRef,
' in worksheet ', $matches[2]);
3335 if ($pCellParent !== NULL) {
3336 $cellSheet = $this->_workbook->getSheetByName($matches[2]);
3337 if ($cellSheet && $cellSheet->cellExists($cellRef)) {
3338 $cellValue = $this->
extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), FALSE);
3339 $pCell->attach($pCellParent);
3346 $this->_debugLog->writeDebugLog(
'Evaluation Result for cell ', $cellRef,
' in worksheet ', $matches[2],
' is ', $this->
_showTypeDetails($cellValue));
3350 $this->_debugLog->writeDebugLog(
'Evaluating Cell ', $cellRef,
' in current worksheet');
3351 if ($pCellParent->isDataSet($cellRef)) {
3353 $pCell->attach($pCellParent);
3357 $this->_debugLog->writeDebugLog(
'Evaluation Result for cell ', $cellRef,
' is ', $this->
_showTypeDetails($cellValue));
3361 $stack->push(
'Value',$cellValue,$cellRef);
3364 } elseif (preg_match(
'/^'.self::CALCULATION_REGEXP_FUNCTION.
'$/i', $token, $matches)) {
3366 $functionName = $matches[1];
3367 $argCount = $stack->pop();
3368 $argCount = $argCount[
'value'];
3369 if ($functionName !=
'MKMATRIX') {
3370 $this->_debugLog->writeDebugLog(
'Evaluating Function ', self::_localeFunc($functionName),
'() with ', (($argCount == 0) ?
'no' : $argCount),
' argument', (($argCount == 1) ?
'' :
's'));
3372 if ((isset(self::$_PHPExcelFunctions[$functionName])) || (isset(self::$_controlFunctions[$functionName]))) {
3373 if (isset(self::$_PHPExcelFunctions[$functionName])) {
3374 $functionCall = self::$_PHPExcelFunctions[$functionName][
'functionCall'];
3375 $passByReference = isset(self::$_PHPExcelFunctions[$functionName][
'passByReference']);
3376 $passCellReference = isset(self::$_PHPExcelFunctions[$functionName][
'passCellReference']);
3377 } elseif (isset(self::$_controlFunctions[$functionName])) {
3378 $functionCall = self::$_controlFunctions[$functionName][
'functionCall'];
3379 $passByReference = isset(self::$_controlFunctions[$functionName][
'passByReference']);
3380 $passCellReference = isset(self::$_controlFunctions[$functionName][
'passCellReference']);
3384 $args = $argArrayVals = array();
3385 for ($i = 0; $i < $argCount; ++$i) {
3386 $arg = $stack->pop();
3387 $a = $argCount - $i - 1;
3388 if (($passByReference) &&
3389 (isset(self::$_PHPExcelFunctions[$functionName][
'passByReference'][$a])) &&
3390 (self::$_PHPExcelFunctions[$functionName][
'passByReference'][$a])) {
3391 if ($arg[
'reference'] === NULL) {
3393 if ($functionName !=
'MKMATRIX') { $argArrayVals[] = $this->
_showValue($cellID); }
3395 $args[] = $arg[
'reference'];
3396 if ($functionName !=
'MKMATRIX') { $argArrayVals[] = $this->
_showValue($arg[
'reference']); }
3400 if ($functionName !=
'MKMATRIX') { $argArrayVals[] = $this->
_showValue($arg[
'value']); }
3405 if (($passByReference) && ($argCount == 0)) {
3407 $argArrayVals[] = $this->
_showValue($cellID);
3412 if ($functionName !=
'MKMATRIX') {
3413 if ($this->_debugLog->getWriteDebugLog()) {
3414 krsort($argArrayVals);
3442 if ($passCellReference) {
3445 if (strpos($functionCall,
'::') !== FALSE) {
3446 $result = call_user_func_array(explode(
'::',$functionCall),$args);
3448 foreach($args as &$arg) {
3452 $result = call_user_func_array($functionCall,$args);
3455 if ($functionName !=
'MKMATRIX') {
3456 $this->_debugLog->writeDebugLog(
'Evaluation Result for ', self::_localeFunc($functionName),
'() function call is ', $this->
_showTypeDetails(
$result));
3458 $stack->push(
'Value',self::_wrapResult(
$result));
3463 if (isset(self::$_ExcelConstants[strtoupper($token)])) {
3464 $excelConstant = strtoupper($token);
3466 $stack->push(
'Constant Value',self::$_ExcelConstants[$excelConstant]);
3467 $this->_debugLog->writeDebugLog(
'Evaluating Constant ', $excelConstant,
' as ', $this->
_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
3468 } elseif ((is_numeric($token)) || ($token === NULL) || (is_bool($token)) || ($token ==
'') || ($token{0} ==
'"') || ($token{0} ==
'#')) {
3470 $stack->push(
'Value',$token);
3472 } elseif (preg_match(
'/^'.self::CALCULATION_REGEXP_NAMEDRANGE.
'$/i', $token, $matches)) {
3474 $namedRange = $matches[6];
3476 $this->_debugLog->writeDebugLog(
'Evaluating Named Range ', $namedRange);
3477 $cellValue = $this->
extractNamedRange($namedRange, ((NULL !== $pCell) ? $pCellWorksheet : NULL), FALSE);
3478 $pCell->attach($pCellParent);
3479 $this->_debugLog->writeDebugLog(
'Evaluation Result for named range ', $namedRange,
' is ', $this->
_showTypeDetails($cellValue));
3480 $stack->push(
'Named Range',$cellValue,$namedRange);
3499 if (is_array($operand)) {
3500 if ((count($operand, COUNT_RECURSIVE) - count($operand)) == 1) {
3502 $operand = array_pop($operand);
3503 }
while (is_array($operand));
3507 if (is_string($operand)) {
3512 if (!is_numeric($operand)) {
3514 if ($operand >
'' && $operand{0} ==
'#') {
3515 $stack->push(
'Value', $operand);
3516 $this->_debugLog->writeDebugLog(
'Evaluation Result is ', $this->
_showTypeDetails($operand));
3520 $stack->push(
'Value',
'#VALUE!');
3521 $this->_debugLog->writeDebugLog(
'Evaluation Result is a ', $this->
_showTypeDetails(
'#VALUE!'));
3534 if ((is_array($operand1)) || (is_array($operand2))) {
3536 if ((is_array($operand1)) && (!is_array($operand2))) {
3537 foreach($operand1 as
$x => $operandData) {
3538 $this->_debugLog->writeDebugLog(
'Evaluating Comparison ', $this->
_showValue($operandData),
' ', $operation,
' ', $this->
_showValue($operand2));
3543 } elseif ((!is_array($operand1)) && (is_array($operand2))) {
3544 foreach($operand2 as
$x => $operandData) {
3545 $this->_debugLog->writeDebugLog(
'Evaluating Comparison ', $this->
_showValue($operand1),
' ', $operation,
' ', $this->
_showValue($operandData));
3552 foreach($operand1 as
$x => $operandData) {
3553 $this->_debugLog->writeDebugLog(
'Evaluating Comparison ', $this->
_showValue($operandData),
' ', $operation,
' ', $this->
_showValue($operand2[
$x]));
3562 $stack->push(
'Array',
$result);
3567 if (is_string($operand1) && $operand1 >
'' && $operand1{0} ==
'"') { $operand1 =
self::_unwrapResult($operand1); }
3568 if (is_string($operand2) && $operand2 >
'' && $operand2{0} ==
'"') { $operand2 =
self::_unwrapResult($operand2); }
3573 if (is_string($operand1)) {
3574 $operand1 = strtoupper($operand1);
3577 if (is_string($operand2)) {
3578 $operand2 = strtoupper($operand2);
3585 switch ($operation) {
3588 if ($useLowercaseFirstComparison) {
3591 $result = ($operand1 > $operand2);
3596 if ($useLowercaseFirstComparison) {
3599 $result = ($operand1 < $operand2);
3604 if (is_numeric($operand1) && is_numeric($operand2)) {
3605 $result = (abs($operand1 - $operand2) < $this->delta);
3607 $result = strcmp($operand1, $operand2) == 0;
3612 if (is_numeric($operand1) && is_numeric($operand2)) {
3613 $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 > $operand2));
3614 } elseif ($useLowercaseFirstComparison) {
3617 $result = strcmp($operand1, $operand2) >= 0;
3622 if (is_numeric($operand1) && is_numeric($operand2)) {
3623 $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 < $operand2));
3624 } elseif ($useLowercaseFirstComparison) {
3627 $result = strcmp($operand1, $operand2) <= 0;
3632 if (is_numeric($operand1) && is_numeric($operand2)) {
3633 $result = (abs($operand1 - $operand2) > 1E-14);
3635 $result = strcmp($operand1, $operand2) != 0;
3643 $stack->push(
'Value',
$result);
3658 return strcmp($inversedStr1, $inversedStr2);
3669 if ((is_array($operand1)) || (is_array($operand2))) {
3677 $matrixResult = $matrix->$matrixFunction($operand2);
3678 $result = $matrixResult->getArray();
3680 $this->_debugLog->writeDebugLog(
'JAMA Matrix Exception: ', $ex->getMessage());
3685 ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) ||
3686 (is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) {
3690 switch ($operation) {
3693 $result = $operand1 + $operand2;
3697 $result = $operand1 - $operand2;
3701 $result = $operand1 * $operand2;
3705 if ($operand2 == 0) {
3707 $stack->push(
'Value',
'#DIV/0!');
3708 $this->_debugLog->writeDebugLog(
'Evaluation Result is ', $this->
_showTypeDetails(
'#DIV/0!'));
3711 $result = $operand1 / $operand2;
3716 $result = pow($operand1, $operand2);
3725 $stack->push(
'Value',
$result);
3732 $this->formulaError = $errorMessage;
3733 $this->_cyclicReferenceStack->clear();
3735 trigger_error($errorMessage, E_USER_ERROR);
3750 $returnValue = array ();
3753 if ($pSheet !== NULL) {
3754 $pSheetName = $pSheet->getTitle();
3757 if (strpos ($pRange,
'!') !==
false) {
3762 $pSheet = $this->_workbook->getSheetByName($pSheetName);
3767 $pRange = $pSheetName.
'!'.$pRange;
3768 if (!isset($aReferences[1])) {
3770 sscanf($aReferences[0],
'%[A-Z]%d', $currentCol, $currentRow);
3772 if ($pSheet->cellExists($aReferences[0])) {
3773 $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
3775 $returnValue[$currentRow][$currentCol] = NULL;
3779 foreach ($aReferences as $reference) {
3781 sscanf($reference,
'%[A-Z]%d', $currentCol, $currentRow);
3783 if ($pSheet->cellExists($reference)) {
3784 $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
3786 $returnValue[$currentRow][$currentCol] = NULL;
3793 return $returnValue;
3808 $returnValue = array ();
3811 if ($pSheet !== NULL) {
3812 $pSheetName = $pSheet->getTitle();
3815 if (strpos ($pRange,
'!') !==
false) {
3820 $pSheet = $this->_workbook->getSheetByName($pSheetName);
3825 if ($namedRange !== NULL) {
3826 $pSheet = $namedRange->getWorksheet();
3828 $pRange = $namedRange->getRange();
3831 if (ctype_alpha($splitRange[0][0])) {
3832 $pRange = $splitRange[0][0] .
'1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
3833 } elseif(ctype_digit($splitRange[0][0])) {
3834 $pRange =
'A' . $splitRange[0][0] .
':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
3852 if (!isset($aReferences[1])) {
3856 if ($pSheet->cellExists($aReferences[0])) {
3857 $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
3859 $returnValue[$currentRow][$currentCol] = NULL;
3863 foreach ($aReferences as $reference) {
3868 if ($pSheet->cellExists($reference)) {
3869 $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
3871 $returnValue[$currentRow][$currentCol] = NULL;
3880 return $returnValue;
3891 $pFunction = strtoupper ($pFunction);
3892 if (isset(self::$_PHPExcelFunctions[$pFunction])) {
3893 return (self::$_PHPExcelFunctions[$pFunction][
'functionCall'] !=
'PHPExcel_Calculation_Functions::DUMMY');
3907 $returnValue = array();
3909 foreach(self::$_PHPExcelFunctions as $functionName => $function) {
3910 if ($function[
'functionCall'] !=
'PHPExcel_Calculation_Functions::DUMMY') {
3913 $function[
'functionCall']
3919 return $returnValue;
3929 return array_keys(self::$_PHPExcelFunctions);
3939 $returnValue = array();
3941 foreach(self::$_PHPExcelFunctions as $functionName => $function) {
3942 if ($function[
'functionCall'] !=
'PHPExcel_Calculation_Functions::DUMMY') {
3943 $returnValue[] = $functionName;
3948 return $returnValue;
for($col=0; $col< 50; $col++) $d
An exception for terminatinating execution or to throw for unit testing.
const CATEGORY_STATISTICAL
const CATEGORY_TEXT_AND_DATA
const CATEGORY_DATE_AND_TIME
const CATEGORY_ENGINEERING
const CATEGORY_MATH_AND_TRIG
const CATEGORY_INFORMATION
const CATEGORY_LOOKUP_AND_REFERENCE
static getCompatibilityMode()
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
const COMPATIBILITY_OPENOFFICE
static $functionReplaceFromExcel
static $_controlFunctions
static $_operatorAssociativity
static getFALSE()
Return the locale-specific translation of FALSE.
static _resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
Ensure that paired matrix operands are both matrices of the same size.
__clone()
__clone implementation.
isImplemented($pFunction='')
Is a specific function implemented?
static _checkMatrixOperands(&$operand1, &$operand2, $resize=1)
Ensure that paired matrix operands are both matrices and of the same size.
renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
Rename calculation cache for a specified worksheet.
_raiseFormulaError($errorMessage)
setLocale($locale='en_us')
Set the locale code.
const RETURN_ARRAY_AS_ARRAY
const CALCULATION_REGEXP_STRING
_convertMatrixReferences($formula)
__construct(PHPExcel $workbook=NULL)
disableCalculationCache()
Disable calculation cache.
listAllFunctionNames()
Get a list of all Excel function names.
_processTokenStack($tokens, $cellID=NULL, PHPExcel_Cell $pCell=NULL)
static getInstance(PHPExcel $workbook=NULL)
Get an instance of this class.
static $_comparisonOperators
static _unwrapResult($value)
Remove quotes used as a wrapper to identify string values.
const RETURN_ARRAY_AS_ERROR
constants
_validateBinaryOperand($cellID, &$operand, &$stack)
parseFormula($formula)
Validate and parse a formula string.
calculate(PHPExcel_Cell $pCell=NULL)
Calculate cell value (using formula from a cell ID) Retained for backward compatibility.
_translateFormulaToLocale($formula)
static _translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces)
static $returnArrayAsType
const CALCULATION_REGEXP_OPENBRACE
static _resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
Ensure that paired matrix operands are both matrices of the same size.
static $_PHPExcelFunctions
const RETURN_ARRAY_AS_VALUE
getDebugLog()
Get the debuglog for this claculation engine instance.
static _getMatrixDimensions(&$matrix)
Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0,...
setCalculationCacheEnabled($pValue=TRUE)
Enable/disable calculation cache.
static _dataTestReference(&$operandData)
$_calculationCacheEnabled
const CALCULATION_REGEXP_CELLREF
saveValueToCache($cellReference, $cellValue)
extractNamedRange(&$pRange='A1', PHPExcel_Worksheet $pSheet=NULL, $resetLog=TRUE)
Extract range values.
static $functionReplaceFromLocale
static $_operatorPrecedence
_calculateFormulaValue($formula, $cellID=null, PHPExcel_Cell $pCell=null)
Parse a cell formula and calculate its value.
_executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, &$stack, $recursingArrays=FALSE)
enableCalculationCache()
Enable calculation cache.
static $functionReplaceToLocale
static getArrayReturnType()
Return the Array Return Type (Array or Value of first element in the array)
static setArrayReturnType($returnType)
Set the Array Return Type (Array or Value of first element in the array)
_translateFormulaToEnglish($formula)
flushInstance()
Flush the calculation cache for any existing instance of this class but only if a PHPExcel_Calculatio...
const CALCULATION_REGEXP_FUNCTION
listFunctions()
Get a list of all implemented functions as an array of function objects.
static unsetInstance(PHPExcel $workbook=NULL)
Unset an instance of this class.
static getTRUE()
Return the locale-specific translation of TRUE.
static $_localeArgumentSeparator
const CALCULATION_REGEXP_NAMEDRANGE
static _wrapResult($value)
Wrap string values in quotes.
strcmpLowercaseFirst($str1, $str2)
Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters.
_parseFormula($formula, PHPExcel_Cell $pCell=NULL)
_showTypeDetails($value)
Format type and details of an operand for display in the log (based on operand type)
getCalculationCacheEnabled()
Is calculation caching enabled?
clearCalculationCache()
Clear calculation cache.
const CALCULATION_REGEXP_NUMBER
Constants
static _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)
calculateCellValue(PHPExcel_Cell $pCell=NULL, $resetLog=TRUE)
Calculate the value of a cell formula.
getValueFromCache($cellReference, &$cellValue)
static $_validLocaleLanguages
extractCellRange(&$pRange='A1', PHPExcel_Worksheet $pSheet=NULL, $resetLog=TRUE)
Extract range values.
clearCalculationCacheForWorksheet($worksheetName)
Clear calculation cache for a specified worksheet.
_showValue($value)
Format details of an operand for display in the log (based on operand type)
static $functionReplaceToExcel
const CALCULATION_REGEXP_ERROR
listFunctionNames()
Get a list of implemented Excel function names.
static _localeFunc($function)
calculateFormula($formula, $cellID=NULL, PHPExcel_Cell $pCell=NULL)
Calculate the value of a formula.
getLocale()
Get the currently defined locale code.
_executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack)
static extractAllCellReferencesInRange($pRange='A1')
Extract all cell references in range.
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
static coordinateFromString($pCoordinateString='A1')
Coordinate from string.
static splitRange($pRange='A1:A1')
Split range into coordinate strings.
static columnIndexFromString($pString='A')
Column index from string.
static resolveRange($pNamedRange='', PHPExcel_Worksheet $pSheet)
Resolve a named range to a regular cell range.
static convertToNumberIfFraction(&$operand)
Identify whether a string contains a fractional numeric value, and convert it to a numeric if it is.
static StrCaseReverse($pValue='')
Reverse the case of a string, so that all uppercase characters become lowercase and all lowercase cha...
static extractSheetTitle($pRange, $returnRange=false)
Extract worksheet title from range.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'