function PHPExcel_Writer_Excel5_Parser::_convertRange2d 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::_convertRange2d()
* Convert an Excel range such as A1:D4 to a ptgRefV. * * @access private *
Parameters
string $range An Excel range in the A1:A2: * @param int $class
1 call to PHPExcel_Writer_Excel5_Parser::_convertRange2d()
- 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 638
Class
- PHPExcel_Writer_Excel5_Parser
- PHPExcel_Writer_Excel5_Parser
Code
function _convertRange2d($range, $class = 0) {
// TODO: possible class value 0,1,2 check Formula.pm
// Split the range into 2 cell refs
if (preg_match('/^(\\$)?([A-Ia-i]?[A-Za-z])(\\$)?(\\d+)\\:(\\$)?([A-Ia-i]?[A-Za-z])(\\$)?(\\d+)$/', $range)) {
list($cell1, $cell2) = explode(':', $range);
}
else {
// TODO: use real error codes
throw new PHPExcel_Writer_Exception("Unknown range separator");
}
// Convert the cell references
list($row1, $col1) = $this
->_cellToPackedRowcol($cell1);
list($row2, $col2) = $this
->_cellToPackedRowcol($cell2);
// The ptg value depends on the class of the ptg.
if ($class == 0) {
$ptgArea = pack("C", $this->ptg['ptgArea']);
}
elseif ($class == 1) {
$ptgArea = pack("C", $this->ptg['ptgAreaV']);
}
elseif ($class == 2) {
$ptgArea = pack("C", $this->ptg['ptgAreaA']);
}
else {
// TODO: use real error codes
throw new PHPExcel_Writer_Exception("Unknown class {$class}");
}
return $ptgArea . $row1 . $row2 . $col1 . $col2;
}