Read "Optimized for" Office version

Hi everyone,

how can I acces the “optimized for (word version)” info?

I know that i can set this info with doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2003); but I want to read it from a document.

Thank you!

@urdasdaniel

You can use BuiltInDocumentProperties.Version property to achieve your requirement. This property represents the version number of the application that created the document. Following are the version numbers for MS Word.

11.0000 = Word 2003
12.0000 = Word 2007
14.0000 = Word 2010
15.0000 = Word 2013
16.0000 = Word 2016

You can get this value as shown below.

Document srcDoc = new Document(MyDir + "in.docx");
System.out.println(srcDoc.getBuiltInDocumentProperties().getVersion() >> 16);