I'm trying to create an openoffice writer document from a template. I can replace text parts of report with this code
private static void searchAndReplace(final String search,
final String replace, final XTextDocument mxDoc) {
XReplaceable xReplaceable = (XReplaceable) UnoRuntime.queryInterface(
XReplaceable.class, mxDoc);
XReplaceDescriptor xRepDesc = xReplaceable.createReplaceDescriptor();
xRepDesc.setSearchString(search);
xRepDesc.setReplaceString(replace);
xReplaceable.replaceAll(xRepDesc);
}
I found some sample code from here to link or embed an image into an xTextDocument. But, I can't insert into an xTextDocument. Is there any other way to do this with Java? Openoffice version is 3.1.0.
Any answer?
I found this here: https://svn.apache.org/repos/asf/openoffice/ooo-site/trunk/content/api/Examples/Snippets/Writer/Writer.EmbedAGraphicIntoATextdocument.snip