Page 1 of 1

Floating point invalid operation when using Sheets.asFloat

Posted: Wed Feb 27, 2013 10:21 am
by d3nton
Hi!

I am using then new XLSReadWriteII 5.1 but I am having problems saving values as float:
The Delphi code below results in a 'Floating point invalid operation' in function TXLSCellMMU.EncodeNumber:

var
ExcelFile : TXLSReadWriteII5;
begin
ExcelFile := TXLSReadWriteII5.Create(nil);
ExcelFile.Filename := 'C:\output.xlsx';
ExcelFile.Sheets[0].InsertRows(0,0);
ExcelFile.Sheets[0].AsFloat[0, 0] := 10000000; <-
ExcelFile.Write;
end.

Please help.
Thanks d3nton

Re: Floating point invalid operation when using Sheets.asFloat

Posted: Thu Feb 28, 2013 10:56 am
by larsa
Hello

The problem is the delphi RoundTo function that is buggy. The behaivor of RoundTo has also changed in recent Delphi versions. When this exception happends, stop at the source code and change RoundTo to XLSRoundTo, or if you have XLSRoundTo, change to RoundTo.

Re: Floating point invalid operation when using Sheets.asFloat

Posted: Fri Mar 08, 2013 8:16 am
by d3nton
Okay thank you!
I see that you have already fixed this in the newest version :)