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 解决方案中的可选参数

适用于