Closed JanMarvin closed 1 year ago
Ok. This is where I need someone with a little more expertise in the quirks of excel XML.
The fix itself should have been quite easy. Just coalesce the color if it is not set in the font itself, white color in the example. Nice.
But when I try to create something like this with the new code Excel complains of malformatted rows:
ft <- flextable::as_flextable(table(mtcars[,1:2]))
wb <- openxlsx2::wb_workbook()$add_worksheet("mtcars")
wb_add_flextable(wb, "mtcars", ft)$save(tmpfile)
I guess this has something to do with applying "standard values" for color - in this case "black" - that should not be set, because it is the standard color value in this Excel file? But that is just a wild guess.
This is more or less a question for flextable. In openxml you have font colors in styles and rich text strings can contain style colors too. There is no such thing as a transparent font in openxml. You can apply font color auto, but not transparent (after all transparent would indicate that there is no visible content in the cell).
Should be more or less fixed. Could become an issue again if color of the Excel file is not black as default, though maybe a non-problem. Will try that out later.
Another example from: https://www.ardata.fr/en/flextable-gallery/
The font of the table should be white, but is black. The cell color and the
fmt_txt()
color differ.