Colors

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
JonPedersen
Posts: 5
Joined: Sat Apr 02, 2011 2:10 pm

Colors

Post by JonPedersen »

Hi,
I am trying to modify the colors of the cell. I had thought the following code would do the trick:
ExcelColorPalette[1]:=$00F1E5DB; // light blue
with XLSCMI.Sheet[0] do Begin
AsString[0,0]:=CountryEdit.Text;
Cell[0,0].FontSize:=16;
Cell[0,0].FontStyle:=[xfsBold];
Cell[0,0].FillPatternForeColor:= xc1;
.....

the code (which would be suggested by the C++ example on the forum
ExcelColorPalette[xc1]:=$00F1E5DB;
does not compile

I have obviously misunderstood something
best
Jon
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Colors

Post by larsa »

Hello

ExcelColorPalette uses integer for index, not TExcelColor values. Hence vill the code ExcelColorPalette[xc1]:=$00F1E5DB not compile.
You can however use ExcelColorPalette[Integer(xc1)]:=$00F1E5DB
Lars Arvidsson, Axolot Data
JonPedersen
Posts: 5
Joined: Sat Apr 02, 2011 2:10 pm

Re: Colors

Post by JonPedersen »

Hi again,
Yes, I have tried that - it does compile and changes the palette, but does not have any effect on the colors in the spreadsheet.
jon
JonPedersen
Posts: 5
Joined: Sat Apr 02, 2011 2:10 pm

Re: Colors

Post by JonPedersen »

Hi,
Found a solution. It works if I for example use xc30 instead of xc1. From reading the code it seems that values less than 8 are not valid.
(see line 2305 in XLSReadWriteII4.pas)
best
Jon
Post Reply