HI James,
Hi all, I have being trying to implement the code below (from developers guide p.548) and I constantly run into problems, could anyone suggest a solution or point me in the right direction to fixing the problem?The exception I get varies but is always one of the following: 1. java.lang.NullPointerException 2. com.sun.star.lang.IllegalArgumentException: second parameter invalid XTextDocument td =(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,xDesktop.getCurrentComponent());XTextCursor tc = td.getText().createTextCursor(); Object bookmark = oobean.getMultiServiceFactory().createInstance ( "com.sun.star.text.Bookmark" ); XNamed xNamed = (XNamed) UnoRuntime.queryInterface ( XNamed.class, bookmark ); xNamed.setName("MyUniqueBookmarkName"); XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface (XTextContent.class, bookmark ); td.getText().insertTextContent ( td.getText().getEnd(), xTextContent, false ); The exception occurs on the line: td.getText().insertTextContent ( td.getText().getEnd(), xTextContent, false ); Thanks in advance for your help,
css.text.Bookmark has to be created at the MultiServiceFactory that you can query from your TextDocument ... then all should work just fine.
Hope that helps Regards Stephan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
