PHPExcel can't calculate OFFSET() function wit

2019-09-01 10:15发布

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?

标签: phpexcel
1条回答
手持菜刀,她持情操
2楼-- · 2019-09-01 11:05

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',
查看更多
登录 后发表回答