Commit f1ab76f1 authored by 王源's avatar 王源 🎧

修改表格导出工具类中设置非保护区间方法参数为多个

parent a98d35df
......@@ -100,17 +100,19 @@ class Exporter
/**
* 设置非保护区间,调用此方法全表将自动保护
* @param string $unprotectRange 例如"A1:B1";从A列B列第一行到数据结束行不需要保护
* @param mixed $unprotectRange 可传数组,字符串或者多个参数形式('A1:B1', 'C1:D1')
* 例如"A1:B1";从A列B列第一行到数据结束行不需要保护
* @return $this
*/
public function setUnprotectRange($unprotectRange = "")
public function setUnprotectRange($unprotectRange = null)
{
$this->sheet->getProtection()->setSheet(true);
$this->sheet->getProtection()->setPassword('micro-ttt');
$this->sheet->getProtection()->setPassword('micro-tttt');
if ($unprotectRange) {
$this->sheet->getStyle($unprotectRange)
->getProtection()
->setLocked(Protection::PROTECTION_UNPROTECTED);
$unprotectRange = is_array($unprotectRange) ? $unprotectRange : func_get_args();
foreach ($unprotectRange as $range) {
$this->sheet->getStyle($range)->getProtection()->setLocked(Protection::PROTECTION_UNPROTECTED);
}
}
return $this;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment