好吧,我已经找到了解决我特定问题的方法…
它需要对
setZoomScale
可以在中找到的函数
SheetView.php
.
我文件中的缩放比例值为零,这引发了一个错误。新的代码检查是否存在此问题,如果找到,则将其设置为1。
也许对每个人来说都不是理想的解决方案,但在紧要关头也能发挥作用:
public function setZoomScale($pValue)
{
/* NEW code that sets the zoom scale
------------------------------------------*/
//Zoom Scale of 0 causes error. If found, default pValue to 1.
if( $pValue == 0)
{
$pValue = 1;
}
/*----------------------------------------*/
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 1
if (($pValue >= 1) || $pValue === null)
{
$this->zoomScale = $pValue;
}
else
{
throw new PhpSpreadsheetException('Scale must be greater than or equal to 1.');
}
return $this;
}