Bookmark.GetSpellingSuggestions 方法

获取一个 SpellingSuggestions 集合,该集合表示建议作为 Bookmark 控件中的第一个单词的拼写替换的单词。

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

语法

声明
Function GetSpellingSuggestions ( _
    ByRef CustomDictionary As Object, _
    ByRef IgnoreUppercase As Object, _
    ByRef MainDictionary As Object, _
    ByRef SuggestionMode As Object, _
    ByRef CustomDictionary2 As Object, _
    ByRef CustomDictionary3 As Object, _
    ByRef CustomDictionary4 As Object, _
    ByRef CustomDictionary5 As Object, _
    ByRef CustomDictionary6 As Object, _
    ByRef CustomDictionary7 As Object, _
    ByRef CustomDictionary8 As Object, _
    ByRef CustomDictionary9 As Object, _
    ByRef CustomDictionary10 As Object _
) As SpellingSuggestions
SpellingSuggestions GetSpellingSuggestions(
    ref Object CustomDictionary,
    ref Object IgnoreUppercase,
    ref Object MainDictionary,
    ref Object SuggestionMode,
    ref Object CustomDictionary2,
    ref Object CustomDictionary3,
    ref Object CustomDictionary4,
    ref Object CustomDictionary5,
    ref Object CustomDictionary6,
    ref Object CustomDictionary7,
    ref Object CustomDictionary8,
    ref Object CustomDictionary9,
    ref Object CustomDictionary10
)

参数

  • CustomDictionary
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是自定义字典的文件名。
  • IgnoreUppercase
    类型:System.Object%
    为 true,则忽略全部是大写字母的单词。如果省略此参数,则使用 IgnoreUppercase 属性的当前值。
  • MainDictionary
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是主字典的文件名。如果不指定主字典,则 Microsoft Office Word 使用对应于 Bookmark 控件中的第一个单词的语言格式设置的主字典。
  • CustomDictionary2
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary3
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary4
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary5
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary6
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary7
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary8
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary9
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。
  • CustomDictionary10
    类型:System.Object%
    或者是一个返回 Dictionary 的表达式,或者是附加的自定义字典的文件名。您最多可以指定九个附加字典。

返回值

类型:Microsoft.Office.Interop.Word.SpellingSuggestions
一个 SpellingSuggestions 集合。

备注

可选参数

有关可选参数的信息,请参见Office 解决方案中的可选参数

示例

下面的代码示例向第一个段落添加一个带有拼写错误的文本的 Bookmark 控件,然后在消息框中显示第一个拼写建议。

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

Private Sub BookmarkGetSpellingSuggestions()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    Bookmark1.Text = "missspeling."

    Dim suggestions As Word.SpellingSuggestions = _
        Bookmark1.GetSpellingSuggestions(IgnoreUppercase:=True, _
        SuggestionMode:=Word.WdSpellingWordType.wdSpellword)

    MessageBox.Show("The first suggestion is: " & suggestions(1).Name)

End Sub
private void BookmarkGetSpellingSuggestions()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "missspeling.";

    object IgnoreUppercase = true;
    object SuggestionMode = Word.WdSpellingWordType.wdSpellword;

    Word.SpellingSuggestions suggestions =
        bookmark1.GetSpellingSuggestions(ref missing, ref IgnoreUppercase,
        ref missing, ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing);

    MessageBox.Show("The first suggestion is: " +
        suggestions[1].Name);
}

.NET Framework 安全性

请参见

参考

Bookmark 接口

Microsoft.Office.Tools.Word 命名空间