Example #1
0
 /**
  * Set protection on a cell range
  *
  * @param    string            $pRange                Cell (e.g. A1) or cell range (e.g. A1:E1)
  * @param    string            $pPassword            Password to unlock the protection
  * @param    boolean        $pAlreadyHashed    If the password has already been hashed, set this to true
  * @throws    PHPExcel_Exception
  * @return PHPExcel_Worksheet
  */
 public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false)
 {
     // Uppercase coordinate
     $pRange = strtoupper($pRange);
     if (!$pAlreadyHashed) {
         $pPassword = PHPExcel_Shared_PasswordHasher::hashPassword($pPassword);
     }
     $this->_protectedCells[$pRange] = $pPassword;
     return $this;
 }
Example #2
0
 /**
  * Set Password
  *
  * @param string 	$pValue
  * @param boolean 	$pAlreadyHashed If the password has already been hashed, set this to true
  */
 function setPassword($pValue = '', $pAlreadyHashed = false)
 {
     if (!$pAlreadyHashed) {
         $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
     }
     $this->_password = $pValue;
 }
 /**
  * Set WorkbookPassword
  *
  * @param string 	$pValue
  * @param boolean 	$pAlreadyHashed If the password has already been hashed, set this to true
  * @return PHPExcel_DocumentSecurity
  */
 function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
 {
     if (!$pAlreadyHashed) {
         $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
     }
     $this->_workbookPassword = $pValue;
     return $this;
 }