Everytime we try to open a password-protected PowerPoint file, we will then be prompted to enter the password. This can be really a bothering thing itself. But things get worse if we forget the password. To avoid this situation from being occurred, we can choose to remove the encryption if the PowerPoint file is not necessarily protected. In this article, I’ll introduce you how to remove encryption on password-protected PowerPoint file using Spire.Presentation.
In the classes of Spire.Presentation, you can invoke Presentation.LoadFromFile(string file, string password) method to load the file that you want to remove protection, then you're entitled to remove encryption by calling Presentation.RemoveEncryption() method. More details:
Step 1: Create Presentation instance and load file.
Presentation presentation = new Presentation(); presentation.LoadFromFile("Presentation1.pptx", "test");
Step 2: Remove encryption.
presentation.RemoveEncryption();
Step 3: Save and launch the file.
presentation.SaveToFile("result.pptx", FileFormat.Pptx2010); System.Diagnostics.Process.Start("result.pptx");
Effect Screenshot:
Full Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Spire.Presentation; namespace RemoveProtect { class Program { static void Main(string[] args) { // create Presentation instance and load file Presentation presentation = new Presentation(); presentation.LoadFromFile("Presentation1.pptx", "test"); //remove encryption presentation.RemoveEncryption(); //save the file presentation.SaveToFile("result.pptx", FileFormat.Pptx2010); System.Diagnostics.Process.Start("result.pptx"); } } }
Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Text Imports Spire.Presentation Namespace RemoveProtect Class Program Shared Sub Main(ByVal args() As String) ' create Presentation instance and load file Dim presentation As Presentation = New Presentation() presentation.LoadFromFile("Presentation1.pptx", "test") 'remove encryption presentation.RemoveEncryption() 'save the file presentation.SaveToFile("result.pptx", FileFormat.Pptx2010) System.Diagnostics.Process.Start("result.pptx") End Sub End Class End Namespace