DocumentBase.FollowHyperlink 方法

解析超連結,或是如果已下載文件就顯示快取文件。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public Sub FollowHyperlink ( _
    ByRef address As Object, _
    ByRef subAddress As Object, _
    ByRef newWindow As Object, _
    ByRef addHistory As Object, _
    ByRef extraInfo As Object, _
    ByRef method As Object, _
    ByRef headerInfo As Object _
)
public void FollowHyperlink(
    ref Object address,
    ref Object subAddress,
    ref Object newWindow,
    ref Object addHistory,
    ref Object extraInfo,
    ref Object method,
    ref Object headerInfo
)

參數

  • subAddress
    型別:System.Object%
    目標文件內的位置。預設值為空字串。
  • newWindow
    型別:System.Object%
    true 表示在新視窗中顯示目標位置。預設值是 false。
  • addHistory
    型別:System.Object%
    true 表示在目前日期之歷程記錄資料夾中加入連結。
  • extraInfo
    型別:System.Object%
    字串或位元組陣列,指定 HTTP 的其他資訊以供解析超連結。例如,您可以使用 ExtraInfo 指定影像地圖座標、表單內容或 FAT 檔名。視 Method 值張貼或附加字串。使用 ExtraInfoRequired 屬性判斷是否需要額外的資訊。
  • headerInfo
    型別:System.Object%
    字串,指定 HTTP 要求的標題資訊。預設值為空字串。在 Visual Basic 中可以使用下列語法,將數個標頭行結合為單一字串:"string1" & vbCr & "string2"。指定的字串就會自動轉換成 ANSI 字元。請注意,HeaderInfo 引數可能會覆寫預設的 HTTP 標頭欄位。

備註

此方法會顯示位於 Address 參數的快取文件 (如果已下載此文件)。 否則,此方法會解析超連結、下載目標文件,並使用適當的應用程式顯示文件。 如果超連結使用檔案通訊協定,此方法就會開啟文件而不是下載文件。

選擇性參數

如需選擇性參數的詳細資訊,請參閱Office 方案中的選擇性參數

範例

下列程式碼範例會使用 FollowHyperlink 方法,在新視窗中顯示 Web 網頁。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

Private Sub DocumentFollowHyperlink()
    Me.FollowHyperlink(Address:="http://www.adatum.com", _
        NewWindow:=True, AddHistory:=False)
End Sub
private void DocumentFollowHyperlink()
{
    object address = "http://www.adatum.com/";
    object newWindow = true;
    object addHistory = false;

    this.FollowHyperlink(ref address, ref missing, ref newWindow,
        ref addHistory, ref missing, ref missing, ref missing);
}

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間