You can reproduce the problem slightly modifying the FormatCells demo example.
I have modified the cell background colors for the first and second default format (but the problem applies also to font colors).
Code: Select all
procedure TfrmMain.btnDefaultFormatClick(Sender: TObject);
...
// Create first default format.
// The sheet parameter of BeginFormat is Nil, as it's not assigned to any
// particular woeksheet.
XLS.CmdFormat.BeginEdit(Nil);
//XLS.CmdFormat.Fill.BackgroundColor.RGB := $7F7F10;
XLS.CmdFormat.Fill.BackgroundColor.RGB := 16428467; //EMILIO MODIFIED COLOR
XLS.CmdFormat.Font.Name := 'Courier new';
//XLS.CmdFormat.Font.Color.RGB := 16428467; //EMILIO MODIFIED COLOR ALSO USED FOR FONT COLOR
XLS.CmdFormat.AddAsDefault('F1');
// Create second default format.
XLS.CmdFormat.BeginEdit(Nil);
XLS.CmdFormat.Fill.BackgroundColor.RGB := 8454016; //EMILIO MODIFIED COLOR
//XLS.CmdFormat.Fill.BackgroundColor.RGB := $FF1010;
XLS.CmdFormat.Font.Name := 'Ariel Black';
//XLS.CmdFormat.Font.Color.RGB := 8454016; //EMILIO MODIFIED COLOR ALSO USED FOR FONT COLOR
XLS.CmdFormat.Border.Color.IndexColor := xcBlack;
XLS.CmdFormat.Border.Style := cbsThick;
XLS.CmdFormat.Border.Preset(cbspOutline);
XLS.CmdFormat.AddAsDefault('F2');
...
end;
If I reopen the file with Excel (I'm using Excel 2007), I find that the cell colors have changed (not only visually, the RGB components have actually changed).
This issue occurs only if I specify the xvExcel97 format in the FormCreate event (using the default 2007 format all works fine).
Code: Select all
XLS.Version := xvExcel97;
I'm using Delphi 2009 and version 5.20.21 of the component.
If you need a zipped project, I can send it to you (I was unable to add attachments).
Thanks in advance
Emilio