Protect excel from viewing

Topics: User Forum
Mar 12, 2009 at 7:00 AM
Helllo, everybody

I need to set a password to protect the excel file from viewing.
Does anyone know how to do it in PHPExcel.
thanks
Coordinator
Mar 12, 2009 at 9:33 AM
Edited Mar 12, 2009 at 9:36 AM
$objPHPExcel->getSecurity()->setLockWindows(true);
$objPHPExcel->getSecurity()->setLockStructure(true);
$objPHPExcel->getSecurity()->setWorkbookPassword("myPassword");
Mar 12, 2009 at 9:55 AM
Thanks for your reply.
I have tried this way but I still can see the content of the file
Do I miss any details?
I got the same result when I ran the  demo code "11documentsecurity.php"
Is that because I write the file in 'Excel5' format and my excel is 2003?

Thanks
Developer
Mar 13, 2009 at 3:32 PM
The Excel5 writer does not support the security features on the workbook shown by MarkBaker. For clarity, those kind of security features prevent the user from, for example, adding new sheets to the workbook, but do not prevent viewing (opening) of the file.

You are not able to protect the file from viewing using these classes. Neither Excel2007 nor Excel5. This would involve partial encryption of the file, but the exact algorithm is not published.
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=9101

Mar 16, 2009 at 3:30 AM
Thanks for your answer.