Hi Marc,

> If you only want to insert the complete second doc at a given location
> (not "mixing in"), you can use
> 
> ::com::sun::star::uno::XDocumentInsertable
> 
> for this task.
> 
> Get a text cursor at the target doc, position the cursor and call
> 
> insertDocumentFromURL()
> 
> on it. According to the dev guide you only need to pass an url and an
> empty prop set.

This was a very good hint! Thank you. Here is a sample code:
-----%<-----
/**
 * Inserts a document a the cursors point.
 * @param unoDocumentURL File name that is UNO URL conform
 * [EMAIL PROTECTED] de.twc.oocom.oo.OODocument#createUNOFileURL(String)}
 */
public void insertDocument(String unoDocumentURL) {
        XText xText = this.xTextDocument.getText();

        // create a text cursor from the cells XText interface
        XTextCursor xTextCursor = xText.createTextCursor();
        XDocumentInsertable xDocInsert = (XDocumentInsertable)
                UnoRuntime.queryInterface(XDocumentInsertable.class,
                        xTextCursor);
        try {
                xDocInsert.insertDocumentFromURL(unoDocumentURL, null);
        }
        catch (Exception e) {
        }
}
-----%<-----

Greetings, Tobias

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to