Protecting XLS Cells

Dec 7, 2008 at 7:09 PM
Hi

I am creating an Excel 97-2003 (xls) file.  I wish to have the top row of the sheet protected eg A1:Q1 locked and the rest of the document unlocked.  However, I am running into problems.  I can lock the sheet, but not a selection.  My code so far as per the examples:

...

$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);    // Needs to be set to true in order to enable any worksheet protection!
$objPHPExcel->getActiveSheet()->protectCells('A1:Q1', 'PHPExcel');

...

This locks the whole sheet and not the selection A1:Q1.

I have tried the following code:

$objPHPExcel->getActiveSheet()->unprotectCells('A2:Q9999');

and this does not work.

Can anyone help me with this problem?

Thank you in advance.
Developer
Dec 8, 2008 at 2:03 AM
Implemented per work item #8435:
http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=8435

Download latest source at next check out:
http://www.codeplex.com/PHPExcel/SourceControl/ListDownloadableCommits.aspx