PHPExcel can't calculate OFFSET() function with 4 arguments

会有一股神秘感。 提交于 2019-12-13 22:18:42

问题


I am using PhpExcel 1.8.0 and I have faced with the problem. PhpExcel can't calculate formula OFFSET() with 4 arguments:

"Price Sheet!A27 -> Program Settings!H2 -> Formula Error: Wrong number of arguments for OFFSET() function: 4 given, either 3 or 5 expected"

But in description of this formula i have found that this argument "width" is optional:

"It is the number of columns that you want the returned range to be. If this parameter is omitted, it is assumed to be the width of range."

Can someone tell me how to fix this problem?


回答1:


Open the file Classes/PHPExcel/Calculation.php and find the entry in the $PHPExcelFunctions array for OFFSET which looks like:

'OFFSET' => array(
    'category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE,
    'functionCall' => 'PHPExcel_Calculation_LookupRef::OFFSET',
    'argumentCount' => '3,5',
    'passCellReference' => true,
    'passByReference' => array(true)
),

and change the argumentCount block to

'argumentCount' => '3-5',


来源:https://stackoverflow.com/questions/33365672/phpexcel-cant-calculate-offset-function-with-4-arguments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!