You are here

private function PHPExcel_Writer_Excel5_Worksheet::_writeRangeProtection in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php \PHPExcel_Writer_Excel5_Worksheet::_writeRangeProtection()

* Write BIFF record RANGEPROTECTION * * Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records * Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records

1 call to PHPExcel_Writer_Excel5_Worksheet::_writeRangeProtection()
PHPExcel_Writer_Excel5_Worksheet::close in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php
* Add data to the beginning of the workbook (note the reverse order) * and to the end of the workbook. * * @access public *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php, line 1631

Class

PHPExcel_Writer_Excel5_Worksheet
PHPExcel_Writer_Excel5_Worksheet

Code

private function _writeRangeProtection() {
  foreach ($this->_phpSheet
    ->getProtectedCells() as $range => $password) {

    // number of ranges, e.g. 'A1:B3 C20:D25'
    $cellRanges = explode(' ', $range);
    $cref = count($cellRanges);
    $recordData = pack('vvVVvCVvVv', 0x868, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, $cref, 0x0, 0x0);
    foreach ($cellRanges as $cellRange) {
      $recordData .= $this
        ->_writeBIFF8CellRangeAddressFixed($cellRange);
    }

    // the rgbFeat structure
    $recordData .= pack('VV', 0x0, hexdec($password));
    $recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData));
    $length = strlen($recordData);
    $record = 0x868;

    // Record identifier
    $header = pack("vv", $record, $length);
    $this
      ->_append($header . $recordData);
  }
}