Floating point error during hyperlink creation

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
d3nton
Posts: 137
Joined: Thu Oct 25, 2012 9:48 am

Floating point error during hyperlink creation

Post 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.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Floating point error during hyperlink creation

Post by larsa »

Hello

This is fixed in update 5.20.14
Lars Arvidsson, Axolot Data
d3nton
Posts: 137
Joined: Thu Oct 25, 2012 9:48 am

Re: Floating point error during hyperlink creation

Post 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
Post Reply