You are here

private function PHPExcel_Writer_Excel5_Worksheet::_writeLabel in Loft Data Grids 7.2

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

* Write a string to the specified row and column (zero indexed). * NOTE: there is an Excel 5 defined limit of 255 characters. * $format is optional. * Returns 0 : normal termination * -2 : row or column out of range * -3 : long string truncated to 255 chars * * @access public *

Parameters

integer $row Zero indexed row: * @param integer $col Zero indexed column * @param string $str The string to write * @param mixed $xfIndex The XF format index for the cell * @return integer

File

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

Class

PHPExcel_Writer_Excel5_Worksheet
PHPExcel_Writer_Excel5_Worksheet

Code

private function _writeLabel($row, $col, $str, $xfIndex) {
  $strlen = strlen($str);
  $record = 0x204;

  // Record identifier
  $length = 0x8 + $strlen;

  // Bytes to follow
  $str_error = 0;
  if ($strlen > $this->_xls_strmax) {

    // LABEL must be < 255 chars
    $str = substr($str, 0, $this->_xls_strmax);
    $length = 0x8 + $this->_xls_strmax;
    $strlen = $this->_xls_strmax;
    $str_error = -3;
  }
  $header = pack("vv", $record, $length);
  $data = pack("vvvv", $row, $col, $xfIndex, $strlen);
  $this
    ->_append($header . $data . $str);
  return $str_error;
}