共用方式為


Bookmark.SynonymInfo Property

Definition

Gets a SynonymInfo that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the text in the Bookmark control.

public:
 property Microsoft::Office::Interop::Word::SynonymInfo ^ SynonymInfo { Microsoft::Office::Interop::Word::SynonymInfo ^ get(); };
public Microsoft.Office.Interop.Word.SynonymInfo SynonymInfo { get; }
member this.SynonymInfo : Microsoft.Office.Interop.Word.SynonymInfo
Public ReadOnly Property SynonymInfo As SynonymInfo

Property Value

A SynonymInfo that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the text in the Bookmark control.

Examples

The following code example adds a Bookmark control with text to the document and then displays a message box if a synonym is found for the third word in the bookmark.

This example is for a document-level customization.

private void BookmarkSynonymInfo()
{
    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.";

    if(bookmark1.Words[3].SynonymInfo.Found)
    {
        MessageBox.Show("A synonym for " + bookmark1.Words[3].Text +
            "was found.");
    }	
}
Private Sub BookmarkSynonymInfo()

    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."

    If bookmark1.Words(3).SynonymInfo.Found Then
        MessageBox.Show("A synonym for " & Bookmark1.Words(3).Text _
            & "was found.")
    End If

End Sub

Applies to