Protect Unprotect Visio Diagram

Visio files are used to represent different graphical diagrams like network layouts, database models, object mapping, etc. Some diagrams or layouts can be confidential so you might need to protect Visio files from unauthorized access. Accordingly, this article covers securing the Visio files by protecting or unprotecting the files as per your requirements.

Protect or Unprotect Visio Diagram Files – .NET API Installation

Aspose.Diagram for .NET API enables you to create, edit, or manipulate Microsoft Visio-related file formats programmatically in your C# applications. Simply configure the API by downloading its DLL file from the Downloads page, or run the following NuGet installation command:

PM> Install-Package Aspose.Diagram

Protect Visio Diagram File from Changes in C#

Microsoft Visio files can contain confidential or copy-rights-protected data which you can protect by following the steps below:

  1. Load the source Visio diagram file using the Diagram class.
  2. Protect different contents like the background, styles, master shapes, etc.
  3. Export the protected diagram file.

The following sample code shows how to protect a Visio Diagram file in C#:

Unprotect Visio Diagram File in C#

You can unprotect a protected Visio diagram file with the following steps:

  1. Load the source Visio file.
  2. Unprotect the file using [DocumentSettings][5] class.
  3. Write the unprotected Visio file.

The code snippet below demonstrates how to unprotect a Visio Diagram in C#:

Conclusion

In this article, you have learned how to protect or unprotect a Visio Diagram file programmatically in C#. However, you may visit the documentation section to learn many other features of the API. In case of any concerns, please write to us at forum.

See Also