We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback


Trusted by the world’s leading companies

Overview

Protect your sensitive information and control document access with ease. The Syncfusion .NET PowerPoint Library lets you programmatically encrypt and decrypt presentations in C# without relying on Microsoft PowerPoint or interop dependencies.


How to encrypt a PowerPoint presentation with a password in C#

  1. Install NuGet package: Install the Syncfusion.Presentation.Net.Core NuGet package in your project.
  2. Open presentation: Create a FileStream object to represent the input presentation.
  3. Load in .NET PowerPoint Library: Create an IPresentation object by passing the FileStream object.
  4. Encrypt with password: Call the Encrypt method of the IPresentation object by passing the password.
  5. Save presentation: Save the IPresentation object to the FileStream object.

Here is an example of how to encrypt a presentation in C# using the Syncfusion .NET PowerPoint Library.

//Open an existing presentation.
using FileStream inputStream = new FileStream("Template.pptx", FileMode.Open, FileAccess.Read);
using IPresentation presentation = Presentation.Open(inputStream);

//Encrypt the presentation with a password.
presentation.Encrypt("password");

//Save the presentation.
using FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create, FileAccess.ReadWrite);
presentation.Save(outputStream);

How to decrypt a protected PowerPoint presentation in C#

  1. Install NuGet package: Install the Syncfusion.Presentation.Net.Core NuGet package in your project.
  2. Open password-protected presentation: Create a FileStream object to represent the input presentation.
  3. Load in .NET PowerPoint Library: Create an IPresentation object by passing the FileStream object.
  4. Decrypt presentation: Call the RemoveEncryption * method of the *IPresentation object.
  5. Save presentation: Save the IPresentation object to the FileStream object.

Here is an example of how to decrypt a password-protected presentation in C# using the Syncfusion .NET PowerPoint Library.

//Open an existing presentation.
using FileStream inputStream = new FileStream("Template.pptx", FileMode.Open, FileAccess.Read);
using IPresentation presentation = Presentation.Open(inputStream, "password");

//Decrypt the presentation.
presentation.RemoveEncryption();

//Save the presentation.
using FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create, FileAccess.ReadWrite);
presentation.Save(outputStream);

Protect options

Restrict editing

Protect a PowerPoint presentation with a password to restrict unauthorized editing.

Here is an example of how to restrict editing for presentations in C# using the Syncfusion .NET PowerPoint Library.

//Open an existing presentation.
using FileStream inputStream = new FileStream("Template.pptx", FileMode.Open, FileAccess.Read);
using IPresentation presentation = Presentation.Open(inputStream);

//Protect the presentation with a password from unauthorized editing.
presentation.SetWriteProtection("password");

//Save the presentation.
using FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create, FileAccess.ReadWrite);
presentation.Save(outputStream);

Mark as final

Make the PowerPoint presentation read-only to prevent readers from making inadvertent changes.

Here is an example of how to mark a presentation as final in C# using the Syncfusion .NET PowerPoint Library.

//Open an existing presentation.
using FileStream inputStream = new FileStream("Template.pptx", FileMode.Open, FileAccess.Read);
using IPresentation presentation = Presentation.Open(inputStream);

//Mark the presentation as final.
presentation.Final = true;

//Saves the presentation.
using FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create, FileAccess.ReadWrite);
presentation.Save(outputStream);


Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Scroll up icon