Bug in TEncodeFormula.ValueError for ERR_EMPTY_FORMULA

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
krilbe
Posts: 3
Joined: Wed Feb 20, 2008 4:41 pm
Location: Stockholm, Sweden

Bug in TEncodeFormula.ValueError for ERR_EMPTY_FORMULA

Post by krilbe »

Version 3.01.05.

In TEncodeFormula.ValueError, for ERR_EMPTY_FORMULA, the FTokenizer still holds the last formula encoded. The current, empty one, hasn't reached the tokenizer yet. Consequently, the following line will produce a misleading error message:

ErrStr := Format('Error in formula %s' + #13,[FTokenizer.Value]) + ErrStr;

It will say something like:

Error in formula $A$10+$B$10
Empty formula

Rather confusing, since "$A$10+$B$10" is NOT empty.

I think you need either to clear the FTokenizer state so that FTokenizer.Value is empty at this point, or write code for a special case for ERR_EMPTY_FORMULA, so that FTokenizer.Value isn't inserted into the error message.

By the way, you can write 'Error in formula %s'#13 without the + before #13.

Kjell
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Post by larsa »

Hello

Thank you, I will fix this.


Lars Arvidsson
Post Reply