| View previous topic :: View next topic |
| Author |
Message |
wumpfreak General User

Joined: 25 Sep 2003 Posts: 7
|
Posted: Fri Nov 21, 2003 8:29 am Post subject: Insert TextDocument in Java |
|
|
Hi all,
I'm trying to insert a sxw document in another one using uno and java. Unfortunately the insertDocumentFromURL method has no example in the DevGuide It is only said that the text cursor supports the com.sun.star.document.XDocumentInsertable interface. So I tried the following: (some calls like this.getXTextViewCursor() are self programmed methods)
| Code: |
try {
XTextViewCursor lXTextViewCursor = this.getXTextViewCursor();
XText lXText = lXTextViewCursor.getText();
XTextCursor lXTextCursor = lXText.createTextCursorByRange(lXTextViewCursor.getStart());
lXTextCursor.gotoEnd(false);
XDocumentInsertable lXDocInsertable = (XDocumentInsertable)UnoRuntime.queryInterface(XDocumentInsertable.class, lXTextCursor);
PropertyValue[] lLoadProperties = new PropertyValue[1];
lLoadProperties[0] = new PropertyValue();
lLoadProperties[0].Name = "Hidden";
lLoadProperties[0].Value = new Boolean(false);
lXDocInsertable.insertDocumentFromURL(lPathToDoc, lLoadProperties);
} catch (Exception ex) {
ex.printStackTrace();
}
|
This code produces an IllegalArgumentException at the call of insertDocumentFromURL.
Can anybody help?
Thanks!
Stephan |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Fri Nov 21, 2003 8:49 am Post subject: |
|
|
Hidden may not be a valid property to insertDocumentFromURL. It is valid to loadComponentFromURL, but may not be valid here.
There are only two parameters, the URL, and a set of PropertyValue's. Are you sure your URL is good, just to get that out of the way? What if you try passing an empty array of PropertyValue.
new PropertyValue[ 0 ] _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
wumpfreak General User

Joined: 25 Sep 2003 Posts: 7
|
Posted: Fri Nov 21, 2003 9:07 am Post subject: THANK YOU! |
|
|
Hello DannyB!
The "new PropertyValue[ 0 ]" trick did it!
Thank you!
Stephan |
|
| Back to top |
|
 |
|