You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Rajkumar Balakrishnasamy <aw...@gmail.com> on 2014/02/17 10:59:50 UTC

Regarding checking the document version/type

Hi All,

How can we check whether given type document is MS office Excel 95 or 97.Is
there any tools are available? or how to check given doc version in MS
Office or OpenOffice.


Thanks & Regards,
Rajkumar B

Re: Regarding checking the document version/type

Posted by Nick Burch <ap...@gagravarr.org>.
On Mon, 17 Feb 2014, Rajkumar Balakrishnasamy wrote:
> How can we check whether given type document is MS office Excel 95 or 
> 97.Is there any tools are available? or how to check given doc version 
> in MS Office or OpenOffice.

It's a little hacky, but you could just try to open it with HSSFWorkbook. 
If it opens, it's 97. If it gives an OldFileFormatException it's 95 (or 
older). If it gives OfficeXmlFileException it's an OOXML file

If you want something standalone, look at the code which throws those 
exceptions, and implement similar logic

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org