php大于1或小于1怎么写,phpspreadsheet:比例必须大于或等于1

好吧,我已经找到了解决我特定问题的方法…

它需要对

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;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值