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 – C# API Installation
- Protect Visio Diagram File from Changes Programmatically in C#
- Unprotect Visio Diagram File in C#
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:
- Load the source Visio diagram file using the Diagram class.
- Protect different contents like the background, styles, master shapes, etc.
- 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:
- Load the source Visio file.
- Unprotect the file using [DocumentSettings] class.
- Write the unprotected Visio file.
The code snippet below demonstrates how to unprotect a Visio Diagram in C#:
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.