Bookmark.Editors 属性

获取一个 Editors 对象,该对象表示获得修改文档中 Bookmark 控件的授权的所有用户。

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

语法

声明
ReadOnly Property Editors As Editors
Editors Editors { get; }

属性值

类型:Microsoft.Office.Interop.Word.Editors
一个 Editors 对象,表示获得修改文档中 Bookmark 控件的授权的所有用户。

示例

下面的代码示例向文档的第一个段落添加一个带有文本的 Bookmark 控件,并将所有用户添加为该书签中第四个单词的编辑者。 然后该示例保护该文档不被修订,并在消息框中显示该书签的可编辑范围。

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

Private Sub BookmarkEditors()

    Dim editor As Object = Word.WdEditorType.wdEditorEveryone
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    Bookmark1.Text = "This text cannot be edited."
    Bookmark1.Words(4).Editors.Add(editor)
    Me.Protect(Word.WdProtectionType.wdAllowOnlyReading)

    Dim range1 As Word.Range = Bookmark1.GoToEditableRange(editor)

    If Not (range1 Is Nothing) Then
        MessageBox.Show("The editable Range of Bookmark1 spans from " _
            & range1.Start.ToString & " to " & range1.End.ToString)
    End If

End Sub
private void BookmarkEditors()
{
    object editor = Word.WdEditorType.wdEditorEveryone;
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This text cannot be edited.";
    bookmark1.Words[4].Editors.Add(ref editor);
    this.Protect(Word.WdProtectionType.wdAllowOnlyReading,
        ref missing, ref missing, ref missing, ref missing);

    Word.Range range1 = bookmark1.GoToEditableRange(ref editor);

    if (range1 != null)
    {
        MessageBox.Show("The editable Range of bookmark1 spans from " +
            range1.Start.ToString() + " to " + range1.End.ToString());
    }
}

.NET Framework 安全性

请参见

参考

Bookmark 接口

Microsoft.Office.Tools.Word 命名空间