Code: Select all
uses XlsReadWriteII5, XLSCmdFormat5, Xc12Utils5, Xc12DataStyleSheet5, SysUtils, Graphics;
procedure TestIndexColor;
var
LDoc: TXLSReadWriteII5;
LFormat: TXLSCmdFormat;
I: Integer;
const
LColor = $07C1FF;
begin
try
LDoc := TXLSReadWriteII5.Create(nil);
LDoc.Palette[9] := $07C1FF;
LDoc.Sheets[0].AsString[3, 3] := 'Hello!';
LFormat := LDoc.CmdFormat;
LFormat.BeginEdit(LDoc[0]);
LFormat.Fill.BackgroundColor.IndexColor := TXc12IndexColor(9);
LFormat.Apply(3, 3);
LDoc.Filename := 'C:\TEMP\COLOR.XLSX';
// Workaround
for I := 0 to High(Xc12IndexColorPalette) do
LDoc.Manager.StyleSheet.InxColors.Add.RGB := //
((LDoc.Palette[I] shl 16) and $FF0000) or //
(LDoc.Palette[I] and $00FF00) or //
((LDoc.Palette[I] shr 16) and $0000FF);
LDoc.Write;
finally
freeAndNil(LDoc);
end;
end;