protection only for the first row

Topics: Developer Forum, User Forum
Jun 7, 2010 at 11:48 AM
Edited Jun 7, 2010 at 11:49 AM

I try to generate a template for customers where only the first row (header) is protected. The following rows contains data or not - customers can edit this rows.

So I set

$objPHPExcel->getActiveSheet()->getProtection()->setPassword('phpexcel');
$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);

then the whole sheet is locked. The only way I find to 'unlock' the rows for the customers, was to unprotect each cell with

 

$objPHPExcel->getActiveSheet()->getStyle('A2:B9999')->getProtection()->setLocked(
    PHPExcel_Style_Protection::PROTECTION_UNPROTECTED
);

Isn't there a better way, just to protect the first row??

 

Greetings from Berlin

Stephan