Вопрос

When Tried to read a password protected file using PHPExcel,I got this error.I tried pasting the password in different function of PHPExcel,but didn't work.Please tell me how to open password protected Excel file via PHPExcel.

There was a problem handling your file. Technical details: Cannot read encrypted file

My Code

    $inputFileType = PHPExcel_IOFactory::identify(dirname(__FILE__) . '/../uploads/' . $model->report);
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    if ($inputFileType != 'CSV') {
         $objReader->setReadDataOnly(true);
    }
    $objPHPExcel = $objReader->load(dirname(__FILE__) . '/../uploads/' . $model->report);
    $objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
Это было полезно?

Решение

At this point, PHPExcel still can't read files that have been password protected, but somebody actually posted a PR yesterday that should allow this, based on the Perl encrypted file reader. I've yet to look at it, and doubt if I'll get much chance today due to real-world pressures of work; but I should get an opportunity to test it over the coming week... so there's real hope that the next release will allow reading of password protected xls files.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top