Am Donnerstag, den 30.11.2006, 17:31 +0100 schrieb Tobias Krais:
> 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) {
>         }
> }
> -----%<-----

Thanks for 'snippetizing' it.

I fear this interface is available on Writer docs only. Okay, for Calc
or Draw there would be the need to split up in Sheets or Pages, but
nonetheless it would be nice to have ...

Marc


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

Reply via email to