Bookmark.CharacterWidth 属性

获取或设置 Bookmark 控件中的文本的字符宽度。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)

语法

声明
Property CharacterWidth As WdCharacterWidth
    Get
    Set
WdCharacterWidth CharacterWidth { get; set; }

属性值

类型:Microsoft.Office.Interop.Word.WdCharacterWidth
WdCharacterWidth 值之一。

示例

下面的代码示例添加一个带有文本的 Bookmark 控件,然后将该文本的字符宽度更改为半角字符。

此示例针对的是文档级自定义项。

Private Sub BookmarkCharacterWidth()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "This is sample bookmark text."
    Bookmark1.CharacterWidth = Word.WdCharacterWidth.wdWidthHalfWidth

End Sub
private void BookmarkCharacterWidth()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";
    bookmark1.CharacterWidth = Word.WdCharacterWidth
        .wdWidthHalfWidth;
}

.NET Framework 安全性

请参见

参考

Bookmark 接口

Microsoft.Office.Tools.Word 命名空间