But this is not what my application should do.ĭoes someone know how I can open the result of the mail merge directly in an new writer document without saving the result to the hard drive? When I change the OutputType to MailMergeType.FILE the result is generated in a given directory and I can open the file and see that the mail merge succeeded. I guess I have to pass the XTextDocument component to the url-argument of the loadComponentFromURL method but I didnt find the right way to do that. XTextCursor cursor = mergedText.getText().createTextCursor() ĬtString(mergedText.getText().getString()) XTextDocument mergedText = UnoRuntime.queryInterface(XTextDocument.class, mergedTextObject) Loader.loadComponentFromURL(url, "_blank", 0, new PropertyValue) Object mergedTextObject = job.execute(new NamedValue) So I've tried something like this XJob job = UnoRuntime.queryInterface(XJob.class, mailMergeService) The successful mail marge returns a XTextDocument based component." The mmOutputType is set as MailMergeType.SHELL tPropertyValue("SaveAsSingleFile", mmSaveAsSingleFile) tPropertyValue("FileNamePrefix", mmFileNamePrefix) tPropertyValue("OutputURL", templateDirectory) tPropertyValue("OutputType", mmOutputType) tPropertyValue("CommandType", mmCommandType) tPropertyValue("DataSourceName", dbName) tPropertyValue("DocumentURL", templatePath)
XPropertySet mmProperties = UnoRuntime.queryInterface(XPropertySet.class, mailMergeService) Object mailMergeService = mcf.createInstanceWithContext(mailMergePackage, context) I need help with opening the result of my mail merge operations directly in an new writer document.