Hi Feris,
may be this is a more or less hacking approach, but I have tested
the valid format with a magic number comparison.
When I read a file that should be a MS Office document it should
have at least the filesystem structure that all MS documents have
(old once for shure).
So I compare the this pattern from the file beginning
/**
* Header des MS Compound Document Format á la magic number test
Documentation u.a. in
* http://sc.openoffice.org/compdocfileformat.pdf
*/
private static final String COMPOUND_DOC_HEADER_START =
"d0cf11e0a1b11ae100";
If this is in hex comparison the start I'll treat it as an office file.
hth,
Greetings from Cologne, Germany,
cu Stefan
Stefan Marx
Marx Consulting (extern)
REWE GROUP
Geschäftsbereich Konzern-Systeme
Funktionsbereich Business-Systeme
REWE-Informations-Systeme GmbH
Humboldtstraße 140-144 - 51149 Köln
Telefon: +49 (0)221 149 - 5953
Telefax: +49 (0)221 149 - 97 5953
E-Mail: [EMAIL PROTECTED]
www.rewe-group.com
> -----Ursprüngliche Nachricht-----
> Von: Feris Thia [SMTP:[EMAIL PROTECTED]
> Gesendet am: Samstag, 9. September 2006 11:01
> An: POI Users List
> Betreff: Validate Document
>
> Dear All,
>
> Can I use POI API to validate whether it is a valid Word, Excel,
> Powerpoint
> document ?? If I can, what API should I use ?
>
> Regards,
>
> Feris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/