Apache POI WP

HWPFDocument doc = new HWPFDocument(new FileInputStream(
		"data/document.doc"));
SummaryInformation summaryInfo = doc.getSummaryInformation();
System.out.println(summaryInfo.getApplicationName());
System.out.println(summaryInfo.getAuthor());
System.out.println(summaryInfo.getComments());
System.out.println(summaryInfo.getCharCount());
System.out.println(summaryInfo.getEditTime());
System.out.println(summaryInfo.getKeywords());
System.out.println(summaryInfo.getLastAuthor());
System.out.println(summaryInfo.getPageCount());
System.out.println(summaryInfo.getRevNumber());
System.out.println(summaryInfo.getSecurity());
System.out.println(summaryInfo.getSubject());
System.out.println(summaryInfo.getTemplate());

Aspose.Words

Document doc = new Document("data/document.doc");

System.out.println("============ Built-in Properties ============");
for (DocumentProperty prop : doc.getBuiltInDocumentProperties())
    System.out.println(MessageFormat.format("{0} : {1}", prop.getName(), prop.getValue()));

System.out.println("============ Custom Properties ============");
for (DocumentProperty prop : doc.getCustomDocumentProperties())
    System.out.println(MessageFormat.format("{0} : {1}", prop.getName(), prop.getValue()));

FileFormatInfo info = FileFormatUtil.detectFileFormat("data/document.doc");
System.out.println("The document format is: " + FileFormatUtil.loadFormatToExtension(info.getLoadFormat()));
System.out.println("Document is encrypted: " + info.isEncrypted());
System.out.println("Document has a digital signature: " + info.hasDigitalSignature());

Download Source Code

Last edited Mar 26, 2014 at 4:46 PM by shoaibkhan, version 1