共用方式為


Bookmark.Editors 屬性

取得 Editors 物件,表示獲得授權修改文件中 Bookmark 控制項的所有使用者。

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

語法

'宣告
ReadOnly Property Editors As Editors
    Get
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 命名空間