HorizAlignment and VertAlignment don't work in 2007
Posted: Sun May 02, 2010 10:16 am
Hi,
I have tried the following code and when I export to Excel 2007 format the alignments are completely ignored. If I export to Excel 97 - 2003 format it applies the formatting:
procedure TForm1.Button15Click(Sender: TObject);
var
Temp : TXLSReadWriteII4;
begin
Temp := TXLSReadWriteII4.Create(Self);
try
temp.Filename := 'C:\fileXLSReadWrite.xlsx';
Temp.Version := xvExcel2007;
Temp.Sheet[0].AsString[1,6] := 'Anton';
Temp.Sheet[0].Cell[1,6].HorizAlignment := chaCenter;
Temp.Sheet[0].Cell[1,6].VertAlignment := cvaCenter;
Temp.Write;
finally
Temp.Free;
end;
end;
Now I remember reading somewhere that the Excel 2007 functionality currently supports cell formatting and wrapping. Why is this functionality not working?
How can I get this to work?
Anton Bosch
I have tried the following code and when I export to Excel 2007 format the alignments are completely ignored. If I export to Excel 97 - 2003 format it applies the formatting:
procedure TForm1.Button15Click(Sender: TObject);
var
Temp : TXLSReadWriteII4;
begin
Temp := TXLSReadWriteII4.Create(Self);
try
temp.Filename := 'C:\fileXLSReadWrite.xlsx';
Temp.Version := xvExcel2007;
Temp.Sheet[0].AsString[1,6] := 'Anton';
Temp.Sheet[0].Cell[1,6].HorizAlignment := chaCenter;
Temp.Sheet[0].Cell[1,6].VertAlignment := cvaCenter;
Temp.Write;
finally
Temp.Free;
end;
end;
Now I remember reading somewhere that the Excel 2007 functionality currently supports cell formatting and wrapping. Why is this functionality not working?
How can I get this to work?
Anton Bosch