[英]Weird behavior of PHPExcel lib
I have encountered weird behavior of PHPExcel lib (I have never used it before). 我遇到过PHPExcel lib的奇怪行为(我之前从未使用过它)。 I have code like this:
我有这样的代码:
$inputFileName = 'excel.ods';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
I dont know what exactly toArray method does because I CAN'T FIND ANY DOCUMENTATION OF THIS THING. 我不知道Arrray方法究竟做了什么,因为我找不到任何这方面的文件。 I think that the problem occurs when an excel file has some blank cells - they are not copied but next cell is wriiten in their places or something.
我认为当excel文件有一些空白单元格时会出现问题 - 它们不会被复制,但是下一个单元格会在它们的位置或类似物中被篡改。 Could someone provide me documentation to function toArray?
有人可以提供我的文档来运行到Array? (i think that something is wrong with that parameters).
(我认为这些参数有问题)。
Thank you in advance :) 先感谢您 :)
PS: it is code from example PS:它是来自示例的代码
toArray() takes the data from each cell in the worksheet and puts it in a PHP array toArray()从工作表中的每个单元格中获取数据并将其放入PHP数组中
/**
* Create array from worksheet
*
* @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
* @return array
*/
The documentation for PHPExcel is in the folder /Documentation.
PHPExcel的文档位于文件夹/ Documentation中。 API docs are in /Documentation/API Examples are in the folders /Tests and /Documentation/Examples
API文档位于/ Documentation / API示例位于文件夹/测试和/文档/示例中
There is a bug in the current 1.7.7 release that can misalign cells read from ods files when there are blank cells in the worksheet. 当工作表中有空白单元格时,当前1.7.7版本中存在一个错误,该错误可能会错误对齐从ods文件中读取的单元格。 This bug has been fixed in the latest code on github.
这个bug已在github上的最新代码中修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.