Loading src/Tools/Exporter.php +8 −6 Original line number Diff line number Diff line Loading @@ -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; } Loading Loading
src/Tools/Exporter.php +8 −6 Original line number Diff line number Diff line Loading @@ -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; } Loading