Easiest way to generate an Excel file from a web grid containing html

Just informing if anybody has suggestions.
We generate a planning view (web) using a html stringgrid an fill it up with html paragraphs.
We also have conditions for each cell where lines need to be colored or backgrounds need to be colored.
Does anybody have an idea how we could easily export this to an Excel-file?
Each cell correspondents to a record in a memory dataset where the whole formatting of the cell is contained in a string. Each record can contain a html tag for the background color of the cell and a number of paragraph items separated by a break. Each paragraph item can also have a color.
The background color on certain text as shown in the screenshot is not necessary, it would be enough if the text itself is colored.

Could we for instance generate a similar record for each cell to be used in Excell with all the formatting?

The main difficulty I see here is that the HTML accepted in Excel is very limited (you can basically just change the font). So you can't have for example a part of the cell with yellow background and the other green, as you have in this example.

Now, about how to do it, there are 2 ways:You could use a report, or the API. Both approaches are possible, but given the generic nature of the exporting, I think the API would be a little simpler.

So you need to:
Use xls.SetCellFromHtml() (see https://doc.tmssoftware.com/flexcel/vcl/api/FlexCel.XlsAdapter/TXlsFile/SetCellFromHtml.html#txlsfilesetcellfromhtml-method ) to loop over the memory dataset and fill the cells.
In the XF parameter of SetCellFromHtml you can specify the background color for the full cell.

I think this might be the simplest, but it really depends on your case. If you preferred to use reports, you can use the tag ( see https://doc.tmssoftware.com/flexcel/vcl/guides/reports-tag-reference.html#html ) to enter values from the memory dataset into the report, and <#format cell> (see https://doc.tmssoftware.com/flexcel/vcl/guides/reports-tag-reference.html#format-cell ) to format the background of each cell