INTEGRATION: CWS scriptingf9 (1.1.2); FILE ADDED
2004/11/23 17:28:06 toconnor 1.1.2.1: #i36937# clean up structure of Java examples
This commit is contained in:
22
scripting/examples/java/HelloWorld/HelloWorld.java
Normal file
22
scripting/examples/java/HelloWorld/HelloWorld.java
Normal file
@@ -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
|
||||
|
||||
}
|
Reference in New Issue
Block a user