function socialcalc_cr_to_coord in Sheetnode 5
Same name and namespace in other branches
- 6 socialcalc.inc \socialcalc_cr_to_coord()
- 7.2 socialcalc.inc \socialcalc_cr_to_coord()
- 7 socialcalc.inc \socialcalc_cr_to_coord()
5 calls to socialcalc_cr_to_coord()
- socialcalc_parse_edit in ./
socialcalc.inc - socialcalc_save_cell in ./
socialcalc.inc - socialcalc_save_sheet in ./
socialcalc.inc - theme_sheetnode_range in ./
sheetnode.module - _sheetnode_phpexcel_export_do in modules/
sheetnode_phpexcel/ sheetnode_phpexcel.export.inc
File
- ./
socialcalc.inc, line 639 - SocialCalc manipulation functions Translated from socialcalc-3.js and companion files
Code
function socialcalc_cr_to_coord($c, $r, $return_as_array = FALSE) {
$letters = array(
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
);
if ($c < 1) {
$c = 1;
}
if ($c > 702) {
$c = 702;
}
// maximum number of columns - ZZ
if ($r < 1) {
$r = 1;
}
$collow = ($c - 1) % 26;
$colhigh = floor(($c - 1) / 26);
if ($colhigh) {
$result = array(
$letters[$colhigh - 1] . $letters[$collow],
$r,
);
}
else {
$result = array(
$letters[$collow],
$r,
);
}
return $return_as_array ? $result : $result[0] . $result[1];
}