You are here

private function PHPExcel_Writer_Excel5_Worksheet::_writeColinfo 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::_writeColinfo()

* Write BIFF record COLINFO to define column widths * * Note: The SDK says the record length is 0x0B but Excel writes a 0x0C * length record. * *

Parameters

array $col_array This is the only parameter received and is composed of the following:: * 0 => First formatted column, * 1 => Last formatted column, * 2 => Col width (8.43 is Excel default), * 3 => The optional XF format of the column, * 4 => Option flags. * 5 => Optional outline level

1 call to PHPExcel_Writer_Excel5_Worksheet::_writeColinfo()
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 1391

Class

PHPExcel_Writer_Excel5_Worksheet
PHPExcel_Writer_Excel5_Worksheet

Code

private function _writeColinfo($col_array) {
  if (isset($col_array[0])) {
    $colFirst = $col_array[0];
  }
  if (isset($col_array[1])) {
    $colLast = $col_array[1];
  }
  if (isset($col_array[2])) {
    $coldx = $col_array[2];
  }
  else {
    $coldx = 8.43;
  }
  if (isset($col_array[3])) {
    $xfIndex = $col_array[3];
  }
  else {
    $xfIndex = 15;
  }
  if (isset($col_array[4])) {
    $grbit = $col_array[4];
  }
  else {
    $grbit = 0;
  }
  if (isset($col_array[5])) {
    $level = $col_array[5];
  }
  else {
    $level = 0;
  }
  $record = 0x7d;

  // Record identifier
  $length = 0xc;

  // Number of bytes to follow
  $coldx *= 256;

  // Convert to units of 1/256 of a char
  $ixfe = $xfIndex;
  $reserved = 0x0;

  // Reserved
  $level = max(0, min($level, 7));
  $grbit |= $level << 8;
  $header = pack("vv", $record, $length);
  $data = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved);
  $this
    ->_append($header . $data);
}