Add image with jOpenDocument in odt document (writer)

I am trying the jOpenDocument API and I want to add / insert an image. Can I do it using this API? I am interested in jOpenDocument because it allows me to create a template and then process the document using Java (which I don't think is possible with ODFDOM from Apache).

The only thing I found is that I can do something like this:

final File outFile = new File("output.odt"); 
final String bcfile = "image.png"final JavaScriptFileTemplate template = new JavaScriptFileTemplate("template.odt"); 
final ODSingleXMLDocument ddoc = template.createDocument(); 
ddoc.getDescendantByName("draw:frame","pC_LSBarcode").setAttribute("href", "file:///" + bcfile,Namespace.getNamespace("xlink", "http://www.w3.org/1999/xlink"));  
ddoc.saveAs(outFile);  

      

As you can see, this is only href

and as a result my odt file will not be portable as it depends on the image path.

Are there any built-in methods in the jOpenDocument API so I can insert images into my odt file?

+3
java api documentation-generation odt jopendocument


source to share


No one has answered this question yet

Check out similar questions:

1011
How do I add local jar files to a Maven project?
192
Does Swift have docs or documentation tools?
58
PHP template library PDF with PDF output?
2
How to extract images from an odd document using the Odf Toolkit?
1
How to insert at runtime into an odt document using jodreports and java
0
create a new document from a template
0
LIbreOffice UNO: how to duplicate / clone an image element already in a document and add it to a new page?
0
Images inside document .odt: knowing where it is and copying it to another document
0
New line in field with jOpenDocument in ODT document



All Articles
Loading...
X
Show
Funny
Dev
Pics