title: PHPExcel cell protection
body: <p>I have issues with cell protection.
  The basic  rule for protect should be something like that:</p>
  
  <pre><code>$objPHPExcel-&gt;getActiveSheet()-&gt;getProtection()-&gt;setSheet(true);    
  $objPHPExcel-&gt;getActiveSheet()-&gt;protectCells('A3:A13', 'PHPExcel');
  </code></pre>
  
  <p>if I set protection to true, I can't insert new rows, even if I set insert row to true:</p>
  
  <pre><code>$objPHPExcel-&gt;getActiveSheet()-&gt;getProtection()-&gt;setInsertRows(true);
  </code></pre>
  
  <p>I'd like to protect the structure and one columns while data are in there, otherwise, I'd like to have all empty rows unprotected.</p>
  
  <p>How to do that?</p>
  
  <p>I tried to unprotect/unprotect columns and rows inside loop - which works ok, but outside the loop, all the cells are protected, which means, I can't insert any new rows.
  I tried to set protection to true inside the loop, and to false outside the loop, but it doesn't work that way.
  Here is the code to unprotect all fields except ID:</p>
  
  <pre><code>$objPHPExcel-&gt;getActiveSheet()-&gt;getProtection()-&gt;setSheet(true);
  while($row_data = mysql_fetch_assoc($query)) {
      foreach($row_data as $key=&gt;$value) {
  
          $objPHPExcel-&gt;getActiveSheet()-&gt;getStyleByColumnAndRow($col,$row)-&gt;getProtection()-&gt;setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); 
          if($key != 'id'){
              $objPHPExcel-&gt;getActiveSheet()-&gt;getStyleByColumnAndRow($col,$row)-&gt;getProtection()-&gt;setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED);
          }
  
          $col++;
      }
      $row++;
  }
  </code></pre>