diff options
-rw-r--r-- | scripting/examples/javascript/HelloWorld/helloworld.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripting/examples/javascript/HelloWorld/helloworld.js b/scripting/examples/javascript/HelloWorld/helloworld.js index 5fb8de33e2a4..aa170def23a5 100644 --- a/scripting/examples/javascript/HelloWorld/helloworld.js +++ b/scripting/examples/javascript/HelloWorld/helloworld.js @@ -4,8 +4,13 @@ importClass(Packages.com.sun.star.text.XTextDocument); importClass(Packages.com.sun.star.text.XText); importClass(Packages.com.sun.star.text.XTextRange); +//get the document from the scripting context oDoc = XSCRIPTCONTEXT.getDocument(); +//get the XTextDocument interface xTextDoc = UnoRuntime.queryInterface(XTextDocument,oDoc); +//get the XText interface xText = xTextDoc.getText(); +//get an (empty) XTextRange interface at the end of the text xTextRange = xText.getEnd(); +//set the text in the XTextRange xTextRange.setString( "Hello World (in JavaScript)" ); |