Hi Cristian,

> TextCursor.getText().insertString(TextCursor,"-------------------------
> ----------------------------",false);

After this statement, "---..." will be inserted right behind the newly
inserted document.  Then, in the next loop:

> TextCursor=xText.createTextCursor();

You create a cursor at the BEGINNING of your document.

> xd=(XDocumentInsertable) 
>       UnoRuntime.queryInterface(XDocumentInsertable.class,TextCursor);
> xd.insertDocumentFromURL(docs[i],loadProps);

And how you insert the document BEFORE your previous document.

You should not only get the "----..." at the end, but also your documents
reversed.  Right?

You don't need a new cursor at all. This should work (not tested though):

// create a text cursor at the beginning of the document
TextCursor=xText.createTextCursor();

// query the XDocumentInsertable interface for the cursor
xd = (XDocumentInsertable) UnoRuntime.queryInterface(
        XDocumentInsertable.class, TextCursor);

// iterate the array of URLs
for (int i=0;i<docs.length;i++) 
{
        // insert one document
        xd.insertDocumentFromURL(docs[i],loadProps);

        // set the cursor to the end of the document
        TextCursor.gotoEnd(false);

        // insert a separator
        TextCursor.getText().insertString( TextCursor,
                "-----------------------------",false);

        // set the cursor to the end of the document, again
        TextCursor.gotoEnd(false);
}

For the second usage of gotoEnd(), also collapseToEnd() should work.  See
reference manual for more information.

And better do not use view cursors for model based functionality, as Marc
suggested.

        Michael


-- 
Michael Hoennig <[EMAIL PROTECTED]>
project lead OpenOffice.org API
http://api.openoffice.org

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

Reply via email to