I got everything to work, except for images and horizontal line objects. Images are completely ignored and not imported into the document, whereas horizontal line objects are flushing themselves at the top of the current page.
I do have a question about the section I am using. If you look at the following code, am I properly inserting the second document (document2) into the newly created section? Here is my routine: public void appendDocument(XTextDocument document1, XTextDocument document2) throws IllegalArgumentException, java.lang.Exception { XText xDocText = document1.getText(); XTextCursor xOrigDocTextCursor = xDocText.createTextCursor(); XNamed xChildNamed; XTextContent xChildContent; String tempDoc = generateTempDocucmentPathName(); xOrigDocTextCursor.gotoEnd(false); xDocText.insertControlCharacter(xOrigDocTextCursor, ControlCharacter.PARAGRAPH_BREAK, false); xChildNamed = (XNamed) UnoRuntime.queryInterface( XNamed.class, serviceFactory.createInstance("com.sun.star.text.TextSection", document1)); xChildNamed.setName("" + document2.hashCode()); xChildContent = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, xChildNamed); /* Add document2 to the new section */ xDocText.insertTextContent(xOrigDocTextCursor, xChildContent, false); PropertyValue[] storeProps = createPropertyValueArray( createPropertyValue("FilterName", new Any(Type.STRING, "writer8_template")), createPropertyValue("CompressionMode", new Any(Type.STRING, "1")), createPropertyValue("Pages", new Any(Type.STRING, "All")), createPropertyValue("Overwrite", new Any(Type.BOOLEAN, Boolean.TRUE))); componentExport(document2, storeProps, tempDoc); XDocumentInsertable xDocI = (XDocumentInsertable) UnoRuntime.queryInterface( XDocumentInsertable.class, xOrigDocTextCursor); PropertyValue[] loadProps=new PropertyValue[0]; xDocI.insertDocumentFromURL("file:///" + tempDoc, loadProps); deleteFile(tempDoc); } On Wed, Mar 4, 2009 at 10:38 AM, Peter Eberlein < pet....@refofd.verwalt-berlin.de> wrote: > Grover Blue schrieb: > >> I found examples of inserting via a file, but I'm confused on how I would >> go >> from a XTextDocument to an input stream. I guess I'd need to use an >> XInputStream object (assuming that is the interface I want to use when >> passing the "InputStream" property to XDocumentInsertable), but it's not >> clear on how to obtain that from XTextDocument. You wouldn't happen to >> have >> an example? >> >> Sorry, no. > If you have a XTextDocument, I guess you have a URL where it is stored. If > not (created from a template and modified) you can store it to a temp-folder > or to a stream which you can reuse, for example > http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=3801&start=0&st=0&sk=t&sd=a > > Peter > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@openoffice.org > For additional commands, e-mail: dev-h...@openoffice.org > > -- “If the American people ever allow private banks to control the issue of their currency, first by inflation, then by deflation, the banks...will deprive the people of all property until their children wake-up homeless on the continent their fathers conquered... The issuing power should be taken from the banks and restored to the people, to whom it properly belongs." -- Thomas Jefferson "Government big enough to supply everything...is big enough to take everything you have. The course of history shows that as a government grows, liberty decreases" --- Thomas Jefferson www.CampaignForLiberty.org