How to know whether ppt is encrypted by using aspose.slides for .net


#1

Hello, everyone
how to know whether ppt is encrypted by using aspose.slides for .net.
I try to use presentation.ProtectionManager property, but it need to initial presentation object and need to input password. so i want to determine whether ppt is encrypted without inputing password.
Thanks


#2

@gaoxing,

I have observed your comments and like to inform that i have shared sample code with you. This will help you to achieve your requirements. Also please visit this thread link for more details.

{code}
IPresentationInfo info;

info = PresentationFactory.Instance.GetPresentationInfo(m_rootFolder + “\Password\open.ppt”);
Assert.AreEqual(info.LoadFormat, LoadFormat.Ppt);
Assert.IsFalse(info.IsEncrypted);

info = PresentationFactory.Instance.GetPresentationInfo(m_rootFolder + “\Password\pwd.ppt”);
Assert.AreEqual(info.LoadFormat, LoadFormat.Ppt);
Assert.IsTrue(info.IsEncrypted);

info = PresentationFactory.Instance.GetPresentationInfo(m_rootFolder + “\Password\open.pptx”);
Assert.AreEqual(info.LoadFormat, LoadFormat.Pptx);
Assert.IsFalse(info.IsEncrypted);

info = PresentationFactory.Instance.GetPresentationInfo(m_rootFolder + “\Password\pwd.pptx”);
Assert.AreEqual(info.LoadFormat, LoadFormat.Pptx);
Assert.IsTrue(info.IsEncrypted);

info = PresentationFactory.Instance.GetPresentationInfo(m_rootFolder + “\Password\open.odp”);
Assert.AreEqual(info.LoadFormat, LoadFormat.Odp);
Assert.IsFalse(info.IsEncrypted);

info = PresentationFactory.Instance.GetPresentationInfo(m_rootFolder + “\Password\pwd.odp”);
Assert.AreEqual(info.LoadFormat, LoadFormat.Odp);
Assert.IsFalse(info.IsEncrypted); // ODP verification hast not implemented yet.
{code}