I am exporting some data into an excel by using simplexlsxgen . My data has a value <<NEW>>
and I am having a trouble displaying it.
In my code I prepared it in htmlspecialchars("<<NEW>>")
, which will work if I want to display it in the browser page, but when it gets exported in an excel $xlsx->saveAs($fullFilePath)
the data somehow will become <<NEW>>
. If I simply prepare it as "<<NEW>>"
nothing will be displayed.
SAMPLE CODE
$excelArr = [
['DOC', 'DOCDATE'],
['<<NEW>>', '05/01/2023']
];
$xlsx = $this->simplexlsxgen->fromArray($excelArr);
$xlsx->saveAs('/');
SAMPLE OUTPUT OF ABOVE
Since in $excelArr
the value <<NEW>>
is simply written as it is, it displays an empty cell when exported in excel. Due to this, as what I mentioned above, I tried to use htmlspecialchars("<<NEW>>")
instead which I thought would work but it will display <<NEW>>
in the excel cell.
Use raw strings to insert tags https://github.com/shuchkin/simplexlsxgen#raw-strings