diff --git a/components/fpspreadsheet/fpsclasses.pas b/components/fpspreadsheet/fpsclasses.pas index 89525d888..f55d908fc 100644 --- a/components/fpspreadsheet/fpsclasses.pas +++ b/components/fpspreadsheet/fpsclasses.pas @@ -24,20 +24,20 @@ type protected FCurrentNode: TAVLTreeNode; FTree: TsRowColAVLTree; - FStartRow, FEndRow, FStartCol, FEndCol: Cardinal; + FStartRow, FEndRow, FStartCol, FEndCol: LongInt; FDone: Boolean; FReverse: Boolean; function GetCurrent: PsRowCol; public constructor Create(ATree: TsRowColAVLTree; - AStartRow, AStartCol, AEndRow, AEndCol: Cardinal; AReverse: Boolean); + AStartRow, AStartCol, AEndRow, AEndCol: LongInt; AReverse: Boolean); function GetEnumerator: TsRowColEnumerator; inline; function MoveNext: Boolean; property Current: PsRowCol read GetCurrent; - property StartRow: Cardinal read FStartRow; - property EndRow: Cardinal read FEndRow; - property StartCol: Cardinal read FStartCol; - property EndCol: Cardinal read FEndCol; + property StartRow: LongInt read FStartRow; + property EndRow: LongInt read FEndRow; + property StartCol: LongInt read FStartCol; + property EndCol: LongInt read FEndCol; end; { TsRowColAVLTree } @@ -197,7 +197,7 @@ end; {******************************************************************************} constructor TsRowColEnumerator.Create(ATree: TsRowColAVLTree; - AStartRow, AStartCol, AEndRow, AEndCol: Cardinal; AReverse: Boolean); + AStartRow, AStartCol, AEndRow, AEndCol: LongInt; AReverse: Boolean); var node: TAVLTreeNode; begin @@ -224,7 +224,8 @@ begin if FEndRow = $7FFFFFFF then begin node := FTree.FindHighest; - FEndRow := PsRowCol(node.Data)^.Row; + if node <> nil then + FEndRow := PsRowCol(node.Data)^.Row; end; end; diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index 76d4b1357..3a9476638 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -1601,9 +1601,8 @@ end; procedure TsWorksheet.WriteHyperlink(ACell: PCell; ATarget: String; ATooltip: String = ''); var - hyperlink: PsHyperlink; fmt: TsCellFormat; - target, bm, fn, displayTxt: String; + target, bm, displayTxt: String; begin if ACell = nil then exit; @@ -1613,20 +1612,19 @@ begin exit; end; - hyperlink := FHyperlinks.AddHyperlink(ACell^.Row, ACell^.Col, ATarget, ATooltip); + FHyperlinks.AddHyperlink(ACell^.Row, ACell^.Col, ATarget, ATooltip); Include(ACell^.Flags, cfHyperlink); if ACell^.ContentType = cctEmpty then begin SplitHyperlink(ATarget, target, bm); - displayTxt := ATarget; - if pos('file:', lowercase(displayTxt))=1 then + if pos('file:', lowercase(ATarget))=1 then begin - URIToFilename(displayTxt, displayTxt); -// Delete(displayTxt, 1, Length('file:///')); + URIToFilename(target, displayTxt); ForcePathDelims(displayTxt); - if bm <> '' then displayTxt := fn + '#' + bm; - end; + if bm <> '' then displayTxt := displayTxt + '#' + bm; + end else + displayTxt := ATarget; ACell^.ContentType := cctUTF8String; ACell^.UTF8StringValue := displayTxt; end;