123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392 |
- <?php
- if (!defined('PHPEXCEL_ROOT')) {
-
- define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
- require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
- }
- if (!defined('CALCULATION_REGEXP_CELLREF')) {
-
- if (defined('PREG_BAD_UTF8_ERROR')) {
-
- define('CALCULATION_REGEXP_CELLREF', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})');
-
- define('CALCULATION_REGEXP_NAMEDRANGE', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)');
- } else {
-
- define('CALCULATION_REGEXP_CELLREF', '(((\w*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+)');
-
- define('CALCULATION_REGEXP_NAMEDRANGE', '(((\w*)|(\'.*\')|(\".*\"))!)?([_A-Z][_A-Z0-9\.]*)');
- }
- }
- class PHPExcel_Calculation
- {
-
-
-
- const CALCULATION_REGEXP_NUMBER = '[-+]?\d*\.?\d+(e[-+]?\d+)?';
-
- const CALCULATION_REGEXP_STRING = '"(?:[^"]|"")*"';
-
- const CALCULATION_REGEXP_OPENBRACE = '\(';
-
- const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\(';
-
- const CALCULATION_REGEXP_CELLREF = CALCULATION_REGEXP_CELLREF;
-
- const CALCULATION_REGEXP_NAMEDRANGE = CALCULATION_REGEXP_NAMEDRANGE;
-
- const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?';
-
- const RETURN_ARRAY_AS_ERROR = 'error';
- const RETURN_ARRAY_AS_VALUE = 'value';
- const RETURN_ARRAY_AS_ARRAY = 'array';
- private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE;
-
- private static $instance;
-
- private $workbook;
-
- private static $workbookSets;
-
- private $calculationCache = array ();
-
- private $calculationCacheEnabled = true;
-
- private static $operators = array(
- '+' => true, '-' => true, '*' => true, '/' => true,
- '^' => true, '&' => true, '%' => false, '~' => false,
- '>' => true, '<' => true, '=' => true, '>=' => true,
- '<=' => true, '<>' => true, '|' => true, ':' => true
- );
-
- private static $binaryOperators = array(
- '+' => true, '-' => true, '*' => true, '/' => true,
- '^' => true, '&' => true, '>' => true, '<' => true,
- '=' => true, '>=' => true, '<=' => true, '<>' => true,
- '|' => true, ':' => true
- );
-
- private $debugLog;
-
- public $suppressFormulaErrors = false;
-
- public $formulaError = null;
-
- private $cyclicReferenceStack;
- private $cellStack = array();
-
- private $cyclicFormulaCounter = 1;
- private $cyclicFormulaCell = '';
-
- public $cyclicFormulaCount = 1;
-
- private $delta = 0.1e-12;
-
- private static $localeLanguage = 'en_us';
-
- private static $validLocaleLanguages = array(
- 'en'
- );
-
- private static $localeArgumentSeparator = ',';
- private static $localeFunctions = array();
-
- public static $localeBoolean = array(
- 'TRUE' => 'TRUE',
- 'FALSE' => 'FALSE',
- 'NULL' => 'NULL'
- );
-
- private static $excelConstants = array(
- 'TRUE' => true,
- 'FALSE' => false,
- 'NULL' => null
- );
-
- private static $PHPExcelFunctions = array(
- 'ABS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'abs',
- 'argumentCount' => '1'
- ),
- 'ACCRINT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINT',
- 'argumentCount' => '4-7'
- ),
- 'ACCRINTM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::ACCRINTM',
- 'argumentCount' => '3-5'
- ),
- 'ACOS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'acos',
- 'argumentCount' => '1'
- ),
- 'ACOSH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'acosh',
- 'argumentCount' => '1'
- ),
- 'ADDRESS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::CELL_ADDRESS',
- 'argumentCount' => '2-5'
- ),
- 'AMORDEGRC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::AMORDEGRC',
- 'argumentCount' => '6,7'
- ),
- 'AMORLINC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::AMORLINC',
- 'argumentCount' => '6,7'
- ),
- 'AND' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
- 'functionCall' => 'PHPExcel_Calculation_Logical::LOGICAL_AND',
- 'argumentCount' => '1+'
- ),
- 'AREAS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1'
- ),
- 'ASC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1'
- ),
- 'ASIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'asin',
- 'argumentCount' => '1'
- ),
- 'ASINH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'asinh',
- 'argumentCount' => '1'
- ),
- 'ATAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'atan',
- 'argumentCount' => '1'
- ),
- 'ATAN2' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::ATAN2',
- 'argumentCount' => '2'
- ),
- 'ATANH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'atanh',
- 'argumentCount' => '1'
- ),
- 'AVEDEV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::AVEDEV',
- 'argumentCount' => '1+'
- ),
- 'AVERAGE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGE',
- 'argumentCount' => '1+'
- ),
- 'AVERAGEA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGEA',
- 'argumentCount' => '1+'
- ),
- 'AVERAGEIF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::AVERAGEIF',
- 'argumentCount' => '2,3'
- ),
- 'AVERAGEIFS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '3+'
- ),
- 'BAHTTEXT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1'
- ),
- 'BESSELI' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELI',
- 'argumentCount' => '2'
- ),
- 'BESSELJ' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELJ',
- 'argumentCount' => '2'
- ),
- 'BESSELK' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELK',
- 'argumentCount' => '2'
- ),
- 'BESSELY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::BESSELY',
- 'argumentCount' => '2'
- ),
- 'BETADIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::BETADIST',
- 'argumentCount' => '3-5'
- ),
- 'BETAINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::BETAINV',
- 'argumentCount' => '3-5'
- ),
- 'BIN2DEC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::BINTODEC',
- 'argumentCount' => '1'
- ),
- 'BIN2HEX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::BINTOHEX',
- 'argumentCount' => '1,2'
- ),
- 'BIN2OCT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::BINTOOCT',
- 'argumentCount' => '1,2'
- ),
- 'BINOMDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::BINOMDIST',
- 'argumentCount' => '4'
- ),
- 'CEILING' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::CEILING',
- 'argumentCount' => '2'
- ),
- 'CELL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1,2'
- ),
- 'CHAR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::CHARACTER',
- 'argumentCount' => '1'
- ),
- 'CHIDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::CHIDIST',
- 'argumentCount' => '2'
- ),
- 'CHIINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::CHIINV',
- 'argumentCount' => '2'
- ),
- 'CHITEST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2'
- ),
- 'CHOOSE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::CHOOSE',
- 'argumentCount' => '2+'
- ),
- 'CLEAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::TRIMNONPRINTABLE',
- 'argumentCount' => '1'
- ),
- 'CODE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::ASCIICODE',
- 'argumentCount' => '1'
- ),
- 'COLUMN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMN',
- 'argumentCount' => '-1',
- 'passByReference' => array(true)
- ),
- 'COLUMNS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMNS',
- 'argumentCount' => '1'
- ),
- 'COMBIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::COMBIN',
- 'argumentCount' => '2'
- ),
- 'COMPLEX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::COMPLEX',
- 'argumentCount' => '2,3'
- ),
- 'CONCATENATE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::CONCATENATE',
- 'argumentCount' => '1+'
- ),
- 'CONFIDENCE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::CONFIDENCE',
- 'argumentCount' => '3'
- ),
- 'CONVERT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::CONVERTUOM',
- 'argumentCount' => '3'
- ),
- 'CORREL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::CORREL',
- 'argumentCount' => '2'
- ),
- 'COS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'cos',
- 'argumentCount' => '1'
- ),
- 'COSH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'cosh',
- 'argumentCount' => '1'
- ),
- 'COUNT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNT',
- 'argumentCount' => '1+'
- ),
- 'COUNTA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTA',
- 'argumentCount' => '1+'
- ),
- 'COUNTBLANK' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTBLANK',
- 'argumentCount' => '1'
- ),
- 'COUNTIF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::COUNTIF',
- 'argumentCount' => '2'
- ),
- 'COUNTIFS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2'
- ),
- 'COUPDAYBS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYBS',
- 'argumentCount' => '3,4'
- ),
- 'COUPDAYS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYS',
- 'argumentCount' => '3,4'
- ),
- 'COUPDAYSNC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::COUPDAYSNC',
- 'argumentCount' => '3,4'
- ),
- 'COUPNCD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::COUPNCD',
- 'argumentCount' => '3,4'
- ),
- 'COUPNUM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::COUPNUM',
- 'argumentCount' => '3,4'
- ),
- 'COUPPCD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::COUPPCD',
- 'argumentCount' => '3,4'
- ),
- 'COVAR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::COVAR',
- 'argumentCount' => '2'
- ),
- 'CRITBINOM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::CRITBINOM',
- 'argumentCount' => '3'
- ),
- 'CUBEKPIMEMBER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '?'
- ),
- 'CUBEMEMBER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '?'
- ),
- 'CUBEMEMBERPROPERTY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '?'
- ),
- 'CUBERANKEDMEMBER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '?'
- ),
- 'CUBESET' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '?'
- ),
- 'CUBESETCOUNT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '?'
- ),
- 'CUBEVALUE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_CUBE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '?'
- ),
- 'CUMIPMT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::CUMIPMT',
- 'argumentCount' => '6'
- ),
- 'CUMPRINC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::CUMPRINC',
- 'argumentCount' => '6'
- ),
- 'DATE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DATE',
- 'argumentCount' => '3'
- ),
- 'DATEDIF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DATEDIF',
- 'argumentCount' => '2,3'
- ),
- 'DATEVALUE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DATEVALUE',
- 'argumentCount' => '1'
- ),
- 'DAVERAGE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DAVERAGE',
- 'argumentCount' => '3'
- ),
- 'DAY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DAYOFMONTH',
- 'argumentCount' => '1'
- ),
- 'DAYS360' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DAYS360',
- 'argumentCount' => '2,3'
- ),
- 'DB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::DB',
- 'argumentCount' => '4,5'
- ),
- 'DCOUNT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DCOUNT',
- 'argumentCount' => '3'
- ),
- 'DCOUNTA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DCOUNTA',
- 'argumentCount' => '3'
- ),
- 'DDB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::DDB',
- 'argumentCount' => '4,5'
- ),
- 'DEC2BIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOBIN',
- 'argumentCount' => '1,2'
- ),
- 'DEC2HEX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOHEX',
- 'argumentCount' => '1,2'
- ),
- 'DEC2OCT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::DECTOOCT',
- 'argumentCount' => '1,2'
- ),
- 'DEGREES' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'rad2deg',
- 'argumentCount' => '1'
- ),
- 'DELTA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::DELTA',
- 'argumentCount' => '1,2'
- ),
- 'DEVSQ' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::DEVSQ',
- 'argumentCount' => '1+'
- ),
- 'DGET' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DGET',
- 'argumentCount' => '3'
- ),
- 'DISC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::DISC',
- 'argumentCount' => '4,5'
- ),
- 'DMAX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DMAX',
- 'argumentCount' => '3'
- ),
- 'DMIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DMIN',
- 'argumentCount' => '3'
- ),
- 'DOLLAR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::DOLLAR',
- 'argumentCount' => '1,2'
- ),
- 'DOLLARDE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::DOLLARDE',
- 'argumentCount' => '2'
- ),
- 'DOLLARFR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::DOLLARFR',
- 'argumentCount' => '2'
- ),
- 'DPRODUCT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DPRODUCT',
- 'argumentCount' => '3'
- ),
- 'DSTDEV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DSTDEV',
- 'argumentCount' => '3'
- ),
- 'DSTDEVP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DSTDEVP',
- 'argumentCount' => '3'
- ),
- 'DSUM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DSUM',
- 'argumentCount' => '3'
- ),
- 'DURATION' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '5,6'
- ),
- 'DVAR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DVAR',
- 'argumentCount' => '3'
- ),
- 'DVARP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATABASE,
- 'functionCall' => 'PHPExcel_Calculation_Database::DVARP',
- 'argumentCount' => '3'
- ),
- 'EDATE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::EDATE',
- 'argumentCount' => '2'
- ),
- 'EFFECT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::EFFECT',
- 'argumentCount' => '2'
- ),
- 'EOMONTH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::EOMONTH',
- 'argumentCount' => '2'
- ),
- 'ERF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::ERF',
- 'argumentCount' => '1,2'
- ),
- 'ERFC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::ERFC',
- 'argumentCount' => '1'
- ),
- 'ERROR.TYPE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::ERROR_TYPE',
- 'argumentCount' => '1'
- ),
- 'EVEN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::EVEN',
- 'argumentCount' => '1'
- ),
- 'EXACT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2'
- ),
- 'EXP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'exp',
- 'argumentCount' => '1'
- ),
- 'EXPONDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::EXPONDIST',
- 'argumentCount' => '3'
- ),
- 'FACT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::FACT',
- 'argumentCount' => '1'
- ),
- 'FACTDOUBLE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::FACTDOUBLE',
- 'argumentCount' => '1'
- ),
- 'FALSE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
- 'functionCall' => 'PHPExcel_Calculation_Logical::FALSE',
- 'argumentCount' => '0'
- ),
- 'FDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '3'
- ),
- 'FIND' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHSENSITIVE',
- 'argumentCount' => '2,3'
- ),
- 'FINDB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHSENSITIVE',
- 'argumentCount' => '2,3'
- ),
- 'FINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '3'
- ),
- 'FISHER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::FISHER',
- 'argumentCount' => '1'
- ),
- 'FISHERINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::FISHERINV',
- 'argumentCount' => '1'
- ),
- 'FIXED' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::FIXEDFORMAT',
- 'argumentCount' => '1-3'
- ),
- 'FLOOR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::FLOOR',
- 'argumentCount' => '2'
- ),
- 'FORECAST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::FORECAST',
- 'argumentCount' => '3'
- ),
- 'FREQUENCY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2'
- ),
- 'FTEST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2'
- ),
- 'FV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::FV',
- 'argumentCount' => '3-5'
- ),
- 'FVSCHEDULE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::FVSCHEDULE',
- 'argumentCount' => '2'
- ),
- 'GAMMADIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMADIST',
- 'argumentCount' => '4'
- ),
- 'GAMMAINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMAINV',
- 'argumentCount' => '3'
- ),
- 'GAMMALN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::GAMMALN',
- 'argumentCount' => '1'
- ),
- 'GCD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::GCD',
- 'argumentCount' => '1+'
- ),
- 'GEOMEAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::GEOMEAN',
- 'argumentCount' => '1+'
- ),
- 'GESTEP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::GESTEP',
- 'argumentCount' => '1,2'
- ),
- 'GETPIVOTDATA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2+'
- ),
- 'GROWTH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::GROWTH',
- 'argumentCount' => '1-4'
- ),
- 'HARMEAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::HARMEAN',
- 'argumentCount' => '1+'
- ),
- 'HEX2BIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTOBIN',
- 'argumentCount' => '1,2'
- ),
- 'HEX2DEC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTODEC',
- 'argumentCount' => '1'
- ),
- 'HEX2OCT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::HEXTOOCT',
- 'argumentCount' => '1,2'
- ),
- 'HLOOKUP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::HLOOKUP',
- 'argumentCount' => '3,4'
- ),
- 'HOUR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::HOUROFDAY',
- 'argumentCount' => '1'
- ),
- 'HYPERLINK' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::HYPERLINK',
- 'argumentCount' => '1,2',
- 'passCellReference' => true
- ),
- 'HYPGEOMDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::HYPGEOMDIST',
- 'argumentCount' => '4'
- ),
- 'IF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
- 'functionCall' => 'PHPExcel_Calculation_Logical::STATEMENT_IF',
- 'argumentCount' => '1-3'
- ),
- 'IFERROR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
- 'functionCall' => 'PHPExcel_Calculation_Logical::IFERROR',
- 'argumentCount' => '2'
- ),
- 'IMABS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMABS',
- 'argumentCount' => '1'
- ),
- 'IMAGINARY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMAGINARY',
- 'argumentCount' => '1'
- ),
- 'IMARGUMENT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMARGUMENT',
- 'argumentCount' => '1'
- ),
- 'IMCONJUGATE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMCONJUGATE',
- 'argumentCount' => '1'
- ),
- 'IMCOS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMCOS',
- 'argumentCount' => '1'
- ),
- 'IMDIV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMDIV',
- 'argumentCount' => '2'
- ),
- 'IMEXP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMEXP',
- 'argumentCount' => '1'
- ),
- 'IMLN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMLN',
- 'argumentCount' => '1'
- ),
- 'IMLOG10' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMLOG10',
- 'argumentCount' => '1'
- ),
- 'IMLOG2' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMLOG2',
- 'argumentCount' => '1'
- ),
- 'IMPOWER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMPOWER',
- 'argumentCount' => '2'
- ),
- 'IMPRODUCT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMPRODUCT',
- 'argumentCount' => '1+'
- ),
- 'IMREAL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMREAL',
- 'argumentCount' => '1'
- ),
- 'IMSIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSIN',
- 'argumentCount' => '1'
- ),
- 'IMSQRT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSQRT',
- 'argumentCount' => '1'
- ),
- 'IMSUB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSUB',
- 'argumentCount' => '2'
- ),
- 'IMSUM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::IMSUM',
- 'argumentCount' => '1+'
- ),
- 'INDEX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::INDEX',
- 'argumentCount' => '1-4'
- ),
- 'INDIRECT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::INDIRECT',
- 'argumentCount' => '1,2',
- 'passCellReference' => true
- ),
- 'INFO' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1'
- ),
- 'INT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::INT',
- 'argumentCount' => '1'
- ),
- 'INTERCEPT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::INTERCEPT',
- 'argumentCount' => '2'
- ),
- 'INTRATE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::INTRATE',
- 'argumentCount' => '4,5'
- ),
- 'IPMT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::IPMT',
- 'argumentCount' => '4-6'
- ),
- 'IRR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::IRR',
- 'argumentCount' => '1,2'
- ),
- 'ISBLANK' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_BLANK',
- 'argumentCount' => '1'
- ),
- 'ISERR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERR',
- 'argumentCount' => '1'
- ),
- 'ISERROR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ERROR',
- 'argumentCount' => '1'
- ),
- 'ISEVEN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_EVEN',
- 'argumentCount' => '1'
- ),
- 'ISLOGICAL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_LOGICAL',
- 'argumentCount' => '1'
- ),
- 'ISNA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NA',
- 'argumentCount' => '1'
- ),
- 'ISNONTEXT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NONTEXT',
- 'argumentCount' => '1'
- ),
- 'ISNUMBER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_NUMBER',
- 'argumentCount' => '1'
- ),
- 'ISODD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_ODD',
- 'argumentCount' => '1'
- ),
- 'ISPMT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::ISPMT',
- 'argumentCount' => '4'
- ),
- 'ISREF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1'
- ),
- 'ISTEXT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::IS_TEXT',
- 'argumentCount' => '1'
- ),
- 'JIS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1'
- ),
- 'KURT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::KURT',
- 'argumentCount' => '1+'
- ),
- 'LARGE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::LARGE',
- 'argumentCount' => '2'
- ),
- 'LCM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::LCM',
- 'argumentCount' => '1+'
- ),
- 'LEFT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::LEFT',
- 'argumentCount' => '1,2'
- ),
- 'LEFTB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::LEFT',
- 'argumentCount' => '1,2'
- ),
- 'LEN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::STRINGLENGTH',
- 'argumentCount' => '1'
- ),
- 'LENB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::STRINGLENGTH',
- 'argumentCount' => '1'
- ),
- 'LINEST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::LINEST',
- 'argumentCount' => '1-4'
- ),
- 'LN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'log',
- 'argumentCount' => '1'
- ),
- 'LOG' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::LOG_BASE',
- 'argumentCount' => '1,2'
- ),
- 'LOG10' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'log10',
- 'argumentCount' => '1'
- ),
- 'LOGEST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::LOGEST',
- 'argumentCount' => '1-4'
- ),
- 'LOGINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::LOGINV',
- 'argumentCount' => '3'
- ),
- 'LOGNORMDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::LOGNORMDIST',
- 'argumentCount' => '3'
- ),
- 'LOOKUP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::LOOKUP',
- 'argumentCount' => '2,3'
- ),
- 'LOWER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::LOWERCASE',
- 'argumentCount' => '1'
- ),
- 'MATCH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::MATCH',
- 'argumentCount' => '2,3'
- ),
- 'MAX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MAX',
- 'argumentCount' => '1+'
- ),
- 'MAXA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MAXA',
- 'argumentCount' => '1+'
- ),
- 'MAXIF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MAXIF',
- 'argumentCount' => '2+'
- ),
- 'MDETERM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::MDETERM',
- 'argumentCount' => '1'
- ),
- 'MDURATION' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '5,6'
- ),
- 'MEDIAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MEDIAN',
- 'argumentCount' => '1+'
- ),
- 'MEDIANIF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2+'
- ),
- 'MID' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::MID',
- 'argumentCount' => '3'
- ),
- 'MIDB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::MID',
- 'argumentCount' => '3'
- ),
- 'MIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MIN',
- 'argumentCount' => '1+'
- ),
- 'MINA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MINA',
- 'argumentCount' => '1+'
- ),
- 'MINIF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MINIF',
- 'argumentCount' => '2+'
- ),
- 'MINUTE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::MINUTEOFHOUR',
- 'argumentCount' => '1'
- ),
- 'MINVERSE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::MINVERSE',
- 'argumentCount' => '1'
- ),
- 'MIRR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::MIRR',
- 'argumentCount' => '3'
- ),
- 'MMULT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::MMULT',
- 'argumentCount' => '2'
- ),
- 'MOD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::MOD',
- 'argumentCount' => '2'
- ),
- 'MODE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::MODE',
- 'argumentCount' => '1+'
- ),
- 'MONTH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::MONTHOFYEAR',
- 'argumentCount' => '1'
- ),
- 'MROUND' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::MROUND',
- 'argumentCount' => '2'
- ),
- 'MULTINOMIAL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::MULTINOMIAL',
- 'argumentCount' => '1+'
- ),
- 'N' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::N',
- 'argumentCount' => '1'
- ),
- 'NA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::NA',
- 'argumentCount' => '0'
- ),
- 'NEGBINOMDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::NEGBINOMDIST',
- 'argumentCount' => '3'
- ),
- 'NETWORKDAYS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::NETWORKDAYS',
- 'argumentCount' => '2+'
- ),
- 'NOMINAL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::NOMINAL',
- 'argumentCount' => '2'
- ),
- 'NORMDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMDIST',
- 'argumentCount' => '4'
- ),
- 'NORMINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMINV',
- 'argumentCount' => '3'
- ),
- 'NORMSDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMSDIST',
- 'argumentCount' => '1'
- ),
- 'NORMSINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::NORMSINV',
- 'argumentCount' => '1'
- ),
- 'NOT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
- 'functionCall' => 'PHPExcel_Calculation_Logical::NOT',
- 'argumentCount' => '1'
- ),
- 'NOW' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DATETIMENOW',
- 'argumentCount' => '0'
- ),
- 'NPER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::NPER',
- 'argumentCount' => '3-5'
- ),
- 'NPV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::NPV',
- 'argumentCount' => '2+'
- ),
- 'OCT2BIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTOBIN',
- 'argumentCount' => '1,2'
- ),
- 'OCT2DEC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTODEC',
- 'argumentCount' => '1'
- ),
- 'OCT2HEX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_ENGINEERING,
- 'functionCall' => 'PHPExcel_Calculation_Engineering::OCTTOHEX',
- 'argumentCount' => '1,2'
- ),
- 'ODD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::ODD',
- 'argumentCount' => '1'
- ),
- 'ODDFPRICE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '8,9'
- ),
- 'ODDFYIELD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '8,9'
- ),
- 'ODDLPRICE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '7,8'
- ),
- 'ODDLYIELD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '7,8'
- ),
- 'OFFSET' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::OFFSET',
- 'argumentCount' => '3-5',
- 'passCellReference' => true,
- 'passByReference' => array(true)
- ),
- 'OR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
- 'functionCall' => 'PHPExcel_Calculation_Logical::LOGICAL_OR',
- 'argumentCount' => '1+'
- ),
- 'PEARSON' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::CORREL',
- 'argumentCount' => '2'
- ),
- 'PERCENTILE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::PERCENTILE',
- 'argumentCount' => '2'
- ),
- 'PERCENTRANK' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::PERCENTRANK',
- 'argumentCount' => '2,3'
- ),
- 'PERMUT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::PERMUT',
- 'argumentCount' => '2'
- ),
- 'PHONETIC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1'
- ),
- 'PI' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'pi',
- 'argumentCount' => '0'
- ),
- 'PMT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::PMT',
- 'argumentCount' => '3-5'
- ),
- 'POISSON' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::POISSON',
- 'argumentCount' => '3'
- ),
- 'POWER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::POWER',
- 'argumentCount' => '2'
- ),
- 'PPMT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::PPMT',
- 'argumentCount' => '4-6'
- ),
- 'PRICE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::PRICE',
- 'argumentCount' => '6,7'
- ),
- 'PRICEDISC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::PRICEDISC',
- 'argumentCount' => '4,5'
- ),
- 'PRICEMAT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::PRICEMAT',
- 'argumentCount' => '5,6'
- ),
- 'PROB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '3,4'
- ),
- 'PRODUCT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::PRODUCT',
- 'argumentCount' => '1+'
- ),
- 'PROPER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::PROPERCASE',
- 'argumentCount' => '1'
- ),
- 'PV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::PV',
- 'argumentCount' => '3-5'
- ),
- 'QUARTILE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::QUARTILE',
- 'argumentCount' => '2'
- ),
- 'QUOTIENT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::QUOTIENT',
- 'argumentCount' => '2'
- ),
- 'RADIANS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'deg2rad',
- 'argumentCount' => '1'
- ),
- 'RAND' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::RAND',
- 'argumentCount' => '0'
- ),
- 'RANDBETWEEN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::RAND',
- 'argumentCount' => '2'
- ),
- 'RANK' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::RANK',
- 'argumentCount' => '2,3'
- ),
- 'RATE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::RATE',
- 'argumentCount' => '3-6'
- ),
- 'RECEIVED' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::RECEIVED',
- 'argumentCount' => '4-5'
- ),
- 'REPLACE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::REPLACE',
- 'argumentCount' => '4'
- ),
- 'REPLACEB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::REPLACE',
- 'argumentCount' => '4'
- ),
- 'REPT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'str_repeat',
- 'argumentCount' => '2'
- ),
- 'RIGHT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::RIGHT',
- 'argumentCount' => '1,2'
- ),
- 'RIGHTB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::RIGHT',
- 'argumentCount' => '1,2'
- ),
- 'ROMAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::ROMAN',
- 'argumentCount' => '1,2'
- ),
- 'ROUND' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'round',
- 'argumentCount' => '2'
- ),
- 'ROUNDDOWN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::ROUNDDOWN',
- 'argumentCount' => '2'
- ),
- 'ROUNDUP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::ROUNDUP',
- 'argumentCount' => '2'
- ),
- 'ROW' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::ROW',
- 'argumentCount' => '-1',
- 'passByReference' => array(true)
- ),
- 'ROWS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::ROWS',
- 'argumentCount' => '1'
- ),
- 'RSQ' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::RSQ',
- 'argumentCount' => '2'
- ),
- 'RTD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '1+'
- ),
- 'SEARCH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE',
- 'argumentCount' => '2,3'
- ),
- 'SEARCHB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::SEARCHINSENSITIVE',
- 'argumentCount' => '2,3'
- ),
- 'SECOND' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::SECONDOFMINUTE',
- 'argumentCount' => '1'
- ),
- 'SERIESSUM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SERIESSUM',
- 'argumentCount' => '4'
- ),
- 'SIGN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SIGN',
- 'argumentCount' => '1'
- ),
- 'SIN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'sin',
- 'argumentCount' => '1'
- ),
- 'SINH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'sinh',
- 'argumentCount' => '1'
- ),
- 'SKEW' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::SKEW',
- 'argumentCount' => '1+'
- ),
- 'SLN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::SLN',
- 'argumentCount' => '3'
- ),
- 'SLOPE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::SLOPE',
- 'argumentCount' => '2'
- ),
- 'SMALL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::SMALL',
- 'argumentCount' => '2'
- ),
- 'SQRT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'sqrt',
- 'argumentCount' => '1'
- ),
- 'SQRTPI' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SQRTPI',
- 'argumentCount' => '1'
- ),
- 'STANDARDIZE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::STANDARDIZE',
- 'argumentCount' => '3'
- ),
- 'STDEV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEV',
- 'argumentCount' => '1+'
- ),
- 'STDEVA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVA',
- 'argumentCount' => '1+'
- ),
- 'STDEVP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVP',
- 'argumentCount' => '1+'
- ),
- 'STDEVPA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::STDEVPA',
- 'argumentCount' => '1+'
- ),
- 'STEYX' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::STEYX',
- 'argumentCount' => '2'
- ),
- 'SUBSTITUTE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::SUBSTITUTE',
- 'argumentCount' => '3,4'
- ),
- 'SUBTOTAL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUBTOTAL',
- 'argumentCount' => '2+'
- ),
- 'SUM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUM',
- 'argumentCount' => '1+'
- ),
- 'SUMIF' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMIF',
- 'argumentCount' => '2,3'
- ),
- 'SUMIFS' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMIFS',
- 'argumentCount' => '3+'
- ),
- 'SUMPRODUCT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMPRODUCT',
- 'argumentCount' => '1+'
- ),
- 'SUMSQ' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMSQ',
- 'argumentCount' => '1+'
- ),
- 'SUMX2MY2' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMX2MY2',
- 'argumentCount' => '2'
- ),
- 'SUMX2PY2' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMX2PY2',
- 'argumentCount' => '2'
- ),
- 'SUMXMY2' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::SUMXMY2',
- 'argumentCount' => '2'
- ),
- 'SYD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::SYD',
- 'argumentCount' => '4'
- ),
- 'T' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::RETURNSTRING',
- 'argumentCount' => '1'
- ),
- 'TAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'tan',
- 'argumentCount' => '1'
- ),
- 'TANH' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'tanh',
- 'argumentCount' => '1'
- ),
- 'TBILLEQ' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::TBILLEQ',
- 'argumentCount' => '3'
- ),
- 'TBILLPRICE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::TBILLPRICE',
- 'argumentCount' => '3'
- ),
- 'TBILLYIELD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::TBILLYIELD',
- 'argumentCount' => '3'
- ),
- 'TDIST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::TDIST',
- 'argumentCount' => '3'
- ),
- 'TEXT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::TEXTFORMAT',
- 'argumentCount' => '2'
- ),
- 'TIME' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::TIME',
- 'argumentCount' => '3'
- ),
- 'TIMEVALUE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::TIMEVALUE',
- 'argumentCount' => '1'
- ),
- 'TINV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::TINV',
- 'argumentCount' => '2'
- ),
- 'TODAY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DATENOW',
- 'argumentCount' => '0'
- ),
- 'TRANSPOSE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::TRANSPOSE',
- 'argumentCount' => '1'
- ),
- 'TREND' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::TREND',
- 'argumentCount' => '1-4'
- ),
- 'TRIM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::TRIMSPACES',
- 'argumentCount' => '1'
- ),
- 'TRIMMEAN' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::TRIMMEAN',
- 'argumentCount' => '2'
- ),
- 'TRUE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL,
- 'functionCall' => 'PHPExcel_Calculation_Logical::TRUE',
- 'argumentCount' => '0'
- ),
- 'TRUNC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
- 'functionCall' => 'PHPExcel_Calculation_MathTrig::TRUNC',
- 'argumentCount' => '1,2'
- ),
- 'TTEST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '4'
- ),
- 'TYPE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::TYPE',
- 'argumentCount' => '1'
- ),
- 'UPPER' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::UPPERCASE',
- 'argumentCount' => '1'
- ),
- 'USDOLLAR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '2'
- ),
- 'VALUE' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_TEXT_AND_DATA,
- 'functionCall' => 'PHPExcel_Calculation_TextData::VALUE',
- 'argumentCount' => '1'
- ),
- 'VAR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::VARFunc',
- 'argumentCount' => '1+'
- ),
- 'VARA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::VARA',
- 'argumentCount' => '1+'
- ),
- 'VARP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::VARP',
- 'argumentCount' => '1+'
- ),
- 'VARPA' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::VARPA',
- 'argumentCount' => '1+'
- ),
- 'VDB' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '5-7'
- ),
- 'VERSION' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION,
- 'functionCall' => 'PHPExcel_Calculation_Functions::VERSION',
- 'argumentCount' => '0'
- ),
- 'VLOOKUP' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
- 'functionCall' => 'PHPExcel_Calculation_LookupRef::VLOOKUP',
- 'argumentCount' => '3,4'
- ),
- 'WEEKDAY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::DAYOFWEEK',
- 'argumentCount' => '1,2'
- ),
- 'WEEKNUM' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::WEEKOFYEAR',
- 'argumentCount' => '1,2'
- ),
- 'WEIBULL' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::WEIBULL',
- 'argumentCount' => '4'
- ),
- 'WORKDAY' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::WORKDAY',
- 'argumentCount' => '2+'
- ),
- 'XIRR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::XIRR',
- 'argumentCount' => '2,3'
- ),
- 'XNPV' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::XNPV',
- 'argumentCount' => '3'
- ),
- 'YEAR' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::YEAR',
- 'argumentCount' => '1'
- ),
- 'YEARFRAC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME,
- 'functionCall' => 'PHPExcel_Calculation_DateTime::YEARFRAC',
- 'argumentCount' => '2,3'
- ),
- 'YIELD' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY',
- 'argumentCount' => '6,7'
- ),
- 'YIELDDISC' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::YIELDDISC',
- 'argumentCount' => '4,5'
- ),
- 'YIELDMAT' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_FINANCIAL,
- 'functionCall' => 'PHPExcel_Calculation_Financial::YIELDMAT',
- 'argumentCount' => '5,6'
- ),
- 'ZTEST' => array(
- 'category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL,
- 'functionCall' => 'PHPExcel_Calculation_Statistical::ZTEST',
- 'argumentCount' => '2-3'
- )
- );
-
- private static $controlFunctions = array(
- 'MKMATRIX' => array(
- 'argumentCount' => '*',
- 'functionCall' => 'self::mkMatrix'
- )
- );
- public function __construct(PHPExcel $workbook = null)
- {
- $this->delta = 1 * pow(10, 0 - ini_get('precision'));
- $this->workbook = $workbook;
- $this->cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
- $this->_debugLog = new PHPExcel_CalcEngine_Logger($this->cyclicReferenceStack);
- }
- private static function loadLocales()
- {
- $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
- foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
- $filename = substr($filename, strlen($localeFileDirectory)+1);
- if ($filename != 'en') {
- self::$validLocaleLanguages[] = $filename;
- }
- }
- }
-
- public static function getInstance(PHPExcel $workbook = null)
- {
- if ($workbook !== null) {
- $instance = $workbook->getCalculationEngine();
- if (isset($instance)) {
- return $instance;
- }
- }
- if (!isset(self::$instance) || (self::$instance === null)) {
- self::$instance = new PHPExcel_Calculation();
- }
- return self::$instance;
- }
-
- public function __destruct()
- {
- $this->workbook = null;
- }
-
- public function flushInstance()
- {
- $this->clearCalculationCache();
- }
-
- public function getDebugLog()
- {
- return $this->_debugLog;
- }
-
- final public function __clone()
- {
- throw new PHPExcel_Calculation_Exception('Cloning the calculation engine is not allowed!');
- }
-
- public static function getTRUE()
- {
- return self::$localeBoolean['TRUE'];
- }
-
- public static function getFALSE()
- {
- return self::$localeBoolean['FALSE'];
- }
-
- public static function setArrayReturnType($returnType)
- {
- if (($returnType == self::RETURN_ARRAY_AS_VALUE) ||
- ($returnType == self::RETURN_ARRAY_AS_ERROR) ||
- ($returnType == self::RETURN_ARRAY_AS_ARRAY)) {
- self::$returnArrayAsType = $returnType;
- return true;
- }
- return false;
- }
-
- public static function getArrayReturnType()
- {
- return self::$returnArrayAsType;
- }
-
- public function getCalculationCacheEnabled()
- {
- return $this->calculationCacheEnabled;
- }
-
- public function setCalculationCacheEnabled($pValue = true)
- {
- $this->calculationCacheEnabled = $pValue;
- $this->clearCalculationCache();
- }
-
- public function enableCalculationCache()
- {
- $this->setCalculationCacheEnabled(true);
- }
-
- public function disableCalculationCache()
- {
- $this->setCalculationCacheEnabled(false);
- }
-
- public function clearCalculationCache()
- {
- $this->calculationCache = array();
- }
-
- public function clearCalculationCacheForWorksheet($worksheetName)
- {
- if (isset($this->calculationCache[$worksheetName])) {
- unset($this->calculationCache[$worksheetName]);
- }
- }
-
- public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
- {
- if (isset($this->calculationCache[$fromWorksheetName])) {
- $this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
- unset($this->calculationCache[$fromWorksheetName]);
- }
- }
-
- public function getLocale()
- {
- return self::$localeLanguage;
- }
-
- public function setLocale($locale = 'en_us')
- {
-
- $language = $locale = strtolower($locale);
- if (strpos($locale, '_') !== false) {
- list($language) = explode('_', $locale);
- }
- if (count(self::$validLocaleLanguages) == 1) {
- self::loadLocales();
- }
-
- if (in_array($language, self::$validLocaleLanguages)) {
-
- self::$localeFunctions = array();
- self::$localeArgumentSeparator = ',';
- self::$localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
-
- if ($locale != 'en_us') {
-
- $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'functions';
- if (!file_exists($functionNamesFile)) {
-
- $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions';
- if (!file_exists($functionNamesFile)) {
- return false;
- }
- }
-
- $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
- foreach ($localeFunctions as $localeFunction) {
- list($localeFunction) = explode('##', $localeFunction);
- if (strpos($localeFunction, '=') !== false) {
- list($fName, $lfName) = explode('=', $localeFunction);
- $fName = trim($fName);
- $lfName = trim($lfName);
- if ((isset(self::$PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
- self::$localeFunctions[$fName] = $lfName;
- }
- }
- }
-
- if (isset(self::$localeFunctions['TRUE'])) {
- self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
- }
- if (isset(self::$localeFunctions['FALSE'])) {
- self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE'];
- }
- $configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config';
- if (!file_exists($configFile)) {
- $configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config';
- }
- if (file_exists($configFile)) {
- $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
- foreach ($localeSettings as $localeSetting) {
- list($localeSetting) = explode('##', $localeSetting);
- if (strpos($localeSetting, '=') !== false) {
- list($settingName, $settingValue) = explode('=', $localeSetting);
- $settingName = strtoupper(trim($settingName));
- switch ($settingName) {
- case 'ARGUMENTSEPARATOR':
- self::$localeArgumentSeparator = trim($settingValue);
- break;
- }
- }
- }
- }
- }
- self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
- self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
- self::$localeLanguage = $locale;
- return true;
- }
- return false;
- }
- public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces)
- {
- $strlen = mb_strlen($formula);
- for ($i = 0; $i < $strlen; ++$i) {
- $chr = mb_substr($formula, $i, 1);
- switch ($chr) {
- case '{':
- $inBraces = true;
- break;
- case '}':
- $inBraces = false;
- break;
- case $fromSeparator:
- if (!$inBraces) {
- $formula = mb_substr($formula, 0, $i).$toSeparator.mb_substr($formula, $i+1);
- }
- }
- }
- return $formula;
- }
- private static function translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)
- {
-
- if (self::$localeLanguage !== 'en_us') {
- $inBraces = false;
-
- if (strpos($formula, '"') !== false) {
-
-
- $temp = explode('"', $formula);
- $i = false;
- foreach ($temp as &$value) {
-
- if ($i = !$i) {
- $value = preg_replace($from, $to, $value);
- $value = self::translateSeparator($fromSeparator, $toSeparator, $value, $inBraces);
- }
- }
- unset($value);
-
- $formula = implode('"', $temp);
- } else {
-
- $formula = preg_replace($from, $to, $formula);
- $formula = self::translateSeparator($fromSeparator, $toSeparator, $formula, $inBraces);
- }
- }
- return $formula;
- }
- private static $functionReplaceFromExcel = null;
- private static $functionReplaceToLocale = null;
- public function _translateFormulaToLocale($formula)
- {
- if (self::$functionReplaceFromExcel === null) {
- self::$functionReplaceFromExcel = array();
- foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
- self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
- }
- foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
- self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
- }
- }
- if (self::$functionReplaceToLocale === null) {
- self::$functionReplaceToLocale = array();
- foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
- self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2';
- }
- foreach (array_values(self::$localeBoolean) as $localeBoolean) {
- self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2';
- }
- }
- return self::translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator);
- }
- private static $functionReplaceFromLocale = null;
- private static $functionReplaceToExcel = null;
- public function _translateFormulaToEnglish($formula)
- {
- if (self::$functionReplaceFromLocale === null) {
- self::$functionReplaceFromLocale = array();
- foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
- self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
- }
- foreach (array_values(self::$localeBoolean) as $excelBoolean) {
- self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
- }
- }
- if (self::$functionReplaceToExcel === null) {
- self::$functionReplaceToExcel = array();
- foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
- self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2';
- }
- foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
- self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2';
- }
- }
- return self::translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$localeArgumentSeparator, ',');
- }
- public static function localeFunc($function)
- {
- if (self::$localeLanguage !== 'en_us') {
- $functionName = trim($function, '(');
- if (isset(self::$localeFunctions[$functionName])) {
- $brace = ($functionName != $function);
- $function = self::$localeFunctions[$functionName];
- if ($brace) {
- $function .= '(';
- }
- }
- }
- return $function;
- }
-
- public static function wrapResult($value)
- {
- if (is_string($value)) {
-
- if (preg_match('/^'.self::CALCULATION_REGEXP_ERROR.'$/i', $value, $match)) {
-
- return $value;
- }
-
- return '"'.$value.'"';
-
- } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
- return PHPExcel_Calculation_Functions::NaN();
- }
- return $value;
- }
-
- public static function unwrapResult($value)
- {
- if (is_string($value)) {
- if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) {
- return substr($value, 1, -1);
- }
-
- } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) {
- return PHPExcel_Calculation_Functions::NaN();
- }
- return $value;
- }
-
- public function calculate(PHPExcel_Cell $pCell = null)
- {
- try {
- return $this->calculateCellValue($pCell);
- } catch (PHPExcel_Exception $e) {
- throw new PHPExcel_Calculation_Exception($e->getMessage());
- }
- }
-
- public function calculateCellValue(PHPExcel_Cell $pCell = null, $resetLog = true)
- {
- if ($pCell === null) {
- return null;
- }
- $returnArrayAsType = self::$returnArrayAsType;
- if ($resetLog) {
-
- $this->formulaError = null;
- $this->_debugLog->clearLog();
- $this->cyclicReferenceStack->clear();
- $this->cyclicFormulaCounter = 1;
- self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY;
- }
-
- $this->cellStack[] = array(
- 'sheet' => $pCell->getWorksheet()->getTitle(),
- 'cell' => $pCell->getCoordinate(),
- );
- try {
- $result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
- $cellAddress = array_pop($this->cellStack);
- $this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
- } catch (PHPExcel_Exception $e) {
- $cellAddress = array_pop($this->cellStack);
- $this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
- throw new PHPExcel_Calculation_Exception($e->getMessage());
- }
- if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) {
- self::$returnArrayAsType = $returnArrayAsType;
- $testResult = PHPExcel_Calculation_Functions::flattenArray($result);
- if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) {
- return PHPExcel_Calculation_Functions::VALUE();
- }
-
- if (count($testResult) != 1) {
-
- $r = array_keys($result);
- $r = array_shift($r);
- if (!is_numeric($r)) {
- return PHPExcel_Calculation_Functions::VALUE();
- }
- if (is_array($result[$r])) {
- $c = array_keys($result[$r]);
- $c = array_shift($c);
- if (!is_numeric($c)) {
- return PHPExcel_Calculation_Functions::VALUE();
- }
- }
- }
- $result = array_shift($testResult);
- }
- self::$returnArrayAsType = $returnArrayAsType;
- if ($result === null) {
- return 0;
- } elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
- return PHPExcel_Calculation_Functions::NaN();
- }
- return $result;
- }
-
- public function parseFormula($formula)
- {
-
-
- $formula = trim($formula);
- if ((!isset($formula{0})) || ($formula{0} != '=')) {
- return array();
- }
- $formula = ltrim(substr($formula, 1));
- if (!isset($formula{0})) {
- return array();
- }
-
- return $this->_parseFormula($formula);
- }
-
- public function calculateFormula($formula, $cellID = null, PHPExcel_Cell $pCell = null)
- {
-
- $this->formulaError = null;
- $this->_debugLog->clearLog();
- $this->cyclicReferenceStack->clear();
- if ($this->workbook !== null && $cellID === null && $pCell === null) {
- $cellID = 'A1';
- $pCell = $this->workbook->getActiveSheet()->getCell($cellID);
- } else {
-
-
- $resetCache = $this->getCalculationCacheEnabled();
- $this->calculationCacheEnabled = false;
- }
-
- try {
- $result = self::unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell));
- } catch (PHPExcel_Exception $e) {
- throw new PHPExcel_Calculation_Exception($e->getMessage());
- }
- if ($this->workbook === null) {
-
- $this->calculationCacheEnabled = $resetCache;
- }
- return $result;
- }
- public function getValueFromCache($cellReference, &$cellValue)
- {
-
-
- $this->_debugLog->writeDebugLog('Testing cache value for cell ', $cellReference);
- if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) {
- $this->_debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache');
-
- $cellValue = $this->calculationCache[$cellReference];
- return true;
- }
- return false;
- }
- public function saveValueToCache($cellReference, $cellValue)
- {
- if ($this->calculationCacheEnabled) {
- $this->calculationCache[$cellReference] = $cellValue;
- }
- }
-
- public function _calculateFormulaValue($formula, $cellID = null, PHPExcel_Cell $pCell = null)
- {
- $cellValue = null;
-
-
- $formula = trim($formula);
- if ($formula{0} != '=') {
- return self::wrapResult($formula);
- }
- $formula = ltrim(substr($formula, 1));
- if (!isset($formula{0})) {
- return self::wrapResult($formula);
- }
- $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null;
- $wsTitle = ($pCellParent !== null) ? $pCellParent->getTitle() : "\x00Wrk";
- $wsCellReference = $wsTitle . '!' . $cellID;
- if (($cellID !== null) && ($this->getValueFromCache($wsCellReference, $cellValue))) {
- return $cellValue;
- }
- if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
- if ($this->cyclicFormulaCount <= 0) {
- $this->cyclicFormulaCell = '';
- return $this->raiseFormulaError('Cyclic Reference in Formula');
- } elseif ($this->cyclicFormulaCell === $wsCellReference) {
- ++$this->cyclicFormulaCounter;
- if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
- $this->cyclicFormulaCell = '';
- return $cellValue;
- }
- } elseif ($this->cyclicFormulaCell == '') {
- if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
- return $cellValue;
- }
- $this->cyclicFormulaCell = $wsCellReference;
- }
- }
-
- $this->cyclicReferenceStack->push($wsCellReference);
- $cellValue = $this->processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell);
- $this->cyclicReferenceStack->pop();
-
- if ($cellID !== null) {
- $this->saveValueToCache($wsCellReference, $cellValue);
- }
-
- return $cellValue;
- }
-
- private static function checkMatrixOperands(&$operand1, &$operand2, $resize = 1)
- {
-
-
- if (!is_array($operand1)) {
- list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand2);
- $operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1));
- $resize = 0;
- } elseif (!is_array($operand2)) {
- list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand1);
- $operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2));
- $resize = 0;
- }
- list($matrix1Rows, $matrix1Columns) = self::getMatrixDimensions($operand1);
- list($matrix2Rows, $matrix2Columns) = self::getMatrixDimensions($operand2);
- if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) {
- $resize = 1;
- }
- if ($resize == 2) {
-
- self::resizeMatricesExtend($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
- } elseif ($resize == 1) {
-
- self::resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
- }
- return array( $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns);
- }
-
- private static function getMatrixDimensions(&$matrix)
- {
- $matrixRows = count($matrix);
- $matrixColumns = 0;
- foreach ($matrix as $rowKey => $rowValue) {
- $matrixColumns = max(count($rowValue), $matrixColumns);
- if (!is_array($rowValue)) {
- $matrix[$rowKey] = array($rowValue);
- } else {
- $matrix[$rowKey] = array_values($rowValue);
- }
- }
- $matrix = array_values($matrix);
- return array($matrixRows, $matrixColumns);
- }
-
- private static function resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
- {
- if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
- if ($matrix2Rows < $matrix1Rows) {
- for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) {
- unset($matrix1[$i]);
- }
- }
- if ($matrix2Columns < $matrix1Columns) {
- for ($i = 0; $i < $matrix1Rows; ++$i) {
- for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) {
- unset($matrix1[$i][$j]);
- }
- }
- }
- }
- if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) {
- if ($matrix1Rows < $matrix2Rows) {
- for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) {
- unset($matrix2[$i]);
- }
- }
- if ($matrix1Columns < $matrix2Columns) {
- for ($i = 0; $i < $matrix2Rows; ++$i) {
- for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) {
- unset($matrix2[$i][$j]);
- }
- }
- }
- }
- }
-
- private static function resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns)
- {
- if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
- if ($matrix2Columns < $matrix1Columns) {
- for ($i = 0; $i < $matrix2Rows; ++$i) {
- $x = $matrix2[$i][$matrix2Columns-1];
- for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) {
- $matrix2[$i][$j] = $x;
- }
- }
- }
- if ($matrix2Rows < $matrix1Rows) {
- $x = $matrix2[$matrix2Rows-1];
- for ($i = 0; $i < $matrix1Rows; ++$i) {
- $matrix2[$i] = $x;
- }
- }
- }
- if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) {
- if ($matrix1Columns < $matrix2Columns) {
- for ($i = 0; $i < $matrix1Rows; ++$i) {
- $x = $matrix1[$i][$matrix1Columns-1];
- for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) {
- $matrix1[$i][$j] = $x;
- }
- }
- }
- if ($matrix1Rows < $matrix2Rows) {
- $x = $matrix1[$matrix1Rows-1];
- for ($i = 0; $i < $matrix2Rows; ++$i) {
- $matrix1[$i] = $x;
- }
- }
- }
- }
-
- private function showValue($value)
- {
- if ($this->_debugLog->getWriteDebugLog()) {
- $testArray = PHPExcel_Calculation_Functions::flattenArray($value);
- if (count($testArray) == 1) {
- $value = array_pop($testArray);
- }
- if (is_array($value)) {
- $returnMatrix = array();
- $pad = $rpad = ', ';
- foreach ($value as $row) {
- if (is_array($row)) {
- $returnMatrix[] = implode($pad, array_map(array($this, 'showValue'), $row));
- $rpad = '; ';
- } else {
- $returnMatrix[] = $this->showValue($row);
- }
- }
- return '{ '.implode($rpad, $returnMatrix).' }';
- } elseif (is_string($value) && (trim($value, '"') == $value)) {
- return '"'.$value.'"';
- } elseif (is_bool($value)) {
- return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
- }
- }
- return PHPExcel_Calculation_Functions::flattenSingleValue($value);
- }
-
- private function showTypeDetails($value)
- {
- if ($this->_debugLog->getWriteDebugLog()) {
- $testArray = PHPExcel_Calculation_Functions::flattenArray($value);
- if (count($testArray) == 1) {
- $value = array_pop($testArray);
- }
- if ($value === null) {
- return 'a NULL value';
- } elseif (is_float($value)) {
- $typeString = 'a floating point number';
- } elseif (is_int($value)) {
- $typeString = 'an integer number';
- } elseif (is_bool($value)) {
- $typeString = 'a boolean';
- } elseif (is_array($value)) {
- $typeString = 'a matrix';
- } else {
- if ($value == '') {
- return 'an empty string';
- } elseif ($value{0} == '#') {
- return 'a '.$value.' error';
- } else {
- $typeString = 'a string';
- }
- }
- return $typeString.' with a value of '.$this->showValue($value);
- }
- }
- private function convertMatrixReferences($formula)
- {
- static $matrixReplaceFrom = array('{', ';', '}');
- static $matrixReplaceTo = array('MKMATRIX(MKMATRIX(', '),MKMATRIX(', '))');
-
- if (strpos($formula, '{') !== false) {
-
- if (strpos($formula, '"') !== false) {
-
-
- $temp = explode('"', $formula);
-
- $openCount = $closeCount = 0;
- $i = false;
- foreach ($temp as &$value) {
-
- if ($i = !$i) {
- $openCount += substr_count($value, '{');
- $closeCount += substr_count($value, '}');
- $value = str_replace($matrixReplaceFrom, $matrixReplaceTo, $value);
- }
- }
- unset($value);
-
- $formula = implode('"', $temp);
- } else {
-
- $openCount = substr_count($formula, '{');
- $closeCount = substr_count($formula, '}');
- $formula = str_replace($matrixReplaceFrom, $matrixReplaceTo, $formula);
- }
-
- if ($openCount < $closeCount) {
- if ($openCount > 0) {
- return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '}'");
- } else {
- return $this->raiseFormulaError("Formula Error: Unexpected '}' encountered");
- }
- } elseif ($openCount > $closeCount) {
- if ($closeCount > 0) {
- return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '{'");
- } else {
- return $this->raiseFormulaError("Formula Error: Unexpected '{' encountered");
- }
- }
- }
- return $formula;
- }
- private static function mkMatrix()
- {
- return func_get_args();
- }
-
-
-
- private static $operatorAssociativity = array(
- '^' => 0,
- '*' => 0, '/' => 0,
- '+' => 0, '-' => 0,
- '&' => 0,
- '|' => 0, ':' => 0,
- '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0
- );
-
-
- private static $comparisonOperators = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true);
-
-
-
- private static $operatorPrecedence = array(
- ':' => 8,
- '|' => 7,
- '~' => 6,
- '%' => 5,
- '^' => 4,
- '*' => 3, '/' => 3,
- '+' => 2, '-' => 2,
- '&' => 1,
- '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0
- );
-
- private function _parseFormula($formula, PHPExcel_Cell $pCell = null)
- {
- if (($formula = $this->convertMatrixReferences(trim($formula))) === false) {
- return false;
- }
-
-
- $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null;
- $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION.
- '|'.self::CALCULATION_REGEXP_CELLREF.
- '|'.self::CALCULATION_REGEXP_NUMBER.
- '|'.self::CALCULATION_REGEXP_STRING.
- '|'.self::CALCULATION_REGEXP_OPENBRACE.
- '|'.self::CALCULATION_REGEXP_NAMEDRANGE.
- '|'.self::CALCULATION_REGEXP_ERROR.
- ')/si';
-
- $index = 0;
- $stack = new PHPExcel_Calculation_Token_Stack;
- $output = array();
- $expectingOperator = false;
-
- $expectingOperand = false;
-
-
-
- while (true) {
- $opCharacter = $formula{$index};
- if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) {
- $opCharacter .= $formula{++$index};
- }
-
- $isOperandOrFunction = preg_match($regexpMatchString, substr($formula, $index), $match);
- if ($opCharacter == '-' && !$expectingOperator) {
- $stack->push('Unary Operator', '~');
- ++$index;
- } elseif ($opCharacter == '%' && $expectingOperator) {
- $stack->push('Unary Operator', '%');
- ++$index;
- } elseif ($opCharacter == '+' && !$expectingOperator) {
- ++$index;
- } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) {
- return $this->raiseFormulaError("Formula Error: Illegal character '~'");
- } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) {
- while ($stack->count() > 0 &&
- ($o2 = $stack->last()) &&
- isset(self::$operators[$o2['value']]) &&
- @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) {
- $output[] = $stack->pop();
- }
- $stack->push('Binary Operator', $opCharacter);
- ++$index;
- $expectingOperator = false;
- } elseif ($opCharacter == ')' && $expectingOperator) {
- $expectingOperand = false;
- while (($o2 = $stack->pop()) && $o2['value'] != '(') {
- if ($o2 === null) {
- return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"');
- } else {
- $output[] = $o2;
- }
- }
- $d = $stack->last(2);
- if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) {
- $functionName = $matches[1];
- $d = $stack->pop();
- $argumentCount = $d['value'];
- $output[] = $d;
- $output[] = $stack->pop();
- if (isset(self::$controlFunctions[$functionName])) {
- $expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount'];
- $functionCall = self::$controlFunctions[$functionName]['functionCall'];
- } elseif (isset(self::$PHPExcelFunctions[$functionName])) {
- $expectedArgumentCount = self::$PHPExcelFunctions[$functionName]['argumentCount'];
- $functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
- } else {
- return $this->raiseFormulaError("Formula Error: Internal error, non-function on stack");
- }
-
- $argumentCountError = false;
- if (is_numeric($expectedArgumentCount)) {
- if ($expectedArgumentCount < 0) {
- if ($argumentCount > abs($expectedArgumentCount)) {
- $argumentCountError = true;
- $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount);
- }
- } else {
- if ($argumentCount != $expectedArgumentCount) {
- $argumentCountError = true;
- $expectedArgumentCountString = $expectedArgumentCount;
- }
- }
- } elseif ($expectedArgumentCount != '*') {
- $isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/', $expectedArgumentCount, $argMatch);
- switch ($argMatch[2]) {
- case '+':
- if ($argumentCount < $argMatch[1]) {
- $argumentCountError = true;
- $expectedArgumentCountString = $argMatch[1].' or more ';
- }
- break;
- case '-':
- if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) {
- $argumentCountError = true;
- $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3];
- }
- break;
- case ',':
- if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) {
- $argumentCountError = true;
- $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3];
- }
- break;
- }
- }
- if ($argumentCountError) {
- return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString." expected");
- }
- }
- ++$index;
- } elseif ($opCharacter == ',') {
- while (($o2 = $stack->pop()) && $o2['value'] != '(') {
- if ($o2 === null) {
- return $this->raiseFormulaError("Formula Error: Unexpected ,");
- } else {
- $output[] = $o2;
- }
- }
-
-
- if (($expectingOperand) || (!$expectingOperator)) {
- $output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
- }
-
- $d = $stack->last(2);
- if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) {
- return $this->raiseFormulaError("Formula Error: Unexpected ,");
- }
- $d = $stack->pop();
- $stack->push($d['type'], ++$d['value'], $d['reference']);
- $stack->push('Brace', '(');
- $expectingOperator = false;
- $expectingOperand = true;
- ++$index;
- } elseif ($opCharacter == '(' && !$expectingOperator) {
- $stack->push('Brace', '(');
- ++$index;
- } elseif ($isOperandOrFunction && !$expectingOperator) {
- $expectingOperator = true;
- $expectingOperand = false;
- $val = $match[1];
- $length = strlen($val);
- if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
- $val = preg_replace('/\s/u', '', $val);
- if (isset(self::$PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) {
- $stack->push('Function', strtoupper($val));
- $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch);
- if ($ax) {
- $stack->push('Operand Count for Function '.strtoupper($val).')', 0);
- $expectingOperator = true;
- } else {
- $stack->push('Operand Count for Function '.strtoupper($val).')', 1);
- $expectingOperator = false;
- }
- $stack->push('Brace', '(');
- } else {
- $output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => null);
- }
- } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) {
-
-
-
- $testPrevOp = $stack->last(1);
- if ($testPrevOp['value'] == ':') {
-
- if ($matches[2] == '') {
-
-
- $startCellRef = $output[count($output)-1]['value'];
- preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $startCellRef, $startMatches);
- if ($startMatches[2] > '') {
- $val = $startMatches[2].'!'.$val;
- }
- } else {
- return $this->raiseFormulaError("3D Range references are not yet supported");
- }
- }
- $output[] = array('type' => 'Cell Reference', 'value' => $val, 'reference' => $val);
- } else {
-
- $testPrevOp = $stack->last(1);
- if ($testPrevOp['value'] == ':') {
- $startRowColRef = $output[count($output)-1]['value'];
- $rangeWS1 = '';
- if (strpos('!', $startRowColRef) !== false) {
- list($rangeWS1, $startRowColRef) = explode('!', $startRowColRef);
- }
- if ($rangeWS1 != '') {
- $rangeWS1 .= '!';
- }
- $rangeWS2 = $rangeWS1;
- if (strpos('!', $val) !== false) {
- list($rangeWS2, $val) = explode('!', $val);
- }
- if ($rangeWS2 != '') {
- $rangeWS2 .= '!';
- }
- if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
- ($startRowColRef <= 1048576) && ($val <= 1048576)) {
-
- $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD';
- $output[count($output)-1]['value'] = $rangeWS1.'A'.$startRowColRef;
- $val = $rangeWS2.$endRowColRef.$val;
- } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
- (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
-
- $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576;
- $output[count($output)-1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1';
- $val = $rangeWS2.$val.$endRowColRef;
- }
- }
- $localeConstant = false;
- if ($opCharacter == '"') {
-
- $val = self::wrapResult(str_replace('""', '"', self::unwrapResult($val)));
- } elseif (is_numeric($val)) {
- if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
- $val = (float) $val;
- } else {
- $val = (integer) $val;
- }
- } elseif (isset(self::$excelConstants[trim(strtoupper($val))])) {
- $excelConstant = trim(strtoupper($val));
- $val = self::$excelConstants[$excelConstant];
- } elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$localeBoolean)) !== false) {
- $val = self::$excelConstants[$localeConstant];
- }
- $details = array('type' => 'Value', 'value' => $val, 'reference' => null);
- if ($localeConstant) {
- $details['localeValue'] = $localeConstant;
- }
- $output[] = $details;
- }
- $index += $length;
- } elseif ($opCharacter == '$') {
- ++$index;
- } elseif ($opCharacter == ')') {
- if ($expectingOperand) {
- $output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
- $expectingOperand = false;
- $expectingOperator = true;
- } else {
- return $this->raiseFormulaError("Formula Error: Unexpected ')'");
- }
- } elseif (isset(self::$operators[$opCharacter]) && !$expectingOperator) {
- return $this->raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
- } else {
- return $this->raiseFormulaError("Formula Error: An unexpected error occured");
- }
-
- if ($index == strlen($formula)) {
-
-
- if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) {
- return $this->raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands");
- } else {
- break;
- }
- }
-
- while (($formula{$index} == "\n") || ($formula{$index} == "\r")) {
- ++$index;
- }
- if ($formula{$index} == ' ') {
- while ($formula{$index} == ' ') {
- ++$index;
- }
-
-
- if (($expectingOperator) && (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/Ui', substr($formula, $index), $match)) &&
- ($output[count($output)-1]['type'] == 'Cell Reference')) {
- while ($stack->count() > 0 &&
- ($o2 = $stack->last()) &&
- isset(self::$operators[$o2['value']]) &&
- @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) {
- $output[] = $stack->pop();
- }
- $stack->push('Binary Operator', '|');
- $expectingOperator = false;
- }
- }
- }
- while (($op = $stack->pop()) !== null) {
- if ((is_array($op) && $op['value'] == '(') || ($op === '(')) {
- return $this->raiseFormulaError("Formula Error: Expecting ')'");
- }
- $output[] = $op;
- }
- return $output;
- }
- private static function dataTestReference(&$operandData)
- {
- $operand = $operandData['value'];
- if (($operandData['reference'] === null) && (is_array($operand))) {
- $rKeys = array_keys($operand);
- $rowKey = array_shift($rKeys);
- $cKeys = array_keys(array_keys($operand[$rowKey]));
- $colKey = array_shift($cKeys);
- if (ctype_upper($colKey)) {
- $operandData['reference'] = $colKey.$rowKey;
- }
- }
- return $operand;
- }
-
- private function processTokenStack($tokens, $cellID = null, PHPExcel_Cell $pCell = null)
- {
- if ($tokens == false) {
- return false;
- }
-
-
- $pCellWorksheet = ($pCell !== null) ? $pCell->getWorksheet() : null;
- $pCellParent = ($pCell !== null) ? $pCell->getParent() : null;
- $stack = new PHPExcel_Calculation_Token_Stack;
-
- foreach ($tokens as $tokenData) {
- $token = $tokenData['value'];
-
- if (isset(self::$binaryOperators[$token])) {
-
- if (($operand2Data = $stack->pop()) === null) {
- return $this->raiseFormulaError('Internal error - Operand value missing from stack');
- }
- if (($operand1Data = $stack->pop()) === null) {
- return $this->raiseFormulaError('Internal error - Operand value missing from stack');
- }
- $operand1 = self::dataTestReference($operand1Data);
- $operand2 = self::dataTestReference($operand2Data);
-
- if ($token == ':') {
- $this->_debugLog->writeDebugLog('Evaluating Range ', $this->showValue($operand1Data['reference']), ' ', $token, ' ', $this->showValue($operand2Data['reference']));
- } else {
- $this->_debugLog->writeDebugLog('Evaluating ', $this->showValue($operand1), ' ', $token, ' ', $this->showValue($operand2));
- }
-
- switch ($token) {
-
- case '>':
- case '<':
- case '>=':
- case '<=':
- case '=':
- case '<>':
- $this->executeBinaryComparisonOperation($cellID, $operand1, $operand2, $token, $stack);
- break;
-
- case ':':
- $sheet1 = $sheet2 = '';
- if (strpos($operand1Data['reference'], '!') !== false) {
- list($sheet1, $operand1Data['reference']) = explode('!', $operand1Data['reference']);
- } else {
- $sheet1 = ($pCellParent !== null) ? $pCellWorksheet->getTitle() : '';
- }
- if (strpos($operand2Data['reference'], '!') !== false) {
- list($sheet2, $operand2Data['reference']) = explode('!', $operand2Data['reference']);
- } else {
- $sheet2 = $sheet1;
- }
- if ($sheet1 == $sheet2) {
- if ($operand1Data['reference'] === null) {
- if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) {
- $operand1Data['reference'] = $pCell->getColumn().$operand1Data['value'];
- } elseif (trim($operand1Data['reference']) == '') {
- $operand1Data['reference'] = $pCell->getCoordinate();
- } else {
- $operand1Data['reference'] = $operand1Data['value'].$pCell->getRow();
- }
- }
- if ($operand2Data['reference'] === null) {
- if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) {
- $operand2Data['reference'] = $pCell->getColumn().$operand2Data['value'];
- } elseif (trim($operand2Data['reference']) == '') {
- $operand2Data['reference'] = $pCell->getCoordinate();
- } else {
- $operand2Data['reference'] = $operand2Data['value'].$pCell->getRow();
- }
- }
- $oData = array_merge(explode(':', $operand1Data['reference']), explode(':', $operand2Data['reference']));
- $oCol = $oRow = array();
- foreach ($oData as $oDatum) {
- $oCR = PHPExcel_Cell::coordinateFromString($oDatum);
- $oCol[] = PHPExcel_Cell::columnIndexFromString($oCR[0]) - 1;
- $oRow[] = $oCR[1];
- }
- $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
- if ($pCellParent !== null) {
- $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($sheet1), false);
- } else {
- return $this->raiseFormulaError('Unable to access Cell Reference');
- }
- $stack->push('Cell Reference', $cellValue, $cellRef);
- } else {
- $stack->push('Error', PHPExcel_Calculation_Functions::REF(), null);
- }
- break;
- case '+':
- $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'plusEquals', $stack);
- break;
- case '-':
- $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'minusEquals', $stack);
- break;
- case '*':
- $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayTimesEquals', $stack);
- break;
- case '/':
- $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'arrayRightDivide', $stack);
- break;
- case '^':
- $this->executeNumericBinaryOperation($cellID, $operand1, $operand2, $token, 'power', $stack);
- break;
- case '&':
-
-
-
- if (is_bool($operand1)) {
- $operand1 = ($operand1) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
- }
- if (is_bool($operand2)) {
- $operand2 = ($operand2) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
- }
- if ((is_array($operand1)) || (is_array($operand2))) {
-
- self::checkMatrixOperands($operand1, $operand2, 2);
- try {
-
- $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
-
- $matrixResult = $matrix->concat($operand2);
- $result = $matrixResult->getArray();
- } catch (PHPExcel_Exception $ex) {
- $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
- $result = '#VALUE!';
- }
- } else {
- $result = '"'.str_replace('""', '"', self::unwrapResult($operand1, '"').self::unwrapResult($operand2, '"')).'"';
- }
- $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
- $stack->push('Value', $result);
- break;
- case '|':
- $rowIntersect = array_intersect_key($operand1, $operand2);
- $cellIntersect = $oCol = $oRow = array();
- foreach (array_keys($rowIntersect) as $row) {
- $oRow[] = $row;
- foreach ($rowIntersect[$row] as $col => $data) {
- $oCol[] = PHPExcel_Cell::columnIndexFromString($col) - 1;
- $cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]);
- }
- }
- $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
- $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect));
- $stack->push('Value', $cellIntersect, $cellRef);
- break;
- }
-
- } elseif (($token === '~') || ($token === '%')) {
- if (($arg = $stack->pop()) === null) {
- return $this->raiseFormulaError('Internal error - Operand value missing from stack');
- }
- $arg = $arg['value'];
- if ($token === '~') {
- $this->_debugLog->writeDebugLog('Evaluating Negation of ', $this->showValue($arg));
- $multiplier = -1;
- } else {
- $this->_debugLog->writeDebugLog('Evaluating Percentile of ', $this->showValue($arg));
- $multiplier = 0.01;
- }
- if (is_array($arg)) {
- self::checkMatrixOperands($arg, $multiplier, 2);
- try {
- $matrix1 = new PHPExcel_Shared_JAMA_Matrix($arg);
- $matrixResult = $matrix1->arrayTimesEquals($multiplier);
- $result = $matrixResult->getArray();
- } catch (PHPExcel_Exception $ex) {
- $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
- $result = '#VALUE!';
- }
- $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
- $stack->push('Value', $result);
- } else {
- $this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack);
- }
- } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) {
- $cellRef = null;
- if (isset($matches[8])) {
- if ($pCell === null) {
- $cellValue = PHPExcel_Calculation_Functions::REF();
- } else {
- $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10];
- if ($matches[2] > '') {
- $matches[2] = trim($matches[2], "\"'");
- if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
-
- return $this->raiseFormulaError('Unable to access External Workbook');
- }
- $matches[2] = trim($matches[2], "\"'");
- $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
- if ($pCellParent !== null) {
- $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
- } else {
- return $this->raiseFormulaError('Unable to access Cell Reference');
- }
- $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
- } else {
- $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet');
- if ($pCellParent !== null) {
- $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
- } else {
- return $this->raiseFormulaError('Unable to access Cell Reference');
- }
- $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
- }
- }
- } else {
- if ($pCell === null) {
- $cellValue = PHPExcel_Calculation_Functions::REF();
- } else {
- $cellRef = $matches[6].$matches[7];
- if ($matches[2] > '') {
- $matches[2] = trim($matches[2], "\"'");
- if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) {
-
- return $this->raiseFormulaError('Unable to access External Workbook');
- }
- $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
- if ($pCellParent !== null) {
- $cellSheet = $this->workbook->getSheetByName($matches[2]);
- if ($cellSheet && $cellSheet->cellExists($cellRef)) {
- $cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
- $pCell->attach($pCellParent);
- } else {
- $cellValue = null;
- }
- } else {
- return $this->raiseFormulaError('Unable to access Cell Reference');
- }
- $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue));
- } else {
- $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet');
- if ($pCellParent->isDataSet($cellRef)) {
- $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false);
- $pCell->attach($pCellParent);
- } else {
- $cellValue = null;
- }
- $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->showTypeDetails($cellValue));
- }
- }
- }
- $stack->push('Value', $cellValue, $cellRef);
-
- } elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) {
- $functionName = $matches[1];
- $argCount = $stack->pop();
- $argCount = $argCount['value'];
- if ($functionName != 'MKMATRIX') {
- $this->_debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
- }
- if ((isset(self::$PHPExcelFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) {
- if (isset(self::$PHPExcelFunctions[$functionName])) {
- $functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
- $passByReference = isset(self::$PHPExcelFunctions[$functionName]['passByReference']);
- $passCellReference = isset(self::$PHPExcelFunctions[$functionName]['passCellReference']);
- } elseif (isset(self::$controlFunctions[$functionName])) {
- $functionCall = self::$controlFunctions[$functionName]['functionCall'];
- $passByReference = isset(self::$controlFunctions[$functionName]['passByReference']);
- $passCellReference = isset(self::$controlFunctions[$functionName]['passCellReference']);
- }
-
- $args = $argArrayVals = array();
- for ($i = 0; $i < $argCount; ++$i) {
- $arg = $stack->pop();
- $a = $argCount - $i - 1;
- if (($passByReference) &&
- (isset(self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
- (self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) {
- if ($arg['reference'] === null) {
- $args[] = $cellID;
- if ($functionName != 'MKMATRIX') {
- $argArrayVals[] = $this->showValue($cellID);
- }
- } else {
- $args[] = $arg['reference'];
- if ($functionName != 'MKMATRIX') {
- $argArrayVals[] = $this->showValue($arg['reference']);
- }
- }
- } else {
- $args[] = self::unwrapResult($arg['value']);
- if ($functionName != 'MKMATRIX') {
- $argArrayVals[] = $this->showValue($arg['value']);
- }
- }
- }
-
- krsort($args);
- if (($passByReference) && ($argCount == 0)) {
- $args[] = $cellID;
- $argArrayVals[] = $this->showValue($cellID);
- }
- if ($functionName != 'MKMATRIX') {
- if ($this->_debugLog->getWriteDebugLog()) {
- krsort($argArrayVals);
- $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )');
- }
- }
-
-
- if ($passCellReference) {
- $args[] = $pCell;
- }
- if (strpos($functionCall, '::') !== false) {
- $result = call_user_func_array(explode('::', $functionCall), $args);
- } else {
- foreach ($args as &$arg) {
- $arg = PHPExcel_Calculation_Functions::flattenSingleValue($arg);
- }
- unset($arg);
- $result = call_user_func_array($functionCall, $args);
- }
- if ($functionName != 'MKMATRIX') {
- $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($result));
- }
- $stack->push('Value', self::wrapResult($result));
- }
- } else {
-
- if (isset(self::$excelConstants[strtoupper($token)])) {
- $excelConstant = strtoupper($token);
- $stack->push('Constant Value', self::$excelConstants[$excelConstant]);
- $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
- } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
- $stack->push('Value', $token);
-
- } elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) {
- $namedRange = $matches[6];
- $this->_debugLog->writeDebugLog('Evaluating Named Range ', $namedRange);
- $cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false);
- $pCell->attach($pCellParent);
- $this->_debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->showTypeDetails($cellValue));
- $stack->push('Named Range', $cellValue, $namedRange);
- } else {
- return $this->raiseFormulaError("undefined variable '$token'");
- }
- }
- }
-
- if ($stack->count() != 1) {
- return $this->raiseFormulaError("internal error");
- }
- $output = $stack->pop();
- $output = $output['value'];
- return $output;
- }
- private function validateBinaryOperand($cellID, &$operand, &$stack)
- {
- if (is_array($operand)) {
- if ((count($operand, COUNT_RECURSIVE) - count($operand)) == 1) {
- do {
- $operand = array_pop($operand);
- } while (is_array($operand));
- }
- }
-
- if (is_string($operand)) {
-
-
- if ($operand > '' && $operand{0} == '"') {
- $operand = self::unwrapResult($operand);
- }
-
- if (!is_numeric($operand)) {
-
- if ($operand > '' && $operand{0} == '#') {
- $stack->push('Value', $operand);
- $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
- return false;
- } elseif (!PHPExcel_Shared_String::convertToNumberIfFraction($operand)) {
-
- $stack->push('Value', '#VALUE!');
- $this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!'));
- return false;
- }
- }
- }
-
- return true;
- }
- private function executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, &$stack, $recursingArrays = false)
- {
-
- if ((is_array($operand1)) || (is_array($operand2))) {
- $result = array();
- if ((is_array($operand1)) && (!is_array($operand2))) {
- foreach ($operand1 as $x => $operandData) {
- $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2));
- $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack);
- $r = $stack->pop();
- $result[$x] = $r['value'];
- }
- } elseif ((!is_array($operand1)) && (is_array($operand2))) {
- foreach ($operand2 as $x => $operandData) {
- $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operand1), ' ', $operation, ' ', $this->showValue($operandData));
- $this->executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack);
- $r = $stack->pop();
- $result[$x] = $r['value'];
- }
- } else {
- if (!$recursingArrays) {
- self::checkMatrixOperands($operand1, $operand2, 2);
- }
- foreach ($operand1 as $x => $operandData) {
- $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2[$x]));
- $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack, true);
- $r = $stack->pop();
- $result[$x] = $r['value'];
- }
- }
-
- $this->_debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->showTypeDetails($result));
-
- $stack->push('Array', $result);
- return true;
- }
-
- if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') {
- $operand1 = self::unwrapResult($operand1);
- }
- if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') {
- $operand2 = self::unwrapResult($operand2);
- }
-
- if (PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
- if (is_string($operand1)) {
- $operand1 = strtoupper($operand1);
- }
- if (is_string($operand2)) {
- $operand2 = strtoupper($operand2);
- }
- }
- $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE;
-
- switch ($operation) {
-
- case '>':
- if ($useLowercaseFirstComparison) {
- $result = $this->strcmpLowercaseFirst($operand1, $operand2) > 0;
- } else {
- $result = ($operand1 > $operand2);
- }
- break;
-
- case '<':
- if ($useLowercaseFirstComparison) {
- $result = $this->strcmpLowercaseFirst($operand1, $operand2) < 0;
- } else {
- $result = ($operand1 < $operand2);
- }
- break;
-
- case '=':
- if (is_numeric($operand1) && is_numeric($operand2)) {
- $result = (abs($operand1 - $operand2) < $this->delta);
- } else {
- $result = strcmp($operand1, $operand2) == 0;
- }
- break;
-
- case '>=':
- if (is_numeric($operand1) && is_numeric($operand2)) {
- $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 > $operand2));
- } elseif ($useLowercaseFirstComparison) {
- $result = $this->strcmpLowercaseFirst($operand1, $operand2) >= 0;
- } else {
- $result = strcmp($operand1, $operand2) >= 0;
- }
- break;
-
- case '<=':
- if (is_numeric($operand1) && is_numeric($operand2)) {
- $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 < $operand2));
- } elseif ($useLowercaseFirstComparison) {
- $result = $this->strcmpLowercaseFirst($operand1, $operand2) <= 0;
- } else {
- $result = strcmp($operand1, $operand2) <= 0;
- }
- break;
-
- case '<>':
- if (is_numeric($operand1) && is_numeric($operand2)) {
- $result = (abs($operand1 - $operand2) > 1E-14);
- } else {
- $result = strcmp($operand1, $operand2) != 0;
- }
- break;
- }
-
- $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
-
- $stack->push('Value', $result);
- return true;
- }
-
- private function strcmpLowercaseFirst($str1, $str2)
- {
- $inversedStr1 = PHPExcel_Shared_String::StrCaseReverse($str1);
- $inversedStr2 = PHPExcel_Shared_String::StrCaseReverse($str2);
- return strcmp($inversedStr1, $inversedStr2);
- }
- private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack)
- {
-
- if (!$this->validateBinaryOperand($cellID, $operand1, $stack)) {
- return false;
- }
- if (!$this->validateBinaryOperand($cellID, $operand2, $stack)) {
- return false;
- }
-
-
-
- if ((is_array($operand1)) || (is_array($operand2))) {
-
- self::checkMatrixOperands($operand1, $operand2, 2);
- try {
-
- $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
-
- $matrixResult = $matrix->$matrixFunction($operand2);
- $result = $matrixResult->getArray();
- } catch (PHPExcel_Exception $ex) {
- $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
- $result = '#VALUE!';
- }
- } else {
- if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) &&
- ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) ||
- (is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) {
- $result = PHPExcel_Calculation_Functions::VALUE();
- } else {
-
- switch ($operation) {
-
- case '+':
- $result = $operand1 + $operand2;
- break;
-
- case '-':
- $result = $operand1 - $operand2;
- break;
-
- case '*':
- $result = $operand1 * $operand2;
- break;
-
- case '/':
- if ($operand2 == 0) {
-
- $stack->push('Value', '#DIV/0!');
- $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!'));
- return false;
- } else {
- $result = $operand1 / $operand2;
- }
- break;
-
- case '^':
- $result = pow($operand1, $operand2);
- break;
- }
- }
- }
-
- $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result));
-
- $stack->push('Value', $result);
- return true;
- }
-
- protected function raiseFormulaError($errorMessage)
- {
- $this->formulaError = $errorMessage;
- $this->cyclicReferenceStack->clear();
- if (!$this->suppressFormulaErrors) {
- throw new PHPExcel_Calculation_Exception($errorMessage);
- }
- trigger_error($errorMessage, E_USER_ERROR);
- }
-
- public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog = true)
- {
-
- $returnValue = array ();
- if ($pSheet !== null) {
- $pSheetName = $pSheet->getTitle();
- if (strpos($pRange, '!') !== false) {
- list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
- $pSheet = $this->workbook->getSheetByName($pSheetName);
- }
-
- $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
- $pRange = $pSheetName.'!'.$pRange;
- if (!isset($aReferences[1])) {
-
- sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow);
- $cellValue = null;
- if ($pSheet->cellExists($aReferences[0])) {
- $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
- } else {
- $returnValue[$currentRow][$currentCol] = null;
- }
- } else {
-
- foreach ($aReferences as $reference) {
-
- sscanf($reference, '%[A-Z]%d', $currentCol, $currentRow);
- $cellValue = null;
- if ($pSheet->cellExists($reference)) {
- $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
- } else {
- $returnValue[$currentRow][$currentCol] = null;
- }
- }
- }
- }
- return $returnValue;
- }
-
- public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog = true)
- {
-
- $returnValue = array ();
- if ($pSheet !== null) {
- $pSheetName = $pSheet->getTitle();
- if (strpos($pRange, '!') !== false) {
- list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
- $pSheet = $this->workbook->getSheetByName($pSheetName);
- }
-
- $namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
- if ($namedRange !== null) {
- $pSheet = $namedRange->getWorksheet();
- $pRange = $namedRange->getRange();
- $splitRange = PHPExcel_Cell::splitRange($pRange);
-
- if (ctype_alpha($splitRange[0][0])) {
- $pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
- } elseif (ctype_digit($splitRange[0][0])) {
- $pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
- }
- } else {
- return PHPExcel_Calculation_Functions::REF();
- }
-
- $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
- if (!isset($aReferences[1])) {
-
- list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
- $cellValue = null;
- if ($pSheet->cellExists($aReferences[0])) {
- $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
- } else {
- $returnValue[$currentRow][$currentCol] = null;
- }
- } else {
-
- foreach ($aReferences as $reference) {
-
- list($currentCol, $currentRow) = PHPExcel_Cell::coordinateFromString($reference);
- $cellValue = null;
- if ($pSheet->cellExists($reference)) {
- $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
- } else {
- $returnValue[$currentRow][$currentCol] = null;
- }
- }
- }
- }
- return $returnValue;
- }
-
- public function isImplemented($pFunction = '')
- {
- $pFunction = strtoupper($pFunction);
- if (isset(self::$PHPExcelFunctions[$pFunction])) {
- return (self::$PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
- } else {
- return false;
- }
- }
-
- public function listFunctions()
- {
- $returnValue = array();
- foreach (self::$PHPExcelFunctions as $functionName => $function) {
- if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
- $returnValue[$functionName] = new PHPExcel_Calculation_Function(
- $function['category'],
- $functionName,
- $function['functionCall']
- );
- }
- }
- return $returnValue;
- }
-
- public function listAllFunctionNames()
- {
- return array_keys(self::$PHPExcelFunctions);
- }
-
- public function listFunctionNames()
- {
- $returnValue = array();
- foreach (self::$PHPExcelFunctions as $functionName => $function) {
- if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
- $returnValue[] = $functionName;
- }
- }
- return $returnValue;
- }
- }
|