Hi all,
if I try to replace an image by an ImageSelection, the image handle
isn't released after writing the data into ODF.

Short example:

// get selection
ImageSelection sel = new ImageSelection(getTextSelection(
paragraphElement));

// replace image from URI
Image img = sel.replaceWithImage(uri);

Node parentNode = getNode().getParentNode();
parentNode.insertBefore(img.getFrame().getDrawFrameElement(), getNode());

Now, the image could not be deleted by another process. I think, the
reason is in method
org.odftoolkit.simple.draw.Image#configureInsertedImage. The InputStream
isn't closed explicitly. I couldn't examine my solution because I can't
get run the current ODF toolkit (I'm using version 0.8.2). If I use
0.9.0 my application fails with Wstax exception (parser isn't found
because I'm using the library inside an OSGi bundle).

Btw, I've created a solution for replacing placeholders in an ODF
document (including tables and - of cours - images). But I don't know
how to contribute this solution into the actual release.

Would be glad if you could help me.

TIA,
Ralf.

Reply via email to