Coincidentally I have just tried the NPOIFSFileSystem approach on DOCX files and it does work.
As for DOC files, I have come across only one real discussion on this, you and Sergey discussing it in a thread a year or so back. I'll go back to that and see if I can attract his attention. Tom -----Original Message----- From: Nick Burch [mailto:[email protected]] Sent: 13 September 2011 12:16 To: POI Users List Subject: RE: How to check whether an XLSX has a read password On Tue, 13 Sep 2011, Simmons, Tom (GE Oil & Gas, VG) wrote: > Now I need to look at Word (DOC/DOCX) files, sadly it never occurred > to me that POI would be less advanced in this field. Checking for a > password in Excel files has not been easy, in fact I owe everything to > Nick because there is no concise, complete reference that I have come > across. We do love new examples and enhancements to the documentation :) > It seems that there is even less for checking Word files, if anyone > has any info on this I would be very grateful. Sergey may know a trick, but my hunch is that your only option complete is to try opening the whole file with HWPF and see if it throws an encrypted document exception or not... That said, for some kinds of .doc files, you could try passing the main stream to FileInformationBlock, and see what the flags on that say. See: public HWPFDocumentCore(DirectoryNode directory) for how to do that, but I can't be sure if that'll cover all cases You should be able to generalise your XSSF code to apply to all OOXML files though, keeping that simpler Nick --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
