hi Team,
Is there a way to determine if a Microsoft Office file (Word, Powerpoint & Excel,Viso) and PDF is Password Protected OrEncrpted before opening the file ?
Thanks
hi Team,
Is there a way to determine if a Microsoft Office file (Word, Powerpoint & Excel,Viso) and PDF is Password Protected OrEncrpted before opening the file ?
Thanks
1). You can use relevant method in Aspose.Words API to detect MS Word documents. See FileFormatInfo.IsEncrypted.:
Aspose.Words.FileFormatInfo info = Aspose.Words.FileFormatUtil.DetectFileFormat(@"C:\Temp\in.docx");
Console.WriteLine(info.IsEncrypted);
2). You can use Aspose.Cells to detect if the an Excel workbook/file is password protected or not without loading it. You can use FileFormatInfo.IsEncrypted property to detect if the file is encrypted or not.
Please see the following documentation article that illustrates how to detect the format of the file and check if the file is encrypted or not.
How to Detect a File Format and Check if the File is Encrypted
FileFormatInfo fileFormatInfo = FileFormatUtil.DetectFileFormat(dir + "Book1.xlsx");
Console.WriteLine(fileFormatInfo.IsEncrypted);
3). You can use Aspose.Slides and utilize PresentationFactory class to instance the PresentationInfo
object and check if a presentation is password protected. The following code example shows you how to do this:
var presentationInfo = PresentationFactory.Instance.GetPresentationInfo("presentation.pptx");
Console.WriteLine("The presentation is password protected: " + presentationInfo.IsPasswordProtected);
Reference Document: Examine Presentation.
Thanks we will check for same
@hemalp ,
You are welcome. If you have any further queries or comments, please feel free to write back to us.