Share via


Bookmark.CharacterWidth 屬性

取得或設定 Bookmark 控制項中文字的寬度。

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

語法

'宣告
Property CharacterWidth As WdCharacterWidth
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 命名空間