mercredi 11 octobre 2017

laravel excel download with password protected not working

By using "maatwebsite/excel": "~2.1.0" version, I want to get the excel password protected. Find the code which I've tried, but it is gone unattained. I need password protect while opening file.

Excel::create`enter code here`($excelName, function($excel) 
use($exportData) {
$excel->sheet('sheet', function($sheet)  use($exportData) {
$sheet->getProtection()->setSheet(true);
$sheet->getProtection()->setSort(true);
$sheet->getProtection()->setInsertRows(true);
$sheet->getProtection()->setFormatCells(true);
$sheet->getProtection()->setPassword('password');
$sheet->fromArray($exportData);
});

})->export('xls');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire