Protect cells still doesn't work

Aug 2, 2009 at 2:50 AM

I saw the post that said to download the latest version of the code to fix the problem with protecting cells, did that and it still does not work.

It is supposed to fixed here:

I have the following:

$objPHPExcel = new PHPExcel();

I turn on protection after the sheet is created, and then attempt to protect cells with the following.


But the cells are still not protected.

Can anyone show me what I'm doing wrong or is this function still not working?

Much thanks!

Aug 2, 2009 at 12:50 PM

I tried to run your code and it seemed to work fine with both Excel2007 and Excel5 writer. The cells in row 12 were protected with a password as expected when I opened the output in MS Office Excel 2007.

However, I noticed that in OpenOffice 3.1 the cell protection was not working. So I conclude that OpenOffice 3.1 does not support cell protection. This should not be confused with "locked cells" which is something else and is controlled via the cell style. Adding to the confusion: "Locked cells" in Excel is called "protected cells" in OpenOffice.

When you say that it is not working, which application did you open the Excel file with?

Aug 3, 2009 at 5:41 AM

I did use OpenOffice 3.0 to test it. I didn't try Excel and don't have a working copy on my Windows machine as I work almost exclusively on Ubuntu Linux.

Great news it works with Excel, because that's what the client will be using.

But it sounds like perhaps "locked cells" would suit us better. Basically, all we need is for the client to not be able to modify certain cells, we don't need password protection on them.

What would the syntax look like for locking cells?

Also, is there a regular API type documentation that lists all the class methods instead of just the "recipes file"?

Thanks for the quick response and also for a great library! It's easy to use, very robust and just all around great. It was exactly what we needed.



Aug 3, 2009 at 10:06 AM
bigskypenguin wrote:

Also, is there a regular API type documentation that lists all the class methods instead of just the "recipes file"?

 In the production downloads, there's a directory /Documentation/API with an index.html file.

This is the PHPDocumentor docs for the library