如何让phpexcel生成的excel文件打开时需要密码
如题。
我搜索网上的一些解决方案说可以这样:
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
$objPHPExcel=new PHPExcel();
$objPHPExcel->getSecurity()->setLockWindows(true);
$objPHPExcel->getSecurity()->setLockStructure(true);
$objPHPExcel->getSecurity()->setWorkbookPassword("abc");
$objWriter=new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->setTempDir(".");
$objWriter->save("abc.xls");
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号