Issue with AutoWidthCol and Userformat

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
ich947
Posts: 4
Joined: Fri Jul 12, 2013 12:25 pm

Issue with AutoWidthCol and Userformat

Post by ich947 »

The autosizing of columns with an userformat does not work correctly.

Our column-format looks like this: '0.00%'
We are setting the format via CmdFormat.Number.Format or with SetFloatValue(...)

But the AutoWidthCol-function does not respect our userformat.
Because of this, the calculated width is to small to fit the values with our numberformat.

I´ve found out, that the GetAsFmtString-function, which is used in .AutoWidthCol, returns for example '1' instead of '100.00%'.

I think the origin of that error is in TExcelMask.SetMask(Value).
"Value" contains our number-format ('0.00%').
At the beginning of the function the Value-parameter gets cleaned up. (It removes some special characters)
But after that the Value gets never used.
The "clean-up" is followed by this line:

Code: Select all

FMask := '@'; // Value;
I´m irritated why Value is commented out. And I have no idea what '@' means.
If I replace that '@' with "Value" the autosizing works.
Now GetAsFmtString returns the correct value ('100.00%').


Can you please check that issue?
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Issue with AutoWidthCol and Userformat

Post by larsa »

Hello

Sorry, FMask := @; was for debugging... This is corrected now.
Lars Arvidsson, Axolot Data
Post Reply