summaryrefslogtreecommitdiff
path: root/scripting/examples/java/HelloWorld/HelloWorld.java
diff options
context:
space:
mode:
Diffstat (limited to 'scripting/examples/java/HelloWorld/HelloWorld.java')
-rwxr-xr-xscripting/examples/java/HelloWorld/HelloWorld.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripting/examples/java/HelloWorld/HelloWorld.java b/scripting/examples/java/HelloWorld/HelloWorld.java
new file mode 100755
index 000000000000..eaed56fc6063
--- /dev/null
+++ b/scripting/examples/java/HelloWorld/HelloWorld.java
@@ -0,0 +1,22 @@
+import com.sun.star.script.provider.XScriptContext;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XText;
+/**
+ * HelloWorld class
+ *
+ */
+public class HelloWorld {
+ public static void printHW(XScriptContext xSc) {
+
+ // getting the text document object
+ XTextDocument xtextdocument = (XTextDocument) UnoRuntime.queryInterface(
+XTextDocument.class, xSc.getDocument());
+ XText xText = xtextdocument.getText();
+ XTextRange xTextRange = xText.getEnd();
+ xTextRange.setString( "Hello World (in Java)" );
+
+ }// printHW
+
+}