home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 118 / cd-rom 118.iso / aplic / open / openofficeorg1.cab / helloworld.js < prev    next >
Encoding:
Text File  |  2004-10-22  |  642 b   |  17 lines

  1. // Hello World in JavaScript
  2. importClass(Packages.com.sun.star.uno.UnoRuntime);
  3. importClass(Packages.com.sun.star.text.XTextDocument);
  4. importClass(Packages.com.sun.star.text.XText);
  5. importClass(Packages.com.sun.star.text.XTextRange);
  6.  
  7. //get the document from the scripting context
  8. oDoc = XSCRIPTCONTEXT.getDocument();
  9. //get the XTextDocument interface
  10. xTextDoc = UnoRuntime.queryInterface(XTextDocument,oDoc);
  11. //get the XText interface
  12. xText = xTextDoc.getText();
  13. //get an (empty) XTextRange interface at the end of the text
  14. xTextRange = xText.getEnd();
  15. //set the text in the XTextRange
  16. xTextRange.setString( "Hello World (in JavaScript)" );
  17.