Spencer schrieb:
Hello,
Iam greatful for any help. Ill explain the problem I have:
- Iam using different supplier interfaces to get images, tables, etc
which are in a given document, like described here:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Navigating
Because all text contents like a XTextTable implements the interface
com.sun.star.text.XTextContent i can use the getAnchor() method to get
its position in the document as a XTextRange.
- My aim is to compare the positions of all text contents in the
document (like images with tables or tables with other tables, etc) with
the given XTextRange of each element.
Normally a XTextRangeCompare class would help out here. Iam able to
create it correctly, but iam not able to use it because on any try i get
an exception :(
- This is the code:
XTextTable table1; // got them by using a XTextTablesSupplier
XTextTable table2;
XTextDocument xTextDoc = (XTextDocument) UnoRuntime.queryInterface(
XTextDocument.class, xFrame.getController().getModel());
XTextRange myRange1 = table1.getAnchor();
XTextRange myRange2 = table2.getAnchor();
XTextRangeCompare xTextRangeCompare = (XTextRangeCompare) UnoRuntime.
queryInterface(XTextRangeCompare.class, xTextDoc.getText());
try
{
k = xTextRangeCompare.compareRegionStarts(myRange1, myRange2);
}
catch(IllegalArgumentException ex)
{
System.out.println("Error.");
}
- Problem:
xTextRangeCompare.compareRegionStarts(myRange1, myRange2)
throws exception of this kind:
>Exception occurred in target VM:
com.sun.star.lang.IllegalArgumentException:
at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method)
at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:178)
at $Proxy35.compareRegionStarts(Unknown Source)
at
ast.structure.ElementController.checkTextTable(ElementController.java:939)
at ast.structure.ElementController.analyze(ElementController.java:980)
at ast.BesserWissA.dispatch(BesserWissA.java:408)
<
- Any ideas what goes wrong?
Thanks.
Ali Ayhan
http://www.oooforum.org/forum/viewtopic.phtml?t=60451
Heres a workaround described. Give me an idea to work around the problem
although I need it in Java.
Ive go in debug mode of the process (look last post for my code) and
looked inside of the XTextRange object which is given back by
xTable.getAnchor(). Ive seen that most members are set to null.
So is it possible that getAnchor() doesnt work properly and gives a
corrupt structure back?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]