On Wed, 21 Dec 2011, Antoni Mylka wrote:
Entry e = root.getEntry("\u0001CompObj");
DocumentNode dn = (DocumentNode)e;
Object o = dn.getViewableIterator().next();
DocumentProperty dp = (DocumentProperty)o;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
dp.writeData(baos);
return baos.toByteArray();
Ah, I don't think you want the entry properties, you actually want the
entry contents.
What am I doing wrong? How to get the content of Document:
"\u0001CompObj" inside my app.
You want a DocumentInputStream. See "Reading a Document From an Arbitrary
Directory" of the POIFS How-To: http://poi.apache.org/poifs/how-to.html
It'll be something like
Entry e = root.getEntry("\u0001CompObj");
if (e.isDocumentEntry()) {
DocumentNode document = (DocumentNode)e;
DocumentInputStream stream = new DocumentInputStream(document);
byte[] data = IOUtils.toByteArray(stream);
} else {
logger.warn("CompObj was a directory, skipping");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]