/**
  * Set WorkbookPassword
  *
  * @param string 	$pValue
  * @param boolean 	$pAlreadyHashed If the password has already been hashed, set this to true
  * @return DocumentSecurity
  */
 function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
 {
     if (!$pAlreadyHashed) {
         $pValue = Shared_PasswordHasher::hashPassword($pValue);
     }
     $this->_workbookPassword = $pValue;
     return $this;
 }
Example #2
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	Exception
  * @return Worksheet
  */
 public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false)
 {
     // Uppercase coordinate
     $pRange = strtoupper($pRange);
     if (!$pAlreadyHashed) {
         $pPassword = Shared_PasswordHasher::hashPassword($pPassword);
     }
     $this->_protectedCells[$pRange] = $pPassword;
     return $this;
 }