function socialcalc_save_cell in Sheetnode 7.2
Same name and namespace in other branches
- 5 socialcalc.inc \socialcalc_save_cell()
- 6 socialcalc.inc \socialcalc_save_cell()
- 7 socialcalc.inc \socialcalc_save_cell()
1 call to socialcalc_save_cell()
File
- ./
socialcalc.inc, line 766 - SocialCalc manipulation functions.
Code
function socialcalc_save_cell($cell) {
$line = 'cell:' . socialcalc_cr_to_coord($cell['pos'][0], $cell['pos'][1]);
if (isset($cell['datavalue'])) {
$value = socialcalc_encode_value($cell['datavalue']);
if ($cell['datatype'] == 'v') {
if ($cell['valuetype'] == 'n') {
$line .= ':v:' . $value;
}
else {
$line .= ':vt:' . $cell['valuetype'] . ':' . $value;
}
}
elseif ($cell['datatype'] == 't') {
if ($cell['valuetype'] == 't') {
$line .= ':t:' . $value;
}
else {
$line .= ':vt:' . $cell['valuetype'] . ':' . $value;
}
}
elseif (isset($cell['formula'])) {
$formula = socialcalc_encode_value($cell['formula']);
if ($cell['datatype'] == 'f') {
$line .= ':vtf:' . $cell['valuetype'] . ':' . $value . ':' . $formula;
}
elseif ($cell['datatype'] == 'c') {
$line .= ':vtc:' . $cell['valuetype'] . ':' . $value . ':' . $formula;
}
}
}
if (isset($cell['errors'])) {
$line .= ':e:' . socialcalc_encode_value($cell['errors']);
}
if (!empty($cell['readonly'])) {
$line .= ':ro:yes';
}
$t = @$cell['bt'];
$r = @$cell['br'];
$b = @$cell['bb'];
$l = @$cell['bl'];
if ($t || $r || $b || $l) {
$line .= ':b:' . $t . ':' . $r . ':' . $b . ':' . $l;
}
if (isset($cell['layout'])) {
$line .= ':l:' . $cell['layout'];
}
if (isset($cell['font'])) {
$line .= ':f:' . $cell['font'];
}
if (isset($cell['color'])) {
$line .= ':c:' . $cell['color'];
}
if (isset($cell['bgcolor'])) {
$line .= ':bg:' . $cell['bgcolor'];
}
if (isset($cell['cellformat'])) {
$line .= ':cf:' . $cell['cellformat'];
}
if (isset($cell['textvalueformat'])) {
$line .= ':tvf:' . $cell['textvalueformat'];
}
if (isset($cell['nontextvalueformat'])) {
$line .= ':ntvf:' . $cell['nontextvalueformat'];
}
if (isset($cell['colspan'])) {
$line .= ':colspan:' . $cell['colspan'];
}
if (isset($cell['rowspan'])) {
$line .= ':rowspan:' . $cell['rowspan'];
}
if (isset($cell['cssc'])) {
$line .= ':cssc:' . $cell['cssc'];
}
if (isset($cell['csss'])) {
$line .= ':csss:' . socialcalc_encode_value($cell['csss']);
}
if (isset($cell['mod'])) {
$line .= ':mod:' . $cell['mod'];
}
if (isset($cell['comment'])) {
$line .= ':comment:' . socialcalc_encode_value($cell['comment']);
}
return $line;
}