Export to excel and background colour of individual cells
Is it possible to extend the "export to excel" to support the background colour of individual cells?
The following script shows the issue
"Normal".Dump(); Util.WithStyle("Heading", "font-size:20pt; color:blue").Dump(); Enumerable.Range(1, 2).Dump("Normal Range"); Util.Highlight(Enumerable.Range(1, 2)).Dump("Highlighted Range"); Enumerable.Range(1, 2).Select(a => Util.HighlightIf(a > 1, a)).Dump("Partially Highlighted"); Enumerable.Range(1, 2).Select(a => a > 1 ? Util.WithStyle(a, "font-size:20pt; color:blue; background:yellow") : a).Dump("Individual styles");
Exported to Excel via Html (everything and formatting) shows up as
The background colour shows on the "Highlighted range" but not the last two, although the latter is showing the correct foreground colour.
I'm using v8.6.4.
Thanks
Comments
It's a bit of a pain, because the .xlsx format requires creating a style sheet with a style for every combination of types, formatting and adornments. I'd need to create a style manager that generates a bespoke stylesheet for each export rather than using a static one.
In that case, ignore this. I've been using Linqpad for over 15 years and this has only ever been a minor inconvenience for me.