You are here

function PHPExcel_Writer_Excel5_Parser::_convertNumber in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php \PHPExcel_Writer_Excel5_Parser::_convertNumber()

* Convert a number token to ptgInt or ptgNum * * @access private *

Parameters

mixed $num an integer or double for conversion to its ptg value:

1 call to PHPExcel_Writer_Excel5_Parser::_convertNumber()
PHPExcel_Writer_Excel5_Parser::_convert in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php
* Convert a token to the proper ptg value. * * @access private *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php, line 576

Class

PHPExcel_Writer_Excel5_Parser
PHPExcel_Writer_Excel5_Parser

Code

function _convertNumber($num) {

  // Integer in the range 0..2**16-1
  if (preg_match("/^\\d+\$/", $num) and $num <= 65535) {
    return pack("Cv", $this->ptg['ptgInt'], $num);
  }
  else {

    // A float
    if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) {

      // if it's Big Endian
      $num = strrev($num);
    }
    return pack("Cd", $this->ptg['ptgNum'], $num);
  }
}