2

我正在尝试阅读工作簿,但出现以下错误:

致命错误: C:\webserver\Apache\htdocs\ExcelSheetReader\PHPExcel_1.7.9_new buss req中的消息“Sheet (abc)!F6 -> ID!F3 -> Formula Error: Unexpected ')''未捕获异常 'PHPExcel_Calculation_Exception' \Classes\PHPExcel\Cell.php:298 堆栈跟踪:#0 C:\webserver\Apache\htdocs\ExcelSheetReader\PHPExcel_1.7.9_new buss req\Classes\PHPExcel\Worksheet.php(2432): PHPExcel_Cell->getCalculatedValue() #1 C:\webserver\Apache\htdocs\ExcelSheetReader\PHPExcel_1.7.9_new buss req\Classes\PHPExcel\Worksheet.php(2508): PHPExcel_Worksheet->rangeToArray('A1:N260', NULL, true, true, true) #2 C:\webserver\Apache\htdocs\ExcelSheetReader\PHPExcel_1.7.9_new buss req\Workbook\read_credits_v3_revised.php(36): PHPExcel_Worksheet->toArray(NULL, true, true, true)#3 {main} 在第 298 行的 C:\webserver\Apache\htdocs\ExcelSheetReader\PHPExcel_1.7.9_new buss req\Classes\PHPExcel\Cell.php 中抛出

工作表 (abc) 单元格 F6 中的公式为 =ID!F3 ,工作表 ID 单元格 F3 中的公式为 = SUM(IDc1.2Y,IDc1.3Y,IDc1.4Y,IDc1.5Y,IDc1.6Y,IDc2.3Y, IDc3.1Y,IDc3.2Y,IDc3.3Y,IDc3.4Y) 请指导我在工作表中找到问题,因为我认为公式没有任何问题。

我也得到了这个:未捕获的异常 'PHPExcel_Calculation_Exception' 带有消息'LL!F3 -> 公式错误:意外的')'' 工作表 LL 单元格 F3 中的公式是=MAX(LLc1Y, MIN(10,SUM(LLc2Y,MAX(LLc3. 1Y,LLc3.2Y),LLc3.3Y,LLc4Y,LLc5.1Y,LLc5.2Y,LLc5.3Y,LLc6Y)))这对我来说似乎也不错,但仍然出现错误。

如果可能的话,请帮助我解决这个错误。还有什么方法可以通过忽略任何公式问题来读取工作表中的数据?

4

1 回答 1

2

您正在toArray()使用以下参数调用该方法。

PHPExcel_Worksheet->toArray(NULL, true, true, true) 

查看可以传递给toArray()您正在使用的方法的实际参数的文档:

* @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
* @param boolean $calculateFormulas Should formulas be calculated?
* @param boolean $formatData  Should formatting be applied to cell values?
* @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
*                               True - Return rows and columns indexed by their actual row and column IDs

特别是,查看第二个参数(您正在传递 a true)。如果您不想计算公式,请传递 a false,但请记住,您为这些单元格返回的结果将是实际公式本身,而不是计算值

于 2014-12-09T12:48:13.150 回答