Code: Select all
var
ct: Integer;
begin
try
XLSReadWriteII51.FileName:='C:\XLSReadWriteII.xlsx';
XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:D10'].BorderInsideVertStyle := cbsThin;
XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:D10'].BorderInsideHorizStyle := cbsThin;
XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:D10'].BorderOutlineStyle := cbsThin;
XLSReadWriteII51.CmdFormat.BeginEdit(XLSReadWriteII51[0]);
XLSReadWriteII51.CmdFormat.Clear;
XLSReadWriteII51.CmdFormat.Fill.BackgroundColor.RGB := clYellow;
XLSReadWriteII51.CmdFormat.Font.Name := 'MS Sans Serif';
XLSReadWriteII51.CmdFormat.Font.Size := 8;
XLSReadWriteII51.CmdFormat.Number.Format:='@';
XLSReadWriteII51.CmdFormat.Apply(0, 0, 3, 9);
for ct:=0 to 9 do
begin
XLSReadWriteII51.Sheets[0].AsString[0, ct]:=IntToStr(ct);
XLSReadWriteII51.Sheets[0].AsString[1, ct]:=IntToStr(ct);
XLSReadWriteII51.Sheets[0].AsString[2, ct]:=IntToStr(ct);
XLSReadWriteII51.Sheets[0].AsString[3, ct]:=IntToStr(ct);
end;
finally
XLSReadWriteII51.Write;
end;
end;