Page 1 of 1

AutoWidthCol does not work for userdefined values

Posted: Thu Apr 11, 2013 8:03 am
by d3nton
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.

Re: AutoWidthCol does not work for userdefined values

Posted: Sat Apr 13, 2013 9:58 am
by larsa
Hello

This is fixed in update 5.10.15

Re: AutoWidthCol does not work for userdefined values

Posted: Mon Apr 15, 2013 12:28 pm
by d3nton
Thank you very much! Works now!