AutoWidthCol does not work for userdefined values

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
d3nton
Posts: 137
Joined: Thu Oct 25, 2012 9:48 am

AutoWidthCol does not work for userdefined values

Post 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.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: AutoWidthCol does not work for userdefined values

Post by larsa »

Hello

This is fixed in update 5.10.15
Lars Arvidsson, Axolot Data
d3nton
Posts: 137
Joined: Thu Oct 25, 2012 9:48 am

Re: AutoWidthCol does not work for userdefined values

Post by d3nton »

Thank you very much! Works now!
Post Reply