I want to get selected Strings in a Writer Document. So I tried the following Java-Code, but it causes a runtime exception in openoffice.org. I don't know, whats wrong.
Code: Select all
XIndexAccess acc = UnoRuntime.queryInterface(XIndexAccess.class, xModel.getCurrentSelection());
XTextRange range = UnoRuntime.queryInterface(XTextRange.class, acc.getByIndex(0));
String selectedText = range.getString();
What I have to do, to get selected Text?
Appreciate for any kind of help