GemBox.Document
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    WriteProtection Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.dll

    Represents the write protection options for the DocumentModel. Supported only in DOCX and DOC formats.

    • C#
    • VB.NET
    public sealed class WriteProtection
    Public NotInheritable Class WriteProtection
    Inheritance:
    System.Object
    WriteProtection
    Remarks

    Write protection refers to a mode in which the document's contents can be edited but the document cannot be resaved using the same file name.

    For more information, see DOCX Write Protection example.

    Constructors

    WriteProtection()

    Initializes a new instance of the WriteProtection class.

    • C#
    • VB.NET
    public WriteProtection()
    Public Sub New

    Properties

    HasPassword

    Returns true if DocumentModel is protected with the password against re-saving to the same file name.

    • C#
    • VB.NET
    public bool HasPassword { get; }
    Public ReadOnly Property HasPassword As Boolean
    Property Value
    System.Boolean

    true if DocumentModel is protected with the password against re-saving to the same file name; otherwise, false.

    ReadOnlyRecommended

    Gets or sets option that specifies if applications should provide user interface recommending that the user open this document in write protected state.

    • C#
    • VB.NET
    public bool ReadOnlyRecommended { get; set; }
    Public Property ReadOnlyRecommended As Boolean
    Property Value
    System.Boolean

    true if applications should provide user interface recommending that the user open this document in write protected state; otherwise, false.

    Remarks

    User interface recommending that the user open this document in write protected state is only presented if password is not specified.

    Methods

    Clone()

    Clones this WriteProtection instance.

    • C#
    • VB.NET
    public WriteProtection Clone()
    Public Function Clone As WriteProtection
    Returns
    WriteProtection

    Cloned WriteProtection.

    SetPassword(String)

    Sets the write protection password for the current DocumentModel instance.

    • C#
    • VB.NET
    public void SetPassword(string password)
    Public Sub SetPassword(password As String)
    Parameters
    password
    System.String

    New write protection password (or null to remove password from write protection).

    Remarks

    Password is optional for write protection, but without it any user will be able to open the document as not read-only and thus be able to resave the document using the same file name.

    Examples

    DOCX Write Protection example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.