Bookmark.InsertCaption(Object, Object, Object, Object, Object) 方法

定義

插入 Bookmark 控制項之前或之後立即插入標題。

public void InsertCaption (ref object Label, ref object Title, ref object TitleAutoText, ref object Position, ref object ExcludeLabel);
abstract member InsertCaption : obj * obj * obj * obj * obj -> unit
Public Sub InsertCaption (ByRef Label As Object, Optional ByRef Title As Object, Optional ByRef TitleAutoText As Object, Optional ByRef Position As Object, Optional ByRef ExcludeLabel As Object)

參數

Label
Object

要插入的標題標籤。 WdCaptionLabelID.

Title
Object

如果TitleAutoText指定) ,則會忽略卷標緊接在標籤後面的文字 標題 (。

TitleAutoText
Object

您想要緊接在標籤後面插入標籤的自動圖文集專案,標題 (會覆寫) 所Title指定的任何文字。

Position
Object

指定標題是否插入在 Bookmark 控制項上方或下方。 WdCaptionPosition.

ExcludeLabel
Object

true 表示不包含文字標籤,如 參數中所 Label 定義。 false 表示包含指定的標籤。

範例

下列程式代碼範例會將含有文字的控件新增Bookmark至檔,然後將 標題 插入書籤中。

此範例適用於檔層級自定義。

private void BookmarkInsertCaption()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "First bookmark";

    object Label = Word.WdCaptionLabelID.wdCaptionFigure;
    object Position = Word.WdCaptionPosition.wdCaptionPositionAbove;
    object ExcludeLabel = false;

    bookmark1.InsertCaption(ref Label, ref missing, ref missing,
        ref Position, ref ExcludeLabel);
}
Private Sub BookmarkInsertCaption()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "First bookmark"

    Bookmark1.InsertCaption(Label:=Word.WdCaptionLabelID.wdCaptionFigure, _
        Position:=Word.WdCaptionPosition.wdCaptionPositionAbove, _
        ExcludeLabel:=False)

End Sub

備註

選擇性參數

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

適用於