Hi,

On Feb 1, 2008 4:22 PM, Litrik De Roy <[EMAIL PROTECTED]> wrote:
> I started working on the Eclipse plug-in that I have mentioned earlier
> but I ran into a problem with the AutoDetectParser.
>
> It does not seem to recognize any of the MS Office file formats. They
> all return "application/octet-stream" as content type, but no
> metadata. All other file formats work OK.
> [...]
> I there anything special that must be done to get POI to work?

We currently don't have any magic header matchers for Microsoft Office
file formats, so the only thing AutoDetectParser can use to detect the
file type is the file name suffix.

Do you have the file name available to your plugin? You can feed the
file name to AutoDetectParser like this:

    AutoDetectParser parser = new AutoDetectParser();
    InputStream stream = ...;
    ContentHandler handler = ...;
    Metadata metadata = new Metadata();
    metadata.set(Metadata.RESOURCE_NAME_KEY, ...);
    parser.parse(stream, handler, metadata);

BR,

Jukka Zitting

Reply via email to