xref: /aoo41x/main/odk/examples/examples.html (revision ef1ef8e6)
1<html>
2<head>
3  <title>Apache OpenOffice %PRODUCT_RELEASE% SDK - Examples</title>
4  <link rel="stylesheet" type="text/css" href="../docs/sdk_styles.css">
5  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6  <meta name="author" content="J&uuml;rgen Schmidt">
7  <meta name="created" content="2004-12-14">
8</head>
9
10<body class="sdkbody"><a name="examples"/>
11<table class="table1" cellpadding=0>
12  <tr style="background-image:url(../docs/images/sdk_head-2.png); backgorund-position: bottom; ">
13    <td class="background" colspan="3" align="left"><img src="../docs/images/sdk_head-1.png" width="800" height="120" usemap="#Map" border="0"></td>
14  </tr>
15  <tr>
16    <td colspan="3"><img  class="nothing10" src="../docs/images/nada.gif"></td>
17  </tr>
18  <tr>
19    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
20    <td>
21      <table class="table2">
22	    <tr>
23		  <td colspan="3"><img class="nothing1" src="../docs/images/nada.gif"></td>
24        </tr>
25        <tr>
26          <td>
27          <table class="table3">
28		  <tr>
29			<td colspan="2" class="head1">Examples</td>
30			<td align="right"><a href="../index.html" title="link to the SDK start page"><img class="navigate" src="../docs/images/nav_home.png"></a></td>
31		  </tr>
32		  </table>
33          </td>
34        </tr>
35        <tr>
36          <td>
37          <table class="table3">
38		  <tr>
39          <td colspan="3">
40            <p>The SDK provides a rich set of examples in different programming
41			languages (Java, C++, Apache OpenOffice %PRODUCT_RELEASE% Basic, OLE) to illustrate the use
42			of the API and demonstrate how to benefit from the included word
43			processor, spreadsheet, presentation software, graphics program and
44			database of Apache OpenOffice %PRODUCT_RELEASE%.<br>
45            Some fo the examples need a running office instance listening on a
46			port. If this is necessary you will get further information in the
47			makefiles.</p>
48			<p>Every makefile contains at least one run target to execute an
49			running example, please see the makefile output in the different
50			example directories. Some of the examples which create a component have
51			no run target. In these cases a document is provided which instantiates
52			and runs the component (see the makefile output). Also the Basic
53			examples provide documents which use and shows the implemented
54			functionality.</p>
55          </td>
56		  </tr>
57		  <tr>
58            <td><img class="line" src="../docs/images/sdk_line-1.gif"></td>
59		  </tr>
60		  </table>
61        </tr>
62        <tr>
63          <td>
64          <table class="table3">
65            <tr valign="top">
66              <td class="content3"><img src="../docs/images/arrow-1.gif"></td>
67              <td><a href="DevelopersGuide/examples.html" title="link to the Developer's Guide examples overview page">Developer's Guide examples</a></td>
68              <td class="content75">The <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide" title="link to the Developer's Guide in the Wiki">Developer's Guide</a> comes
69			  with a rich set of examples which demonstrate the use of the API in
70			  the different application areas.</td>
71            </tr>
72            <tr valign="top">
73              <td class="content3"><img src="../docs/images/arrow-1.gif"></td>
74              <td><a href="#Java_examples" title="link to the Java examples section">Java examples</a></td>
75              <td class="content75">Set of simple and more complex examples which
76			  shows the use of the API from Java.</td>
77            </tr>
78            <tr valign="top">
79              <td class="content3"><img src="../docs/images/arrow-1.gif"></td>
80              <td><a href="#Cpp_examples" title="link to the C++ examples section">C++ examples</a></td>
81              <td class="content75">Small set of examples which shows the use of
82			  the API from C++.</td>
83            </tr>
84            <tr valign="top">
85              <td class="content3"><img src="../docs/images/arrow-1.gif"></td>
86              <td><a href="#Basic_examples" title="link to the Apache OpenOffice %PRODUCT_RELEASE% Basic examples section">Apache OpenOffice %PRODUCT_RELEASE% Basic examples</a></td>
87              <td class="content75">Small set of examples which shows the use of
88			  the API from Apache OpenOffice %PRODUCT_RELEASE% Basic.</td>
89            </tr>
90            <tr valign="top">
91              <td class="content3"><img src="../docs/images/arrow-1.gif"></td>
92              <td><a href="#OLE_examples" title="link to the OLE examples section">Object Linking and Embedding (OLE) examples</a></td>
93              <td class="content75">Examples which show the use of the API from
94			  OLE.</td>
95            </tr>
96            <tr valign="top">
97              <td class="content3"><img src="../docs/images/arrow-1.gif"></td>
98              <td><a href="#CLI_examples" title="link to the CLI examples section">Common Language Infrastructure (CLI) examples</a></td>
99              <td class="content75">Examples which show the use of the API from
100			  the CLI.</td>
101            </tr>
102		  </table>
103        </tr>
104      </table>
105    </td>
106    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
107  </tr>
108  <tr>
109    <td colspan="3"><img class="line" src="../docs/images/sdk_line-1.gif"></td>
110  </tr>
111  <tr>
112    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
113    <td>
114      <table class="table2">
115        <tr>
116          <td>
117          <table class="table3">
118		  <tr>
119			<td colspan="2" class="head1"><a name="Java_examples">Java examples</td>
120			<td align="right">
121		      <a href="#examples" title="link to the examples overview"><img class="navigate" src="../docs/images/nav_up.png"></a>
122		      <a href="../index.html" title="link to the SDK start page"><img class="navigate" src="../docs/images/nav_home.png"></a>
123		  </td>
124		  </tr>
125		  </table>
126          </td>
127        </tr>
128		<tr>
129		  <td>
130		  <table class="table4">
131		  <tbody>
132		  <tr class="thead">
133		  <td class="cell20">Text Document Examples</td>
134		  <td class="cell80">Description</td>
135		  </tr>
136		  <tr>
137		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">BookmarkInsertion</a></td>
138		  <td class="cell80">This application connects to the office server and
139		  gets the <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. An empty text document will be opened
140		  and an example text will be entered. Afterwards, some bookmarks will be
141		  inserted.</td>
142		  </tr>
143		  <tr>
144		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">HardFormatting</a></td>
145		  <td class="cell80">This program connects to the office server and gets
146		  the <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. Furthermore, an empty text document will be
147		  opened, an example text will be entered, some text attributes will be
148		  inspected, and the <a href="../docs/common/ref/com/sun/star/beans/PropertyState.html" title="link into the IDL reference to the enum com.sun.star.beans.PropertyState"> PropertyState</a> will be checked from the selection.</td>
149		  </tr>
150		  <tr>
151		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">SWriter</a></td>
152		  <td class="cell80">The program connects to the office server and gets the
153          <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. An empty text document will be created, some
154		  text will be entered, and a text table, a colored text, and text frame
155		  will be inserted.</td>
156		  </tr>
157		  <tr>
158		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">StyleCreation</a></td>
159		  <td class="cell80">The example connects to the office server and gets the
160          <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. An empty text document will be opened, a new
161		  paragraph style will be created, and applied.</td>
162		  </tr>
163		  <tr>
164		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">StyleInitialization</a></td>
165		  <td class="cell80">The program connects to the office server and gets the
166          <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. Thereafter, an empty text document will be
167		  opened and an example text will be entered. The paragraph collection will
168		  be used, in order to apply a different paragraph style on the
169		  paragraphs.</td>
170		  </tr>
171		  <tr>
172		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">TextDocumentStructure</a></td>
173		  <td class="cell80">The application connects to the office server and gets
174		  the <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. An empty text document will be opened, an
175		  enumeration of all paragraphs and an enumeration of all text portions
176		  will be created.</td>
177		  </tr>
178		  <tr>
179		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">TextReplace</a></td>
180		  <td class="cell80">The example connects to the office server and gets the
181          <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. An empty text document will be created, an
182		  example text will be inserted, and some English spelled words will be
183		  replaced with US spelled words.</td>
184		  </tr>
185		  <tr>
186		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">GraphicsInserter</a></td>
187		  <td class="cell80">The GraphicsInserter creates a graphics object on an
188		  empty text document by setting its position, width, height, and URL.</td>
189		  </tr>
190		  <tr>
191		  <td class="cell20"><a href="java/Text/" title="link to the source directory of the Java Text examples">WriterSelector</a></td>
192		  <td class="cell80">This class gives you information on the selected
193		  objects (text range, text frame, or graphics) at an Apache OpenOffice
194		  Server.</td>
195		  </tr>
196		  <tbody>
197		  </table>
198		  </td>
199		</tr>
200		<tr>
201		  <td>
202		  <table class="table4">
203		  <tbody>
204		  <tr class="thead">
205		  <td class="cell20">Spreadsheet Document Examples</td>
206		  <td class="cell80">Description</td>
207		  </tr>
208		  <tr>
209		  <td class="cell20"><a href="java/Spreadsheet/" title="link to the source directory of the Java Spreadsheet examples">CalcAddins</a></td>
210		  <td class="cell80">This component adds new functions to the spreadsheet
211		  application. After registering the component, the inserted functions can
212		  be found with help of the functions autopilot. The new functions are
213		  assigned to the category <i>Add-in</i>.</td>
214		  </tr>
215		  <tr>
216		  <td class="cell20"><a href="java/Spreadsheet/" title="link to the source directory of the Java Spreadsheet examples">ChartTypeChange</a></td>
217		  <td class="cell80">This class loads an Apache OpenOffice %PRODUCT_RELEASE% Calc document and
218		  changes the type of the embedded chart.</td>
219		  </tr>
220		  <tr>
221		  <td class="cell20"><a href="java/Spreadsheet/" title="link to the source directory of the Java Spreadsheet examples">EuroAdaption</a></td>
222		  <td class="cell80">The application connects to the office server and gets
223		  the <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>, opens an empty Calc document, enters an
224		  example text, sets the number format to DM, changes the number format to
225		  EUR (Euro), and uses the DM/EUR factor on each cell with content.</td>
226		  </tr>
227		  <tr>
228		  <td class="cell20"><a href="java/Spreadsheet/" title="link to the source directory of the Java Spreadsheet examples">SCalc</a></td>
229		  <td class="cell80">The program connects to the office server and gets the
230          <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. Then an empty calc document will be opened,
231		  cell styles will be created, some data will be inserted into the sheets,
232		  and the created cell styles will be applied. Finally, a 3D chart will be
233		  inserted.</td>
234		  </tr>
235		  <tbody>
236		  </table>
237		  </td>
238		</tr>
239		<tr>
240		  <td>
241		  <table class="table4">
242		  <tbody>
243		  <tr class="thead">
244		  <td class="cell20">Drawing Document Examples</td>
245		  <td class="cell80">Description</td>
246		  </tr>
247		  <tr>
248		  <td class="cell20"><a href="java/Drawing/" title="link to the source directory of the Java Drawing examples">SDraw</a></td>
249		  <td class="cell80">This program connects to the office server and gets
250		  the <a href="../docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html" title="link into the IDL reference to the interface com.sun.star.lang.XMultiComponentFactory"> multi component factory</a>. Afterwards, an empty text document will
251		  be created and some shapes will be inserted on the draw page.</td>
252		  </tr>
253		  <tbody>
254		  </table>
255		  </td>
256		</tr>
257		<tr>
258		  <td>
259		  <table class="table4">
260		  <tbody>
261		  <tr class="thead">
262		  <td class="cell20">Document Handling Examples</td>
263		  <td class="cell80">Description</td>
264		  </tr>
265		  <tr>
266		  <td class="cell20"><a href="java/DocumentHandling/" title="link to the source directory of the Java DocumentHandling examples">DocumentConverter</a></td>
267		  <td class="cell80">The program offers a service that converts arbitrary
268		  documents to a favored document type.</td>
269		  </tr>
270		  <tr>
271		  <td class="cell20"><a href="java/DocumentHandling/" title="link to the source directory of the Java DocumentHandling examples">DocumentLoader</a></td>
272		  <td class="cell80">The <i>DocumentLoader</i> can open a new or an
273		  existing document.</td>
274		  </tr>
275		  <tr>
276		  <td class="cell20"><a href="java/DocumentHandling/"title="link to the source directory of the Java DocumentHandling examples">DocumentPrinter</a></td>
277		  <td class="cell80">The <i>DocumentPrinter</i> allows you to print the
278		  favored pages of a specified document on your favored printer.</td>
279		  </tr>
280		  <tr>
281		  <td class="cell20"><a href="java/DocumentHandling/" title="link to the source directory of the Java DocumentHandling examples">DocumentSaver</a></td>
282		  <td class="cell80">The DocumentSaver shows how to save a document and
283		  how you can change the type of your document.</td>
284		  </tr>
285		  <tbody>
286		  </table>
287		  </td>
288		</tr>
289		<tr>
290		  <td>
291		  <table class="table4">
292		  <tbody>
293		  <tr class="thead">
294		  <td class="cell20">UNO Component Examples</td>
295		  <td class="cell80">Description</td>
296		  </tr>
297		  <tr>
298		  <td class="cell20"><a href="http://wiki.services.openoffice.org/wiki/Object_Inspector" title="link to the Object Inspector project page in the wiki">Object Inspector</a></td>
299		  <td class="cell80">The Object Inspector is primarily an auxiliary tool
300		  for the developer, which can present information about an object of the
301		  Apache OpenOffice %PRODUCT_RELEASE% API at run-time. Depending on the object to be inspected,
302		  appropriate methods, interfaces, services, and attributes can be displayed
303		  to the developer. The methods, interfaces, services and attributes are
304		  represented in a predictable tree. If the attributes contained in an
305		  object are to be examined, the appropriate nodes in the tree can be
306		  expanded with the help of the mouse. For each non primitive object, five
307		  categories are offered to the user, as long as those are available with
308		  that object. The Object Inspector is currently available as a NetBeans project
309		  only because of major code changes. Please see the <a href="http://wiki.services.openoffice.org/wiki/Object_Inspector" title="link to the Object Inspector project page in the wiki">project page</a> for further details.</td>
310		  </tr>
311		  <tr>
312		  <td class="cell20"><a href="java/MinimalComponent/" title="link to the source directory of the Java MinimalComponent example">MinimalComponent</a></td>
313		  <td class="cell80">This class provides a minimal UNO component. You can
314		  take this class as a base for your own components. By extensions of this
315		  class it is possible to also extend the function range of the Office.</td>
316		  </tr>
317		  <tr>
318		  <td class="cell20"><a href="java/PropertySet/" title="link to the source directory of the Java PropertySet example">PropTest</a></td>
319		  <td class="cell80">Contains a component that provides property set
320		  interfaces by means of inheriting <a href="../docs/java/ref/com/sun/star/lib/uno/helper/PropertySet.html" title="link into the Java UNO reference to the PropertySet helper class">com.sun.star.lib.uno.helper.ProperterSet</a>.</td>
321		  </tr>
322		  <tr>
323		  <td class="cell20"><a href="java/ToDo/" title="link to the source directory of the Java ToDo example">ToDo</a></td>
324		  <td class="cell80">For every to-do listed in a spreadsheet document, this
325		  component calculates the start date, day of week of the start date, the
326		  end date, and the day of week of the end date. All calculations are
327		  dependent upon the values of &quot;Needed Days&quot;, &quot;Due Date&quot;
328          and &quot;Status&quot;. The columns &quot;Needed Days&quot; and
329		  &quot;Status&quot; are mandatory. The first to-do should be placed in
330		  row nine. The date to start the calculation should be placed in cell C6.
331		  The private holidays should be placed in cell K4/K5 and below.<br>
332          All rows will be calculated up to the first empty cell in the first
333		  column. If a cell in the column &quot;Due Date&quot; is colored red,
334		  you should take a look at your entries.</td>
335		  </tr>
336		  <tr>
337		  <td class="cell20"><a href="java/EmbedDocument/EmbeddedObject" title="link to the source directory of the Java EmbeddedObject example">EmbeddedObject</a></td>
338		  <td class="cell80">Contains a component that provides an example of embedded object implementation.</td>
339		  </tr>
340		  <tbody>
341		  </table>
342		  </td>
343		</tr>
344        <tr>
345          <td>
346          <table class="table3">
347		  <tr>
348		  <td  colspan="3">
349		  <p>Additional information:</p>
350		  <p>
351		  <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Simple_Component_in_Java" title="link to the &quot;Simple component in Java&quot; chapter in the Developer's Guide">How to write a UNO component in Java</a><br>
352		  <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Java/Java_Language_Binding" title="link to the &quot;Java UNO Language Bnding&quot; chapter in the Developer's Guide">Java UNO Language Binding</a><br>
353		  <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Debugging" title="link to the &quot;Debugging Java components&quot; chapter in the Developer's Guide">Debugging Java components</a><br>
354		  </p>
355		  </td>
356		  </tr>
357		  </table>
358          </td>
359        </tr>
360      </table>
361    </td>
362    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
363  </tr>
364  <tr>
365    <td colspan="3"><img class="line" src="../docs/images/sdk_line-1.gif"></td>
366  </tr>
367  <tr>
368    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
369    <td>
370      <table class="table2">
371        <tr>
372          <td>
373          <table class="table3">
374		  <tr>
375			<td colspan="2" class="head1"><a name="Cpp_examples">C++ examples</td>
376			<td align="right">
377		      <a href="#examples" title="link to the examples overview"><img class="navigate" src="../docs/images/nav_up.png"></a>
378		      <a href="../index.html" title="link to the SDK start page"><img class="navigate" src="../docs/images/nav_home.png"></a>
379		  </td>
380		  </tr>
381		  <tr>
382		  <td  colspan="3">
383		  The DocumentLoader example needs a running office server, before
384		  running this program you should invoke the office with the following
385		  command:
386		  <blockquote>
387		  <code>soffice &quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&quot;</code>
388		  </blockquote>
389		  You can also customize the mentioned host and port to your needs.
390		  </td>
391		  </tr>
392		  </table>
393          </td>
394        </tr>
395		<tr>
396		  <td>
397		  <table class="table4">
398		  <tbody>
399		  <tr class="thead">
400		  <td class="cell20">Example</td>
401		  <td class="cell80">Description</td>
402		  </tr>
403		  <tr>
404		  <td class="cell20"><a href="cpp/DocumentLoader/"title="link to the source directory of the C++ DocumentLoader example">DocumentLoader</a></td>
405		  <td class="cell80">This component works the same as the appropriate Java
406		  example, but is implemented in C++.</td>
407		  </tr>
408		  <tr>
409		  <td class="cell20"><a href="cpp/counter/" title="link to the source directory of the C++ counter example">Counter</a></td>
410		  <td class="cell80">This demo shows how to implement a very simple UNO
411		  component and how to access the UNO component from an executable.</td>
412		  </tr>
413		  <tr>
414		  <td class="cell20"><a href="cpp/remoteclient/" title="link to the source directory of the C++ remoteclient example">Remote client</a></td>
415		  <td class="cell80">The 'uno' program is used to export an arbitrary
416		  service to other processes. In this example the com.sun.star.uno.Pipe
417		  service (which is built in io-module) is exported. The client component
418		  implements the <a href="../docs/common/ref/com/sun/star/lang/XMain.html" title="link into the IDL reference to the interface com.sun.star.lang.XMain">
419		  com.sun.star.lang.XMain</a> interface. In the run method, it connects to
420		  the servers process and retrieves an instance and does some calls on the
421		  instance.</td>
422		  </tr>
423		  <tr>
424		  <td class="cell20"><a href="cpp/complextoolbarcontrols/" title="link to the source directory of the C++ complextoolbarcontrols example">complextoolbarcontrols</a></td>
425		  <td class="cell80">This example shows how to create a toolbar add-on with complex toolbar controls.
426		  It shows how to use an Image Button, a Combo Box, a Spin Field, an Edit Field, a Dropdown Box, a Toggle Dropdown Button and a normal Dropdown Button</td>
427		  </tr>
428		  <tbody>
429		  </table>
430		  </td>
431		</tr>
432        <tr>
433          <td>
434          <table class="table3">
435		  <tr>
436		  <td  colspan="3">
437		  <p>Additional information:</p>
438		  <p>
439		  <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/C%2B%2B_Component" title="link to the &quot;How to write a UNO component in C++&quot; chapter in the Developer's Guide">How to write a UNO component in C++</a><br>
440		  <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/C%2B%2B/C%2B%2B_Language_Binding" title="link to the &quot;C++ UNO Language Binding&quot; chapter in the Developer's Guide">C++ UNO Language Binding</a><br>
441		  <a href="../docs/cpp/ref/index.html" title="link to the C++ API reference">C++ reference</a>
442		  </p>
443		  </td>
444		  </tr>
445		  </table>
446          </td>
447        </tr>
448      </table>
449    </td>
450    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
451  </tr>
452  <tr>
453    <td colspan="3"><img class="line" src="../docs/images/sdk_line-1.gif"></td>
454  </tr>
455  <tr>
456    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
457    <td>
458      <table class="table2">
459        <tr>
460          <td>
461          <table class="table3">
462		  <tr>
463			<td colspan="2" class="head1"><a name="Basic_examples">Apache OpenOffice %PRODUCT_RELEASE% Basic examples</td>
464			<td align="right">
465		      <a href="#examples" title="link to the examples overview"><img class="navigate" src="../docs/images/nav_up.png"></a>
466		      <a href="../index.html" title="link to the SDK start page"><img class="navigate" src="../docs/images/nav_home.png"></a>
467		  </td>
468		  </tr>
469		  <tr>
470		  <td  colspan="3">
471		  <p>The example programs are embedded in Apache OpenOffice %PRODUCT_RELEASE% documents in the
472		  samples directory. To view or edit the Apache OpenOffice %PRODUCT_RELEASE% Basic source,
473		  select the appropriate document and then select Tools-&gt;Macro.</p>
474		  <p>Most of the examples are stand-alone, but two of them (Creating an
475		  Index and Import/Export of ASCII Files) have an associated data file
476		  identified by a .txt file name suffix).</p>
477		  <p>Some of the examples are also available in Java, you can find them in
478		  the <a href="#Java_examples" title="link to the Java examples section">
479		  Java section</a>.</p>
480		  </td>
481		  </tr>
482		  </table>
483          </td>
484        </tr>
485		<tr>
486		  <td>
487		  <table class="table4">
488		  <tbody>
489		  <tr class="thead">
490		  <td class="cell20">Example</td>
491		  <td class="cell80">Description</td>
492		  </tr>
493		  <tr>
494		  <td class="cell20"><a href="basic/text/modifying_text_automatically/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic text/modifying_text_automatically examples">Changing Appearance</a></td>
495		  <td class="cell80"> To change the style used for certain words, you can
496		  start with the following example. This code searches for the regular
497		  expression <code>the[a-z]</code>, which stands for the text portion the
498		  followed by exactly one lowercase letter. All occurrences of these four
499		  letters are then changed to bold characters. The same happens in the next
500		  part of the program, this time changing the appearance of
501		  <code>all[a-z]</code> to italic. In order for this example to work, you
502		  must execute it from an open text document.</td>
503		  </tr>
504		  <tr>
505		  <td class="cell20"><a href="basic/text/modifying_text_automatically/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic text/modifying_text_automatically examples">Replacing Text</a></td>
506		  <td class="cell80">If you regularly receive documents from other people
507		  for editing, you might want to make sure that certain words are always
508		  written the same. The next example illustrates this by forcing certain
509		  words to be spelled in American English.<br>
510          In order for this example to work, you must execute it from an open text
511		  document. For a real world application, it is a good idea to read the
512		  words from an external file.</td>
513		  </tr>
514		  <tr>
515		  <td class="cell20"><a href="basic/text/modifying_text_automatically/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic text/modifying_text_automatically examples">Using Regular Expressions</a></td>
516		  <td class="cell80">Another application of automatic text modification is
517		  related to stylistic questions. Suppose your company&#146;s policy is to
518		  avoid the use of certain words. You want to replace these words, but you
519		  cannot do that automatically because you have to find the appropriate
520		  replacement, which depends on the context. So instead of deleting or
521		  replacing the offending words automatically, you change their color to
522		  make them stand out during a subsequent manual review process.<br>
523		  The following example handles two kinds of unwanted wordings: those
524		  which are absolutely forbidden and must be replaced by something else,
525		  and those which are considered bad style. A subroutine is responsible
526		  for the changes. It can be used to make all words in a list appear in a
527		  certain color in the text document. To keep the lists short, we use
528		  regular expressions which provide for the variants of the words
529		  (plural, adjective etc.).</td>
530		  </tr>
531		  <tr>
532		  <td class="cell20"><a href="basic/text/modifying_text_automatically/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic text/modifying_text_automatically examples">Inserting Bookmarks</a></td>
533		  <td class="cell80">
534		  <p>The next example does something very similar. This time, however, we
535		  do not change the color of the words but insert a bookmark at each of
536		  them. You can thus use the StarOffice navigator to jump directly from
537		  word to word. Bookmarks must first be created using
538		  <code>createInstance()</code>. They are then inserted with
539		  <code>insertTextContent()</code> at the current text range.</p>
540		  <p>The main difference to the preceding example is the For loop in
541		  <code>markList()</code>. Instead of changing the color of the current
542		  word, it creates a new bookmark, oBookmark, whose name is the current
543		  word with an integer appended. It then inserts this bookmark at the
544		  word.</td>
545		  </tr>
546		  <tr>
547		  <td class="cell20"><a href="basic/text/creating_an_index/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic text/create_index example">Creating an Index</a></td>
548		  <td class="cell80">Indices for text documents can be created manually in
549		  Apache OpenOffice %PRODUCT_RELEASE% Writer by clicking on the words that should appear in the
550		  index. If the document is large, or if you have to generate indices for
551		  several documents, this task should be automated.</td>
552		  </tr>
553		  <tr>
554		  <td class="cell20"><a href="basic/sheet/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic sheet example">Adapting to Euroland</a></td>
555		  <td class="cell80">Most of the members of the European Union will abandon
556		  their old currency in favor of the new Euro in 2001. This requires
557		  modifications to all programs using the old currencies. Since the exchange
558		  rates for the old currencies have been fixed at the end of 1999, one can
559		  already convert old data. The following program does this for all values
560		  in a table that are formatted with the currency string DM.</td>
561		  </tr>
562		  <tr>
563		  <td class="cell20"><a href="basic/drawing/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic drawing example">Import/Export of ASCII Files</a></td>
564		  <td class="cell80">You can use the drawing facilities of StarOffice API
565		  to generate a picture from ASCII input. One application would be a
566		  hierarchical representation of a directory listing, based on textual
567		  data.</td>
568		  </tr>
569		  <tr>
570		  <td class="cell20"><a href="basic/stock_quotes_updater/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic stock_quotes_updater example">Stock Quotes Updater</a></td>
571		  <td class="cell80">If you want to display stock charts for certain
572		  companies, you can open up your browser every day, go to a search engine,
573		  look up the quote and copy it by hand into a table. Or you can use a
574		  program that does all this automatically. The following example relies on
575		  the sheet module. It uses URLs to obtain the current stock quotes. The
576		  quotes are displayed in sheets, one for each company. We show a line
577		  diagram and the numerical values for this company on every sheet. The
578		  functionality is hidden in the three subroutines <code>GetValue()</code>,
579		  <code>UpdateValue()</code>, and <code>UpdateChart()</code>.</td>
580		  </tr>
581		  <tr>
582		  <td class="cell20"><a href="basic/forms_and_controls/" title="link to the source directory of the Apache OpenOffice %PRODUCT_RELEASE% Basic forms_and_controls example">Forms and Controls</a></td>
583		  <td class="cell80">The example document Burger Factory offers some forms
584		  and controls, which you can use to order your desired burger type,
585		  beverage, topping, and sauce. By hitting the button
586		  &quot;Order now!&quot;, your order will be placed.</td>
587		  </tr>
588		  <tbody>
589		  </table>
590		  </td>
591		</tr>
592        <tr>
593          <td>
594          <table class="table3">
595		  <tr>
596		  <td  colspan="3">
597		  Additional information: <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Basic/OpenOffice.org_Basic" title="link to the &quot;OpenOffice.org %PRODUCT_RELEASE% Basic language binding&quot; chapter in the Developer's Guide">OpenOffice.org %PRODUCT_RELEASE% Basic language binding</a>
598		  </td>
599		  </tr>
600		  </table>
601          </td>
602        </tr>
603		</table>
604    </td>
605    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
606  </tr>
607  <tr>
608    <td colspan="3"><img class="line" src="../docs/images/sdk_line-1.gif"></td>
609  </tr>
610  <tr>
611    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
612    <td>
613      <table class="table2">
614        <tr>
615          <td>
616          <table class="table3">
617		  <tr>
618			<td colspan="2" class="head1"><a name="OLE_examples">Object Linking and Embedding (OLE) examples</td>
619			<td align="right">
620		      <a href="#examples" title="link to the examples overview"><img class="navigate" src="../docs/images/nav_up.png"></a>
621		      <a href="../index.html" title="link to the SDK start page"><img class="navigate" src="../docs/images/nav_home.png"></a>
622		  </td>
623		  </tr>
624		  </table>
625          </td>
626        </tr>
627		<tr>
628		  <td>
629		  <table class="table4">
630		  <tbody>
631		  <tr class="thead">
632		  <td class="cell20">Example</td>
633		  <td class="cell80">Description</td>
634		  </tr>
635		  <tr>
636		  <td class="cell20"><a href="OLE/activex/" title="link to the source directory of the activex plugin example using the OLE bridge">ActiveX Control</a></td>
637		  <td class="cell80">The ActiveX control shows an example of access to UNO
638		  through COM technology. It requires a properly installed StarOffice
639		  version 6.0 or OpenOffice 1.0 or newer. This is a Lite ActiveX control
640		  so it can be used only in containers that allow the use of such controls.
641		  It can be activated with an &lt;OBJECT&gt; tag from a html-page to embed
642		  a document. Without any parameters a new writer document will be opened
643		  for editing. For more details please see the <a href="OLE/activex/README.txt" title="link to the README file of the activex example">README</a>.<br>
644		  Note: This example works only under windows and if you don't use the MS
645		  .Net C++ compiler please check the makefile and take notice of the
646		  comments.</td>
647		  </tr>
648		  <tr>
649		  <td class="cell20"><a href="OLE/vbscript/" title="link to the source directory of the VBScript example using the OLE bridge">WriterDemo</a></td>
650		  <td class="cell80">This Visual Basic Script creates an empty text
651		  document and inserts text, a table, and a text frame.</td>
652		  </tr>
653		  <tbody>
654		  </table>
655		  </td>
656		</tr>
657        <tr>
658          <td>
659          <table class="table3">
660		  <tr>
661		  <td  colspan="3">
662		  Additional information: <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge" title="link to the &quot;Automation Language Binding&quot; chapter in the Developer's Guide">Automation Language Binding</a>
663		  </td>
664		  </tr>
665		  </table>
666          </td>
667        </tr>
668      </table>
669    </td>
670    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
671  </tr>
672  <tr>
673    <td colspan="3"><img class="line" src="../docs/images/sdk_line-1.gif"></td>
674  </tr>
675  <tr>
676    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
677    <td>
678      <table class="table2">
679        <tr>
680          <td>
681          <table class="table3">
682		  <tr>
683			<td colspan="2" class="head1"><a name="CLI_examples">Common Language Infrastructure (CLI)  examples</td>
684			<td align="right">
685		      <a href="#examples" title="link to the examples overview"><img class="navigate" src="../docs/images/nav_up.png"></a>
686		      <a href="../index.html" title="link to the SDK start page"><img class="navigate" src="../docs/images/nav_home.png"></a>
687		  </td>
688		  </tr>
689		  </table>
690          </td>
691        </tr>
692		<tr>
693		  <td>
694		  <table class="table4">
695		  <tbody>
696		  <tr class="thead">
697		  <td class="cell20">Example</td>
698		  <td class="cell80">Description</td>
699		  </tr>
700		  <tr>
701		  <td class="cell20"><a href="CLI/CSharp/Spreadsheet/" title="link to the source directory of the Spreadsheet example using the CLI-UNO bridge">Spreadsheet Example</a></td>
702		  <td class="cell80">This example is written in C# and shows how Spreadsheet
703		  documents are created and filled with content. This example actually
704		  consists of three separate executables, SpreadsheetSample.exe,
705		  GeneralTableSample.exe, ViewSample.exe.</td>
706		  </tr>
707		  <tr>
708		  <td class="cell20"><a href="CLI/VB.NET/WriterDemo/" title="link to the source directory of the WriterDeom example using the CLI-UNO bridge">WriterDemo</a></td>
709		  <td class="cell80">This example is written in VB.NET. It creates a text
710		  document and inserts text, a table, and a text frame.</td>
711		  </tr>
712		  <tbody>
713		  </table>
714		  </td>
715		</tr>
716        <tr>
717          <td>
718          <table class="table3">
719		  <tr>
720		  <td  colspan="3">
721		  Additional information: <a href="http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/CLI/CLI_Language_Binding" title="link to the &quot;CLI-UNO Language Binding&quot; chapter in the Developer's Guide">CLI-UNO Language Binding</a>
722		  </td>
723		  </tr>
724		  </table>
725          </td>
726        </tr>
727      </table>
728    </td>
729    <td class="content1"><img class="nothing8" src="../docs/images/nada.gif"></td>
730  </tr>
731  <tr>
732    <td colspan="3"><img class="nothing30" src="../docs/images/nada.gif"></td>
733  </tr>
734  <tr>
735    <td colspan="3"><img class="line" src="../docs/images/sdk_line-1.gif"></td>
736  </tr>
737  <tr>
738    <td colspan="3">
739      <div class="centertext">
740	<p><img class="apachelogo" src="../docs/images/odk-footer-logo.gif" title="Apache Feather" alt="Apache Feather" />
741            Copyright &copy; 2011 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOfifce.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.<p>
742      </div>
743    </td>
744  </tr>
745</table>
746<map name="Map">
747  <area shape="rect" coords="10,68,400,105" href="http://www.openoffice.org">
748</map>
749</body>
750</html>
751