大家好!
我想我发现了这个bug。 如果我从文件中图像删除,它加载正常。 如果有图像时候,何时
$ objPHPExcel = PHPExcel_IOFactory :: load($ file);
我得到:.............未定义的偏移:-1 .........在PHPExcel \ Reader \ Excel5.php的第911行
那是 ....
$ BSE = $ BSECollection [$ BSEindex - 1]; //这里是问题,索引的值将是-1
$ blipType = $ BSE-> getBlipType();
从我的讲解中,意味着$ BSEindex的价值为零......
当然,这将在以后对方法“getBlipType”带来问题,这是在非对象上调用的......
修复方式:
// picture
// get index to BSE entry (1-based)
$BSEindex = $spContainer->getOPT(0x0104);
+
+ // If there is no BSE Index, we will fail here and other fields are not read.
+ // Fix by checking here.
+ // TODO: Why is there no BSE Index? Is this a new Office Version? Password protected field?
+ // More likely : a uncompatible picture
+ if (!$BSEindex) {
+ continue;
+ }
+
$BSECollection = $escherWorkbook->getDggContainer()->getBstoreContainer()->getBSECollection();
$BSE = $BSECollection[$BSEindex - 1];
$blipType = $BSE->getBlipType();