Hi Mathias, here's an example how to use the XTransferableSupplier. It took me some time and help to figure it out.
see also the thread http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=17346 if you have more questions. This code will copy the contentens of a source document to the target document. You can change the range of the copy operation by limiting the selection by playing around with the xTextViewCursor. XComponent xComponent_sourceDoc = xComponentLoader.loadComponentFromURL( url_odt_contents, "_blank", 0, myProperties); XComponent xComponent_targetDoc = xComponentLoader.loadComponentFromURL( url_template, "_blank", 0, myProperties); XTextDocument xTextDocument_sourceDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent_sourceDoc); XTextDocument xTextDocument_targetDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent_targetDoc); //the controllers XController xController_sourceDoc = xTextDocument_sourceDoc.getCurrentController(); XController xController_targetDoc = xTextDocument_targetDoc.getCurrentController(); //the cursor for the source document XTextViewCursorSupplier xViewCursorSupplier_sourceDoc = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController_sourceDoc); //selecting the whole source document XTextViewCursor xTextViewCursor_sourceDoc = xViewCursorSupplier_sourceDoc.getViewCursor(); xTextViewCursor_sourceDoc.gotoEnd(true); //getting the data supplier of our source doc XTransferableSupplier xTransferableSupplier_sourceDoc = (XTransferableSupplier) UnoRuntime.queryInterface( XTransferableSupplier.class, xController_sourceDoc ); //saving the selected contents XTransferable xTransferable = xTransferableSupplier_sourceDoc.getTransferable(); //getting the data supplier of our target doc XTransferableSupplier xTransferableSupplier_targetDoc = (XTransferableSupplier) UnoRuntime.queryInterface( XTransferableSupplier.class, xController_targetDoc ); //the cursor for the target document XTextViewCursorSupplier xViewCursorSupplier_targetDoc = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController_targetDoc); //going to the end of the source document XTextViewCursor xTextViewCursor_targetDoc = xViewCursorSupplier_targetDoc.getViewCursor(); xTextViewCursor_targetDoc.gotoEnd(false); //inserting the source document there xTransferableSupplier_targetDoc.insertTransferable(xTransferable); Matthias B.-2 wrote: > > On 3/15/07, Peter Eberlein <[EMAIL PROTECTED]> wrote: >> To avoid the dispatches and for more flexibility, you could try to use >> the XTransferableSupplier interface. Make your selection, call >> getDataTransfer and put it in your new subdocuments. > > Could you elaborate on this. What objects support > XTransferableSupplier? The "Use" page in the IDL docs is empty and the > Dev Guide doesn't even mention the interface. > > Matthias > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Sub-Document-Creation-Problem-%28Java%29-tf3407774.html#a9593059 Sent from the openoffice - sw dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
