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