incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitrios Kateros <>
Subject Re: adding in memory image to document table cell
Date Tue, 11 Dec 2012 12:56:24 GMT
OK, made some progress. The following snippet will add the image to the
document package, but I still cannot add it to the Table using the
org.odftoolkit.simple.table.Cell#setImage(URI uri) method (it still ends up
looking to the filesystem).

byte[] img; //assume this is the image.

TextDocument odt = TextDocument.newTextDocument();
OdfPackage pkg = odt.getPackage();
pkg.insert(new ByteArrayInputStream(img), "Pictures/test.jpg",

It looks that I have to manipulate the XML to look like this:

<table:table-cell table:style-name="a860a14">
        <draw:frame svg:height="0.672cm" svg:width="3.444cm"
            <draw:image xlink:href="Pictures/test.jpg"

Is the advanced API my only bet right now?

Thx again // Dimitris

PS: I obviously do not have enough experience with the library (just today
tbh), but, if there is no other way to do it with the simple API, would it
be too far-fetched for the implementation to handle it correctly if the
relative odf package path is used as the URI input?

On Tue, Dec 11, 2012 at 12:54 PM, Dimitrios Kateros <>wrote:

> Greetings,
> I have an in memory image that I wish to add to a specific table cell of a
> document.
> As far as I can tell, the OdfToolkit API only allows this if the user
> provides a instance.
> Is there anyway to circumvent this using either the simple or the dom api?
> I would prefer not to write the image to disk (or anything similar) in
> order to provide a URI.
> Thank you in advance,
> Dimitris

Dimitrios Kateros

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message