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]