开发者

Can I create Excel file with password protection

Can i create save password protected Excel file with php? I find the a lot of class and method and did't found 开发者_如何学运维 thank you


You can use (the excellent) PHPExcel for this. To lock a whole workbook:

$reader = new PHPExcel_Reader_Excel2007;
$workbook =  $reader->load("document.xlsx");
$workbook->getSecurity()->setWorkbookPassword("your password");

Or to lock a sheet:

$reader = new PHPExcel_Reader_Excel2007;
$workbook =  $reader->load("document.xlsx");
$workbook->-getActiveSheet()->getSecurity()->setWorkbookPassword("your password");


Short answer: No you cannot create a password protected file from PHPExcel until now.

https://github.com/PHPOffice/PHPExcel/issues/442#issuecomment-57867961

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜