- escape formulas in CSV export

This commit is contained in:
Max Pozdeev 2019-06-29 17:08:41 +03:00
parent 71d989ab47
commit 8c67075b8c

View file

@ -64,7 +64,12 @@ function printCSV($listData, $data)
function escape_csv($v)
{
return '"'.str_replace('"', '""', $v).'"';
//escape formulas
$nf = '';
if (strlen($v) > 0 && in_array(substr($v, 0, 1), array('=', '+', '-', '@'))) {
$nf = "'";
}
return '"'. $nf. str_replace('"', '""', $v). '"';
}
function printICal($listData, $data)