function PHPExcel_Writer_Excel5_Parser::_rangeToPackedRange in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php \PHPExcel_Writer_Excel5_Parser::_rangeToPackedRange()
* pack() row range into the required 3 or 4 byte format. * Just using maximum col/rows, which is probably not the correct solution * * @access private *
Parameters
string $range The Excel range to be packed: * @return array Array containing (row1,col1,row2,col2) in packed() format
1 call to PHPExcel_Writer_Excel5_Parser::_rangeToPackedRange()
- PHPExcel_Writer_Excel5_Parser::_convertRange3d in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5/ Parser.php - * Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to * a ptgArea3d. * * @access private *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5/ Parser.php, line 969
Class
- PHPExcel_Writer_Excel5_Parser
- PHPExcel_Writer_Excel5_Parser
Code
function _rangeToPackedRange($range) {
preg_match('/(\\$)?(\\d+)\\:(\\$)?(\\d+)/', $range, $match);
// return absolute rows if there is a $ in the ref
$row1_rel = empty($match[1]) ? 1 : 0;
$row1 = $match[2];
$row2_rel = empty($match[3]) ? 1 : 0;
$row2 = $match[4];
// Convert 1-index to zero-index
--$row1;
--$row2;
// Trick poor inocent Excel
$col1 = 0;
$col2 = 65535;
// FIXME: maximum possible value for Excel 5 (change this!!!)
// FIXME: this changes for BIFF8
if ($row1 >= 65536 or $row2 >= 65536) {
throw new PHPExcel_Writer_Exception("Row in: {$range} greater than 65536 ");
}
// Set the high bits to indicate if rows are relative.
$col1 |= $row1_rel << 15;
$col2 |= $row2_rel << 15;
$col1 = pack('v', $col1);
$col2 = pack('v', $col2);
$row1 = pack('v', $row1);
$row2 = pack('v', $row2);
return array(
$row1,
$col1,
$row2,
$col2,
);
}