How to specify font color
C++ library for creating XLSX files for MS Excel 2007 and above.
Brought to you by:
oxod,
programmeralex
Hello,
I'm having trouble to specify a text's font color. Here is the code:
...
Style FontStyle;
FontStyle.font.color = "FFFF0000";
FontStyle.font.attributes = FONT_BOLD;
..
const size_t FontStyleCode = book.AddStyle(FontStyle);
..
Sheet.BeginRow().AddCell("some text", FontStyleCode).AddCell(..).EndRow();
..
The outputted Excel (.xlsx) has "some text" in bold and black (default). How do I change the text's color to whatever I want?
Thanks.
George
I've figured it out that theme should be false, i.e.,
..
Style FontStyle;
FontStyle.font.color = "FFFF0000";
FontStyle.font.attributes = FONT_BOLD;
FontStyle.font.theme = false;
..
const size_t FontStyleCode = book.AddStyle(FontStyle);
..
The outputted text font color ("some text") will follow font.color.
George