strange problem produced with this source :
with X do
begin
Sheets [0].Name := 'test sheet';
for I := 0 to 7 do
for J := 0 to 12 do
Sheets [0].AsFloat [I, J] := Random (10000);
with Sheets [0].Range [3, 3, 5, 5] do
begin
BorderTopStyle := cbsThin;
BorderBottomStyle := cbsThin;
BorderRightStyle := cbsThin;
BorderLeftStyle := cbsThin;
BorderInsideVertStyle := cbsThin;
BorderInsideHorizStyle := cbsThin;
end;
Filename := 'D:\PROBA.XLS';
Write;
end;
where X is class TXLSReadWriteII2
when I've opened the file with Microsoft Excel (Office XP + Service Pack 3 - 10.6809.6811) I cannot modify the formatting of these cells
D4:F6 and cells immediate to them i.e. D3:F3, D7:F7, C4:C6 and G4:G6
problem with 3.00.02a
Another test with 3.00.02a
with X do
begin
Sheets [0].Name := 'test sheet';
for I := 0 to 7 do
for J := 0 to 12 do
Sheets [0].AsFloat [I, J] := Random (10000);
(* with Sheets [0].Range [3, 3, 5, 5] do
begin
// NumberFormat := '# ##0.00';
BorderTopStyle := cbsThin;
BorderBottomStyle := cbsThin;
BorderRightStyle := cbsThin;
BorderLeftStyle := cbsThin;
BorderInsideVertStyle := cbsThin;
BorderInsideHorizStyle := cbsThin;
end;*)
C := Formats.Count;
with Formats.Add do
begin
// NumberFormat := '# ##0.00';
BorderTopStyle := cbsThin;
BorderBottomStyle := cbsThin;
BorderRightStyle := cbsThin;
BorderLeftStyle := cbsThin;
end;
for I := 3 to 5 do
for J := 3 to 5 do
Sheets [0].Cell [I, J].AssignFormat (C);
Filename := 'D:\PROBA.XLS';
Write;
end;
when the formatting is made in old way i.e manual add formatting i set it to each cell, then EXCEL works fine with no problems about cell formatting
begin
Sheets [0].Name := 'test sheet';
for I := 0 to 7 do
for J := 0 to 12 do
Sheets [0].AsFloat [I, J] := Random (10000);
(* with Sheets [0].Range [3, 3, 5, 5] do
begin
// NumberFormat := '# ##0.00';
BorderTopStyle := cbsThin;
BorderBottomStyle := cbsThin;
BorderRightStyle := cbsThin;
BorderLeftStyle := cbsThin;
BorderInsideVertStyle := cbsThin;
BorderInsideHorizStyle := cbsThin;
end;*)
C := Formats.Count;
with Formats.Add do
begin
// NumberFormat := '# ##0.00';
BorderTopStyle := cbsThin;
BorderBottomStyle := cbsThin;
BorderRightStyle := cbsThin;
BorderLeftStyle := cbsThin;
end;
for I := 3 to 5 do
for J := 3 to 5 do
Sheets [0].Cell [I, J].AssignFormat (C);
Filename := 'D:\PROBA.XLS';
Write;
end;
when the formatting is made in old way i.e manual add formatting i set it to each cell, then EXCEL works fine with no problems about cell formatting
Range property
thanks, works fine when I set Border????Color in pair with Border????Style, it's a good idea to be set as default color: xcAutomatic or you mean the same ?