Encrypt PowerPoint file

Spire.Presentation enables you to manipulate PPT files easily and flexibly. Using Spire.Presentation, you can create and edit PPT files. And sometimes developers need ways to protect their PPT files. Spire.Presentation provides you safety in PPT files. Users have to enter the password to open the PPT file if it is encrypted using Spire.Presentation. And it is very easy to fulfill this function using Spire.Presentation. Here is how to do so.

Step 1: Create a PPT document.

Presentation presentation = new Presentation();

Step 2: Load PPT file.

presentation.LoadFromFile("sample.pptx");

Step 3: Encrypt the PPT file.

presentation.Encrypt("test");

Step 4: Save the PPT file.

presentation.SaveToFile("encrypt.pptx", FileFormat.Pptx2007);

Download and install Spire.Presentation for .NET and use below code to experience this method to encrypt PPT document.

Screenshot:

Encrypt PPT file

Full Code:

[C#]
//create PPT document
Presentation presentation = new Presentation();

//load PPT file from disk
presentation.LoadFromFile("sample.pptx");

//encrypy the document with password "test"
presentation.Encrypt("test");

//save the document
presentation.SaveToFile("encrypt.pptx", FileFormat.Pptx2007);
System.Diagnostics.Process.Start("encrypt.pptx");
[VB.NET]
'create PPT document
Dim presentation As New Presentation()

'load PPT file from disk
presentation.LoadFromFile("sample.pptx")

'encrypy the document with password "test"
presentation.Encrypt("test")

'save the document
presentation.SaveToFile("encrypt.pptx", FileFormat.Pptx2007)
System.Diagnostics.Process.Start("encrypt.pptx")