Hello,
I'm developping a java application, and I extended it (or at least tried
to extend it) so that it can interpolate with openoffice.
I can now insert text, image, diagrams and links inside openoffice, all
that from my external java-programm. Thats really nice:)
The strange thing is that it does that only on the Writer-frame that I
opened first.
I would like to also be able to insert things in a new opened docuemnt.
And I would like to allow the user to edit several document with
OpenOffice.org, and only operate (i.e. : insert Tex, images, diagramms
or links) on the the frame, that is currently on top.
so... What I am doing wrong ? Why can I only use the first opened frame
? (i.e.: How to get the frame that is currently "in use"?)
I pasted the code in the Email. Thanks a lot for the answer in advance.
Regards
Daniel
______Code__________
//here is the code I used to open the first new writer frame :
..
try {
xComponent =
xCompLoader.loadComponentFromURL("private:factory/swriter",
"_blank", 0, new com.sun.star.beans.PropertyValue[0]);
xTextDocument = (XTextDocument) UnoRuntime.queryInterface(
XTextDocument.class, xComponent);
} catch (com.sun.star.uno.Exception e) {
System.out.println("uno Error!");
e.printStackTrace();
}
//here is the code I use to insert text :
void insertTest(String word){
xTextDocument = (XTextDocument)
UnoRuntime.queryInterface(XTextDocument.class, xComponent);
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class,
xComponent);
// the controller gives us the TextViewCursor
XController xController = xModel.getCurrentController();
XTextViewCursorSupplier xViewCursorSupplier =
(XTextViewCursorSupplier) UnoRuntime.queryInterface(
XTextViewCursorSupplier.class, xController);
// create a model cursor from the viewcursor
XTextViewCursor xViewCursor = xViewCursorSupplier.getViewCursor();
XText xDocumentText = xViewCursor.getText();
XTextCursor xModelCursor = xDocumentText.createTextCursorByRange(
xViewCursor.getStart());
xModelCursor.setString(word);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]