You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Laurent <la...@francetelecom.com> on 2005/06/09 11:18:57 UTC

Corrupted Office format by POI when embedded objects in Office file ???

Hello,

I have a problem of data corruption if the Office file I want to modify contains
an embedded object:

once I saved it (even unmodified !!!) using the
POIFSFileSystem.writeFilesystem(modifiedStream) method, POI is non longer able
to reopen it without sending an error:

java.io.IOException: block[ 0 ] already removed
at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:96)
at org.apache.poi.poifs.storage.BlockAllocationTableReader
.fetchBlocks(BlockAllocationTableReader.java:190)
at org.apache.poi.poifs.storage.BlockListImpl
.fetchBlocks(BlockListImpl.java:128)
at org.apache.poi.poifs.filesystem.POIFSFileSystem
.processProperties(POIFSFileSystem.java:403)
at org.apache.poi.poifs.filesystem
.POIFSFileSystem.<init>(POIFSFileSystem.java:102)


I don't have this problem if there is no embedded object in the Office file.

Here is my (short) java code:

//Retrieving the stream from the office file into POI...
fs = new POIFSFileSystem(sourceStream);
ByteArrayOutputStream modifiedStream = new ByteArrayOutputStream();
//Retrieving (unmodified) stream from POI...now content is corrupted !
fs.writeFilesystem(modifiedStream);
modifiedStream.flush();
modifiedStream.close();

I seriously wonder if POI is able to correctly manage this kind of files ???



---------------------------------------------------------------------
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/