2004-02-10 15:04:09 +00:00
|
|
|
// 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;
|
|
|
|
|
2004-10-22 12:48:52 +00:00
|
|
|
// get the document from the scripting context which is made available to all
|
|
|
|
// scripts
|
|
|
|
oDoc = XSCRIPTCONTEXT.getDocument();
|
|
|
|
//get the XTextDocument interface
|
2004-02-10 15:04:09 +00:00
|
|
|
xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc);
|
2004-10-22 12:48:52 +00:00
|
|
|
//get the XText interface
|
2004-02-10 15:04:09 +00:00
|
|
|
xText = xTextDoc.getText();
|
2004-10-22 12:48:52 +00:00
|
|
|
// get an (empty) XTextRange at the end of the document
|
2004-02-10 15:04:09 +00:00
|
|
|
xTextRange = xText.getEnd();
|
2004-10-22 12:48:52 +00:00
|
|
|
// set the string
|
2004-02-10 15:04:09 +00:00
|
|
|
xTextRange.setString( "Hello World (in BeanShell)" );
|