I have used the following (C++) code to assign a value to a cell and format it:
xlSht->AsString[0][0] = "Report for " + dtMthStart.FormatString("mmmm yyyy");
TCell* cl = xlSht->Cell[0][0];
cl->FontName = "Arial Black";
cl->FontStyle = TXFontStyles() << xfsBold;
cl->FontSize = 20;
cl->FontColor = xcRed;
All of this works fine apart from FontColor - no matter what I enter it always stays as the default colour (black).
FontColor doesn't seem to work
-
- Posts: 8
- Joined: Sun Jun 20, 2004 1:40 pm
- Location: New Zealand
- Contact:
-
- Posts: 8
- Joined: Sun Jun 20, 2004 1:40 pm
- Location: New Zealand
- Contact:
Re: FontColor doesn't seem to work
Further investigation has revealed that FontColor should be specified as RGB, rather than one of the Excel colours.
I then tried "cl->FontColor = XColorToRGB(xcGray50)", but that gave me R=128, G=128, B=0!
For now I have worked around this by assigning "cl->FontColor = 0x7f7f7f", as defined in Excel.
Lars, can you please check/fix the code for XColorToRGB?
I then tried "cl->FontColor = XColorToRGB(xcGray50)", but that gave me R=128, G=128, B=0!
For now I have worked around this by assigning "cl->FontColor = 0x7f7f7f", as defined in Excel.
Lars, can you please check/fix the code for XColorToRGB?