Three Problems with 5.10.05

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
pl00
Posts: 11
Joined: Sat Feb 09, 2013 8:44 pm

Three Problems with 5.10.05

Post by pl00 »

1. Freezing top rows causes those rows to be displayed twice when the resulting spreadsheet is opened. Scrolling the sheet resolves the issue. If the spreadsheet is saved after the scrolling, it displays correctly on subsequent opens.

2. AutowidthCols doesn't work propery if cells contain non default formatting. The two I've tested are "$"#,##0.00 for floats and dd mmm yyyy for DateTime. The columns aren't wide enough to display the values.

3. Creating and using a DefaultFormat which includes a date structure (eg dd mmm yyyy) doesn't work and it corrupts the value being entered into the cell (the resultant cell value appears to be the Index of the selected format).

2 & 3 can be worked around, but 1 is a bit of an issue for me.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Three Problems with 5.10.05

Post by larsa »

Hello

1. I don't know how you have created the frozen panes, but in the latest update there is a new method for easier create frozen panes: XLS[sheet].FreezePanes(Col,Row)

2,3 This is fixed in update 5.10.06
Lars Arvidsson, Axolot Data
pl00
Posts: 11
Joined: Sat Feb 09, 2013 8:44 pm

Re: Three Problems with 5.10.05

Post by pl00 »

Thanks for the fixes - most of the issues are resolved. However, I still have a problem with formatting dates.

I use:

FXLS.CmdFormat.BeginEdit(Nil);
FXLS.CmdFormat.Number.Format := 'dd mmm yyyy';
FXLS.CmdFormat.Alignment.Horizontal := chaCenter;
FXLS.CmdFormat.AddAsDefault('FCDate');
Format_CDate := FXLS.CmdFormat.Defaults.Count-1;

to set up for Default format then

FXLS.DefaultFormat := FXLS.CmdFormat.Defaults[Format_CDate]
FXLS[Sheet].AsDateTime[Col,Row] := DateValue;
FXLS.DefaultFormat := nil;

Irresepective of the value written to the cell, the result is always 10 (which happens to be the count of the number of default formats before this format was created).
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Three Problems with 5.10.05

Post by larsa »

Hello

If you changes the number format you can not use AsDateTime as this will also change the number format. There are no date/time cells in excel. A date/time cell is created by formatting a float value as a date/time value (the date float is the same as delphi TDateTime). Use AsFloat. Example:

Code: Select all

FXLS[Sheet].AsFloat[Col,Row] := DateValue;
Lars Arvidsson, Axolot Data
pl00
Posts: 11
Joined: Sat Feb 09, 2013 8:44 pm

Re: Three Problems with 5.10.05

Post by pl00 »

Thanks - that nailed it.
maseline_98
Posts: 10
Joined: Fri Jan 20, 2012 11:49 pm

Re: Three Problems with 5.10.05

Post by maseline_98 »

pl00 wrote:Thanks - that nailed it.

How did you resolve the autoWidthCols? It's not seeming to work for me.

Code: Select all

   
 NUM_FORMAT = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'; 
AutoWidthCols(0, LAST_COL);
Range.Items[DISC_COL, 0, LAST_COL, iRow].NumberFormat := NUM_FORMAT;
Post Reply