调用未定义的方法PHPExcel :: sheetCodeNameExists()PHPExcel

问题描述 投票:0回答:1

我在Laravel 4.2中使用PHPExcel 1.8.0库。它一直工作到现在,但现在我突然得到这个错误。

'在/var/www/myfilerunner/vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php中调用未定义的方法PHPExcel :: sheetCodeNameExists()'

这是我在Worksheet.php中的代码

if($ this-> getParent()){

        if ($this->getParent()->sheetCodeNameExists($pValue)) {

            if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) {
                $pValue = PHPExcel_Shared_String::Substring($pValue,0,29);
            }
            $i = 1;
            while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) {
                ++$i;
                if ($i == 10) {
                    if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) {
                        $pValue = PHPExcel_Shared_String::Substring($pValue,0,28);
                    }
                } elseif ($i == 100) {
                    if (PHPExcel_Shared_String::CountCharacters($pValue) > 27) {
                        $pValue = PHPExcel_Shared_String::Substring($pValue,0,27);
                    }
                }
            }

            $pValue = $pValue . '_' . $i;// ok, we have a valid name
            >setTitle($altTitle,$updateFormulaCellReferences);
        }
    }

我没有更改任何版本,这个方法存在于我的PHPExcel.php中。请帮帮我。

php laravel phpexcel
1个回答
0
投票

有几个原因可以解决此错误。

其中一个是PHPExcel的旧版本。请更新版本。

PHPExcel repository on GitHub

© www.soinside.com 2019 - 2024. All rights reserved.