<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Coding Friends &#187; Visual Basic</title>
	<atom:link href="http://www.codingfriends.com/index.php/category/programming/vb/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codingfriends.com</link>
	<description>Coding Friends, place for developers.</description>
	<lastBuildDate>Mon, 06 Sep 2010 20:18:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Hello World</title>
		<link>http://www.codingfriends.com/index.php/2009/07/28/hello-world-7/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=hello-world-7</link>
		<comments>http://www.codingfriends.com/index.php/2009/07/28/hello-world-7/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 13:39:33 +0000</pubDate>
		<dc:creator>genux</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Open Office]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://www.codingfriends.com/?p=289</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>This is a tutorial that will create the text &#8220;Hello World&#8221; within the current document of a OpenOffice Writer document.</p>
<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>
<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>
<p>The code</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">sub</span> helloworld
rem ----------------------------------------------------------------------
rem define variables
<span style="color: #000080;">dim</span> document   <span style="color: #000080;">as</span> <span style="color: #000080;">object</span>
<span style="color: #000080;">dim</span> dispatcher <span style="color: #000080;">as</span> <span style="color: #000080;">object</span>
rem ----------------------------------------------------------------------
rem <span style="color: #000080;">get</span> access <span style="color: #000080;">to</span> the document
document   = ThisComponent.CurrentController.Frame
rem ----------------------------------------------------------------------
rem Create a universe network <span style="color: #000080;">object</span> service <span style="color: #000080;">with</span> the frame.
dispatcher = createUnoService(<span style="color: #800000;">&quot;com.sun.star.frame.DispatchHelper&quot;</span>)
&nbsp;
rem ----------------------------------------------------------------------
rem The <span style="color: #000080;">type</span> <span style="color: #000080;">is</span> a text <span style="color: #000080;">string</span> <span style="color: #000080;">and</span> the value of the <span style="color: #000080;">string</span> <span style="color: #000080;">is</span> Hello World
<span style="color: #000080;">dim</span> args1(0) <span style="color: #000080;">as</span> <span style="color: #000080;">new</span> com.sun.star.beans.PropertyValue
args1(0).Name = <span style="color: #800000;">&quot;Text&quot;</span>
args1(0).Value = <span style="color: #800000;">&quot;Hello World&quot;</span>
&nbsp;
dispatcher.executeDispatch(document, <span style="color: #800000;">&quot;.uno:InsertText&quot;</span>, <span style="color: #800000;">&quot;&quot;</span>, 0, args1())
&nbsp;
rem ----------------------------------------------------------------------
rem Create a <span style="color: #000080;">new</span> paragraph
dispatcher.executeDispatch(document, <span style="color: #800000;">&quot;.uno:InsertPara&quot;</span>, <span style="color: #800000;">&quot;&quot;</span>, 0, Array())
<span style="color: #000080;">end</span> <span style="color: #000080;">sub</span></pre></div></div>

<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>
<p>That is it, and the start of tutorials for OpenOffice being <img src='http://www.codingfriends.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.codingfriends.com/index.php/2009/07/28/hello-world-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
