I cannot figure out how to apply background color to the cell in OpenTBS.
I've tried Word's syntax but it did not work.
[row.cell.val][row.cell.bg;att=w:shd#w:fill]
Code in PHP (simplified)
$rs = [
// ...
'cell' => [
'val' => 5,
'bg' => 'efefef',
],
// ...
];
$TBS->MergeBlock('row', $rs);
I looked inside XML body of excel document, but could not understand what tags and attributes define the color of the cell.
Can anyone help me?
It is quite difficult to change the background color of a cell in an XLSX workbook using OpenTBS (or other tool) because this information is stored a single style definition in a extra sub-file xl/styles.xml
and in a complicated way.
So when modifying the corresponding style you will also change the color of all other cells having this style. There is no other way in an XLSX to store the background color of a cell. (this is different is DOCX where you can store the information in the cell property).
So my suggestion is to to use an Excel conditional formatting for this purpose.