回答问题变成了推销控件,可笑可笑。
以下是答案:
type
TCellHyperLink=record
Address:string;
ScreenTip:string;
TextToDisplay:string;
end;
procedure ReadCellHyperLink(FileName,SheetName:WideString;ACol,ARow:Integer;var
LinkRec:TCellHyperLink);
var
xlBook,xlSheet,xlApp,xlRange:OleVariant;
Cell:string;
begin
xlApp:=CreateOleObject('Excel.Application');
xlBook:=xlApp.WorkBooks.Open(FileName);
xlSheet:=xlBook.Sheets[SheetName];
Cell:=Chr(Ord('A')+ACol-1)+IntToStr(ARow);
xlRange:=xlSheet.Range[Cell];
with LinkRec do
begin
Address:=xlRange.HyperLinks[1].Address;
TextToDisplay:=xlRange.HyperLinks[1].TextToDisplay;
ScreenTip:=xlRange.HyperLinks[1].ScreenTip;
end;
xlRange:=UnAssigned;
xlSheet:=UnAssigned;
xlBook:=UnAssigned;
xlApp.DisplayAlerts:=False;
xlApp.Quit;
xlApp:=UnAssigned;
end;