Page 1 of 1

Floating point error during hyperlink creation

Posted: Fri Jan 17, 2014 8:19 am
by d3nton
Hi!

I got a floating point error on hyperlink creation (xls and xlsx) for the following hyperlink (XLSReadWrite 5.20.12):
I know that the hyperlink is not valid in windows but we use these kind of hyperlinks in another context,
so it would be nice if the the file would be created correctly.
Issue seems to be in XLSEncodeFmla5.pas procedure DoOperator(AOperator: byte);

Code: Select all

var
  ExcelFile5 : TXLSReadWriteII5;
  lHyperlink: TXLSHyperlink;
begin
  ExcelFile5 := TXLSReadWriteII5.Create(nil);
  ExcelFile5.Filename := 'C:\test.xlsx';
  ExcelFile5.Sheets[0].AsString[1,0] := 'test';
  lHyperlink := ExcelFile5[0].Hyperlinks.Add;
  lHyperlink.Col1 := 0;
  lHyperlink.Row1 := 0;
  lHyperlink.Col2 := 0;
  lHyperlink.Row2 := 0;
  lHyperlink.Address := 'exchange://merkur/discoverysearchmailbox{d919ba05-46a6-415f-80ad-7e09334bb852}';
  ExcelFile5.Write;
end.
Thanks.

Re: Floating point error during hyperlink creation

Posted: Tue Jan 21, 2014 2:40 pm
by larsa
Hello

This is fixed in update 5.20.14

Re: Floating point error during hyperlink creation

Posted: Tue Jan 28, 2014 1:08 pm
by d3nton
Thank you.
I guess you mean 5.20.13?!
It works now. But it seems that the changes in TXLSHyperlink.SetAddress:

Code: Select all

 if IsURL(Value) or BeginWith('www.') then begin
//  if BeginWith('http://') or BeginWith('https://') or BeginWith('www.') or BeginWith('ftp://') then begin
    FHyperlinkType := xhltURL;
    S := EncodeFileHLink(S);
  end
corrupted hyperlinks with [,],{,} etc... described here: viewtopic.php?f=16&t=2109&sid=633d1bf92 ... 681b4d4b26
exporting e.g. C:\test[]{} to an xlsx files. Then read the file, add a new hyperlinka will corrupt the first hyperlink C:\test[]{} using XLSREadWrite 5.20.13