diff options
Diffstat (limited to 'scripting/examples/beanshell/HelloWorld/helloworld.bsh')
-rw-r--r-- | scripting/examples/beanshell/HelloWorld/helloworld.bsh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripting/examples/beanshell/HelloWorld/helloworld.bsh b/scripting/examples/beanshell/HelloWorld/helloworld.bsh new file mode 100644 index 000000000000..2e7655486680 --- /dev/null +++ b/scripting/examples/beanshell/HelloWorld/helloworld.bsh @@ -0,0 +1,17 @@ +// Hello World in BeanShell +import com.sun.star.uno.UnoRuntime; +import com.sun.star.text.XTextDocument; +import com.sun.star.text.XText; +import com.sun.star.text.XTextRange; + +// get the document from the scripting context which is made available to all +// scripts +oDoc = XSCRIPTCONTEXT.getDocument(); +//get the XTextDocument interface +xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc); +//get the XText interface +xText = xTextDoc.getText(); +// get an (empty) XTextRange at the end of the document +xTextRange = xText.getEnd(); +// set the string +xTextRange.setString( "Hello World (in BeanShell)" ); |