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