1 // Hello World in BeanShell
2 import com.sun.star.uno.UnoRuntime;
3 import com.sun.star.text.XTextDocument;
4 import com.sun.star.text.XText;
5 import com.sun.star.text.XTextRange;
7 // get the document from the scripting context which is made available to all
9 oDoc = XSCRIPTCONTEXT.getDocument();
10 //get the XTextDocument interface
11 xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc);
12 //get the XText interface
13 xText = xTextDoc.getText();
14 // get an (empty) XTextRange at the end of the document
15 xTextRange = xText.getEnd();
17 xTextRange.setString( "Hello World (in BeanShell)" );