1
我會搜索谷歌,但我找不到這方面的任何解決方案。
我想要做的是從一個報告使用PHP製作excel5導出文件。PHPExcel致命錯誤:未捕獲的異常「異常」有消息「公式錯誤:意外,」
每當我試圖做一個平均的時候,我發現了以下錯誤:
Fatal error: Uncaught exception 'Exception' with message 'myexcelsheet!F38 -> Formula Error: Unexpected ,'
這是給出了錯誤的公式:
=SUM(F9:F36)/COUNTIF(F9:F36, "*" & "<>00:00:00" & "*")
細胞的數據類型是時間。使用COUNT它可以正常工作,但它需要忽略00:00:00時間。
這是包括:
require_once("PHPExcel/Classes/PHPExcel.php");
require_once("PHPExcel/Classes/PHPExcel/Writer/Excel5.php");
require_once 'PHPExcel/Classes/PHPExcel/Cell/AdvancedValueBinder.php';
所有錯誤:
Fatal error: Uncaught exception 'Exception' with message 'myexcelsheet!F38 -> Formula Error: Unexpected ,' in /path/to/PHPExcel/Classes/PHPExcel/Cell.php:293 Stack trace: #0 /path/to/PHPExcel/Classes/PHPExcel/Worksheet.php(702): PHPExcel_Cell->getCalculatedValue() #1 /path/to/PHPExcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php(295): PHPExcel_Worksheet->calculateColumnWidths() #2 /path/to/PHPExcel/Classes/PHPExcel/Writer/Excel5.php(194): PHPExcel_Writer_Excel5_Worksheet->close() #3 /path/to/rep-functions.php(985): PHPExcel_Writer_Excel5->save('/path/t...') #4 /path/to/report.php(462): export_excel(Array, Array, 'report.ph...', Array, Array, Array) #5 {main} thrown in /path/to/PHPExcel/Classes/PHPExcel/Cell.php on line 293
這是我從testFormula功能得到
Formula Value is=SUM(F9:F36)/COUNTIF(F9:F36,"*" & "00:00:00" & "*") Expected Value is UNKNOWN Parser Stack :- Array ( [0] => Array ( [type] => Cell Reference [value] => F9 [reference] => F9 ) [1] => Array ( [type] => Cell Reference [value] => F36 [reference] => F36 ) [2] => Array ( [type] => Binary Operator [value] => : [reference] => ) [3] => Array ( [type] => Operand Count for Function SUM() [value] => 1 [reference] => ) [4] => Array ( [type] => Function [value] => SUM( [reference] => ) [5] => Array ( [type] => Cell Reference [value] => F9 [reference] => F9 ) [6] => Array ( [type] => Cell Reference [value] => F36 [reference] => F36 ) [7] => Array ( [type] => Binary Operator [value] => : [reference] => ) [8] => Array ( [type] => Value [value] => "*" [reference] => ) [9] => Array ( [type] => Value [value] => "00:00:00" [reference] => ) [10] => Array ( [type] => Binary Operator [value] => & [reference] => ) [11] => Array ( [type] => Value [value] => "*" [reference] => ) [12] => Array ( [type] => Binary Operator [value] => & [reference] => ) [13] => Array ( [type] => Operand Count for Function COUNTIF() [value] => 2 [reference] => ) [14] => Array ( [type] => Function [value] => COUNTIF( [reference] => ) [15] => Array ( [type] => Binary Operator [value] =>/ [reference] => ) ) CALCULATION ENGINE ERROR: Worksheet!F38 -> Formula Error: Unexpected , Evaluation Log: Array ( )
讓我知道如果你需要了解更多信息。
在此先感謝!
我已經添加了該功能,但是我無法從中做出某些功能。 – 2013-02-28 09:27:31
輸出是在問題中。 – 2013-02-28 09:31:58
SOrry,在功能中錯過了一條線 – 2013-02-28 09:35:09