AutoWidthCol does not work for userdefined values
Posted: Thu Apr 11, 2013 8:03 am
Hi!
AutoWithCol works fine for different value types (e.g. date values) but not for user defined (date) values.
In my code i have to convert a string value into date. This works fine but unfortunately the AutoWidthCol does not work if hours, minutes and seconds are included (for both xls and xlsx):
var
ExcelFile5 : TXLSReadWriteII5;
lDate: TDateTime;
begin
ExcelFile5 := TXLSReadWriteII5.Create(nil);
ExcelFile5.Filename := 'D:\output.xlsx';
TryStrToDateTime('02.03.2013 12:10:30', ldate); <- converts dd.mm.yy hh.mm.ss to date
ExcelFile5[0].AsDateTime[0,0] := ldate; <- results in a 'user defined' cell in Excel which is okay
ExcelFile5[0].AutoWidthCol(0); <- does not work on user-defined formatting
ExcelFile5.Write;
end.
For date values like' dd.mm.yy' which are recognized as 'date formatted' in excel and not as 'user-defined' the AutoWidhtCol works fine.
Thanks for help.
AutoWithCol works fine for different value types (e.g. date values) but not for user defined (date) values.
In my code i have to convert a string value into date. This works fine but unfortunately the AutoWidthCol does not work if hours, minutes and seconds are included (for both xls and xlsx):
var
ExcelFile5 : TXLSReadWriteII5;
lDate: TDateTime;
begin
ExcelFile5 := TXLSReadWriteII5.Create(nil);
ExcelFile5.Filename := 'D:\output.xlsx';
TryStrToDateTime('02.03.2013 12:10:30', ldate); <- converts dd.mm.yy hh.mm.ss to date
ExcelFile5[0].AsDateTime[0,0] := ldate; <- results in a 'user defined' cell in Excel which is okay
ExcelFile5[0].AutoWidthCol(0); <- does not work on user-defined formatting
ExcelFile5.Write;
end.
For date values like' dd.mm.yy' which are recognized as 'date formatted' in excel and not as 'user-defined' the AutoWidhtCol works fine.
Thanks for help.