{"id":289,"date":"2009-07-28T14:39:33","date_gmt":"2009-07-28T13:39:33","guid":{"rendered":"http:\/\/www.codingfriends.com\/?p=289"},"modified":"2009-07-28T14:39:33","modified_gmt":"2009-07-28T13:39:33","slug":"hello-world-7","status":"publish","type":"post","link":"https:\/\/www.codingfriends.com\/index.php\/2009\/07\/28\/hello-world-7\/","title":{"rendered":"Hello World"},"content":{"rendered":"<p>This is a tutorial that will create the text &#8220;Hello World&#8221; within the current document of a OpenOffice Writer document.<\/p>\n<p>To be able to get into the editor, if you click Tools->Macros->Organize Macros->OpenOffice Basic and then select Edit on the module1 within MyMacros->Standard.<\/p>\n<p>The code required builds up an object to document and also a network object server that communicates with the document frame (createUnoService) the objects within the parameters e.g com.sun.star.frame.DispatchHelper are services that enable communication with dispatch object which in-turns &#8216;talks&#8217; to the document object.<\/p>\n<p>The code <\/p>\n<pre lang=\"vb\">\r\nsub helloworld\r\nrem ----------------------------------------------------------------------\r\nrem define variables\r\ndim document   as object\r\ndim dispatcher as object\r\nrem ----------------------------------------------------------------------\r\nrem get access to the document\r\ndocument   = ThisComponent.CurrentController.Frame\r\nrem ----------------------------------------------------------------------\r\nrem Create a universe network object service with the frame.\r\ndispatcher = createUnoService(\"com.sun.star.frame.DispatchHelper\")\r\n\r\nrem ----------------------------------------------------------------------\r\nrem The type is a text string and the value of the string is Hello World\r\ndim args1(0) as new com.sun.star.beans.PropertyValue\r\nargs1(0).Name = \"Text\"\r\nargs1(0).Value = \"Hello World\"\r\n\r\ndispatcher.executeDispatch(document, \".uno:InsertText\", \"\", 0, args1())\r\n\r\nrem ----------------------------------------------------------------------\r\nrem Create a new paragraph\r\ndispatcher.executeDispatch(document, \".uno:InsertPara\", \"\", 0, Array())\r\nend sub\r\n<\/pre>\n<p>if you open up a new document and then goto the macro editor (click Tools->Macros->Organize Macros->OpenOffice Basic and then select Edit on the module1 within MyMacros->Standard) insert the code into the editor.  To run the code, click on the Tools->Macro->Run Macro, then select the Helloworld subroutine from the MyMacros->Standard->Module1.<\/p>\n<p>That is it, and the start of tutorials for OpenOffice being \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a tutorial that will create the text &#8220;Hello World&#8221; within the current document of a OpenOffice Writer document. To be able to get into the editor, if you click Tools->Macros->Organize Macros->OpenOffice Basic and then select Edit on the module1 within MyMacros->Standard. The code required builds up an object to document and also a &hellip; <a href=\"https:\/\/www.codingfriends.com\/index.php\/2009\/07\/28\/hello-world-7\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Hello World<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[30,31,29],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-vb","tag-open-office","tag-vba","tag-visual-basic"],"_links":{"self":[{"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":1,"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/posts\/289\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/categories?post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codingfriends.com\/index.php\/wp-json\/wp\/v2\/tags?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}