You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Peter Brouwer <pe...@cs.com> on 2005/07/26 14:51:43 UTC
possible to extract/find refence to image data in word files
Hi there,
I am trying now for a few days to extract an image out of a word document. I haven't succeeded sofar. I am afraid now that POI is not able to do this.
Has anybody succeeded in or know if it is possible to extract image data out of ms word documents using POI.
Thanks in advance,
Peter
Re: possible to extract/find refence to image data in word files
Posted by Peter Brouwer <pe...@cs.com>.
Srinivas,
Thanks for your info.
I found now that my previous information was not completely correct. In
version 2.5.1 the FIBAbstractType is complete.
I am on the same path as you, this is what I have right now. I am still
struggling because I get an array index out of bounds exception. This
exception is thrown because
the _fib.getLcbDggInfo() gives me a wrong length of the office art object
table data, or I interpret the data wrong. I get now atleast an EscherRecord
which points me more or less to the correct place where the, in my case
jpeg, data is stored. Only in front of the data are 25 bytes which I do not
know yet what they are used for.
Another thing is that I found that in my case the file has a 0Table and
1Table stream. The _fib.isFWhichTblStm() should say which table to use. I
wonder now if because in my case it seems to be a complex file I should
still use the 1Table (is bigger and might not give an arrayindexoutofbounds
exception).
POIFSFileSystem filesystem = new POIFSFileSystem(istream);
// read in the main stream.
DocumentEntry documentProps = (DocumentEntry)
filesystem.getRoot().getEntry("WordDocument");
byte[] _mainStream = new byte[documentProps.getSize()];
filesystem.createDocumentInputStream("WordDocument").read(_mainStream);
// use the fib to determine the name of the table stream.
org.apache.poi.hdf.model.hdftypes.FileInformationBlock _fib = new
org.apache.poi.hdf.model.hdftypes.FileInformationBlock(_mainStream);
System.out.println("has image:" + _fib.isFHasPic()); //always seems
to be false, something to do with complex file?
String name = "0Table";
System.out.println("use table1: "+_fib.isFWhichTblStm());
if (_fib.isFWhichTblStm()) {
name = "1Table";
}
// read in the table stream.
DocumentEntry tableProps = (DocumentEntry)
filesystem.getRoot().getEntry(name);
byte[] _tableStream = new byte[tableProps.getSize()];
filesystem.createDocumentInputStream(name).read(_tableStream);
DefaultEscherRecordFactory factory = new
DefaultEscherRecordFactory();
int pos = _fib.getFcDggInfo();
while (pos < (_fib.getFcDggInfo() + _fib.getLcbDggInfo())) {
try {
org.apache.poi.ddf.EscherRecord r =
factory.createRecord(_tableStream, pos);
int bytesRead = r.fillFields(_tableStream, pos,
factory);
System.out.println("bytes read" + bytesRead);
System.out.println(r.toString());
pos += bytesRead;
} catch (Exception e) {
e.printStackTrace();
pos = _fib.getFcDggInfo() + _fib.getLcbDggInfo();
}
}
----- Original Message -----
From: "Srinivas" <sr...@yahoo.com>
To: "POI Users List" <po...@jakarta.apache.org>
Sent: Friday, July 29, 2005 9:48 AM
Subject: Re: possible to extract/find refence to image data in word files
> HI Peter,
>
> i am also trying the code to solve this problem.....
> i found some link to see
> http://jakarta.apache.org/poi/apidocs/org/apache/poi/ddf/EscherBlipWMFRecord.html
> may it is useful to us....
>
> thanks
> srinivas
>
> Peter Brouwer <pe...@cs.com> wrote:
> Hi Srinivas,
>
> I am going through the source now and it looks like POI doesn't support
> image extraction right now. If I look at the FIBAbstractType class
> (extended
> by FileInformationBlock) I see that a lot of tags are missing. I am trying
> now to add some of them and get the image stuff working. Would be great if
> you tried to get the stuff working too, sofar I haven't succeeded.
>
> Peter
>
>
>
>
>
>
> ----- Original Message -----
> From: "Srinivas"
> To: "POI Users List"
>
> Sent: Wednesday, July 27, 2005 8:10 AM
> Subject: Re: possible to extract/find refence to image data in word files
>
>
>> HI Friends,
>>
>> I am also following this track...please suggest us...what are the ways to
>> extract the images from the word document...?????
>>
>>
>> Thanks
>> Srinivas
>>
>> Peter Brouwer
> wrote:
>> Hi there,
>>
>> I am trying now for a few days to extract an image out of a word
>> document.
>> I haven't succeeded sofar. I am afraid now that POI is not able to do
>> this.
>>
>> Has anybody succeeded in or know if it is possible to extract image data
>> out of ms word documents using POI.
>>
>> Thanks in advance,
>> Peter
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
>
>
>
> ---------------------------------
> Start your day with Yahoo! - make it your home page
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: possible to extract/find refence to image data in word files
Posted by Srinivas <sr...@yahoo.com>.
HI Peter,
i am also trying the code to solve this problem.....
i found some link to see
http://jakarta.apache.org/poi/apidocs/org/apache/poi/ddf/EscherBlipWMFRecord.html
may it is useful to us....
thanks
srinivas
Peter Brouwer <pe...@cs.com> wrote:
Hi Srinivas,
I am going through the source now and it looks like POI doesn't support
image extraction right now. If I look at the FIBAbstractType class (extended
by FileInformationBlock) I see that a lot of tags are missing. I am trying
now to add some of them and get the image stuff working. Would be great if
you tried to get the stuff working too, sofar I haven't succeeded.
Peter
----- Original Message -----
From: "Srinivas"
To: "POI Users List"
Sent: Wednesday, July 27, 2005 8:10 AM
Subject: Re: possible to extract/find refence to image data in word files
> HI Friends,
>
> I am also following this track...please suggest us...what are the ways to
> extract the images from the word document...?????
>
>
> Thanks
> Srinivas
>
> Peter Brouwer
wrote:
> Hi there,
>
> I am trying now for a few days to extract an image out of a word document.
> I haven't succeeded sofar. I am afraid now that POI is not able to do
> this.
>
> Has anybody succeeded in or know if it is possible to extract image data
> out of ms word documents using POI.
>
> Thanks in advance,
> Peter
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
---------------------------------
Start your day with Yahoo! - make it your home page
Re: possible to extract/find refence to image data in word files
Posted by Peter Brouwer <pe...@cs.com>.
Hi Srinivas,
I am going through the source now and it looks like POI doesn't support
image extraction right now. If I look at the FIBAbstractType class (extended
by FileInformationBlock) I see that a lot of tags are missing. I am trying
now to add some of them and get the image stuff working. Would be great if
you tried to get the stuff working too, sofar I haven't succeeded.
Peter
----- Original Message -----
From: "Srinivas" <sr...@yahoo.com>
To: "POI Users List" <po...@jakarta.apache.org>
Sent: Wednesday, July 27, 2005 8:10 AM
Subject: Re: possible to extract/find refence to image data in word files
> HI Friends,
>
> I am also following this track...please suggest us...what are the ways to
> extract the images from the word document...?????
>
>
> Thanks
> Srinivas
>
> Peter Brouwer <pe...@cs.com> wrote:
> Hi there,
>
> I am trying now for a few days to extract an image out of a word document.
> I haven't succeeded sofar. I am afraid now that POI is not able to do
> this.
>
> Has anybody succeeded in or know if it is possible to extract image data
> out of ms word documents using POI.
>
> Thanks in advance,
> Peter
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: possible to extract/find refence to image data in word files
Posted by Srinivas <sr...@yahoo.com>.
HI Friends,
I am also following this track...please suggest us...what are the ways to extract the images from the word document...?????
Thanks
Srinivas
Peter Brouwer <pe...@cs.com> wrote:
Hi there,
I am trying now for a few days to extract an image out of a word document. I haven't succeeded sofar. I am afraid now that POI is not able to do this.
Has anybody succeeded in or know if it is possible to extract image data out of ms word documents using POI.
Thanks in advance,
Peter
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com