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

Merge branch 'develop' into test

parents 36c40cb5 f1ab76f1
...@@ -100,17 +100,19 @@ class Exporter ...@@ -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 * @return $this
*/ */
public function setUnprotectRange($unprotectRange = "") public function setUnprotectRange($unprotectRange = null)
{ {
$this->sheet->getProtection()->setSheet(true); $this->sheet->getProtection()->setSheet(true);
$this->sheet->getProtection()->setPassword('micro-ttt'); $this->sheet->getProtection()->setPassword('micro-tttt');
if ($unprotectRange) { if ($unprotectRange) {
$this->sheet->getStyle($unprotectRange) $unprotectRange = is_array($unprotectRange) ? $unprotectRange : func_get_args();
->getProtection() foreach ($unprotectRange as $range) {
->setLocked(Protection::PROTECTION_UNPROTECTED); $this->sheet->getStyle($range)->getProtection()->setLocked(Protection::PROTECTION_UNPROTECTED);
}
} }
return $this; 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