Commit ce237f0b authored by 王源's avatar 王源
Browse files

Merge branch 'develop' into test

parents 36c40cb5 f1ab76f1
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -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;
    }
    }