- Page 2 and 3: OpenOffice.org Macros Explained OOM
- Page 4 and 5: Table of Contents General Informati
- Page 6 and 7: 3.8.7. Choose......................
- Page 8 and 9: 9.2.3. Dynamic Link Libraries......
- Page 10 and 11: 13.15.1. Printing Writer documents.
- Page 14 and 15: 1. Introduction and housekeeping Fi
- Page 16 and 17: a document are visible only to that
- Page 18 and 19: From the Macros dialog, click the O
- Page 20 and 21: Figure 6. New library dialog. 6) Th
- Page 22 and 23: 10) Select HelloModule and click Ed
- Page 24 and 25: Icon Key Description Select a modul
- Page 26 and 27: The macro in Listing 1 is text that
- Page 28 and 29: Figure 15. Macro Security dialog, S
- Page 30 and 31: Each library is stored in a single
- Page 32 and 33: 3. Language Constructs The OpenOffi
- Page 34 and 35: StarBasic is much more forgiving th
- Page 36 and 37: Table 5. Declaring simple variables
- Page 38 and 39: Figure 18. The dialog displayed by
- Page 40 and 41: f2= 3.49 i2= f2 REM i2 is rounded t
- Page 42 and 43: LastName$ = "Pitonyak" Print "Hello
- Page 44 and 45: 3.2.8. Create your own data types I
- Page 46 and 47: Listing 17. Demonstrate variant typ
- Page 48 and 49: .Value = "Boy Bill" End With 'Set V
- Page 50 and 51: Dim a(), b(1 To 2), c Dim iLine As
- Page 52 and 53: Listing 22. Utility function array
- Page 54 and 55: Figure 25. Assigning an array assig
- Page 56 and 57: A routine name can optionally be fo
- Page 58 and 59: TIP The IsMissing function returns
- Page 60 and 61: encountered inside a routine, OOo B
- Page 62 and 63:
Private or Dim Use Private or Dim t
- Page 64 and 65:
Listing 30. Strings are automatical
- Page 66 and 67:
Figure 29. Using the MOD operator.
- Page 68 and 69:
3.7.2. Logical and bit-wise operato
- Page 70 and 71:
Else s = b0$ & s 'Bit 1 clear so ad
- Page 72 and 73:
Listing 41. Operator EQV. Sub Examp
- Page 74 and 75:
Print i% < "2" Print i% > "22" 'Fal
- Page 76 and 77:
Listing 45. Example On GoTo. Sub Ex
- Page 78 and 79:
Listing 48. Example Choose statemen
- Page 80 and 81:
Example Valid Description Select Ca
- Page 82 and 83:
ExampleSelectCase in Listing 54 gen
- Page 84 and 85:
printing all of the elements in an
- Page 86 and 87:
s = s & iOuter & " : " & iEntry(iOu
- Page 88 and 89:
2. CVErr accepts an integer, which
- Page 90 and 91:
Sub JumpError2 On Error GoTo ExErro
- Page 92 and 93:
size of your macro. Consider, for e
- Page 94 and 95:
4. Numerical Routines This chapter
- Page 96 and 97:
degrees = (radians * 180) / Pi radi
- Page 98 and 99:
1/3 + 1/3 + 1/3 = 3/3 = 1 'The exac
- Page 100 and 101:
Print AreSameNumber(299792458, 2997
- Page 102 and 103:
Table 26. Convert to a numerical ty
- Page 104 and 105:
TIP In 64-bit versions of OOo, CLng
- Page 106 and 107:
s = s & CHR$(10) & "Hex(-1) = " & H
- Page 108 and 109:
Print "X" & Str(b) 'XFalse Print "X
- Page 110 and 111:
End If For i=nLeftOver + 1 To n Ste
- Page 112 and 113:
RndRange = lowerBound + Rnd() * (up
- Page 114 and 115:
The word “dimension” is used to
- Page 116 and 117:
TIP Option Base 1 has no effect on
- Page 118 and 119:
LBound(a()) & " UBound = " & UBound
- Page 120 and 121:
Print UBound(b(),2) ' 5 If the valu
- Page 122 and 123:
MsgBox s, 0, "Array Info" End Sub F
- Page 124 and 125:
Function Type Description Year(date
- Page 126 and 127:
6.3. Locale formatted dates Use the
- Page 128 and 129:
The ISO 8601 standard, introduced t
- Page 130 and 131:
Figure 46. Some Date values convert
- Page 132 and 133:
Print "Hour = " & Hour(Date) '0, No
- Page 134 and 135:
Figure 47. Use MonthName and WeekDa
- Page 136 and 137:
Print DateAdd("d", 1, Now) 'Add one
- Page 138 and 139:
Table 45. Elapsed time functions in
- Page 140 and 141:
test = x MOD y ' remainder after di
- Page 142 and 143:
solution that limits the iterations
- Page 144 and 145:
7. String Routines This chapter int
- Page 146 and 147:
7.1. ASCII and Unicode values In th
- Page 148 and 149:
ut it’s a widely used slang expre
- Page 150 and 151:
My wife really likes to file. I als
- Page 152 and 153:
Print Len("123") '3 Print Len(12) '
- Page 154 and 155:
The Mid function takes an optional
- Page 156 and 157:
If the string on the left is shorte
- Page 158 and 159:
Code e- e+ , - + $ ( ) space \ Gene
- Page 160 and 161:
Dim s$ Dim formats formats = Array(
- Page 162 and 163:
Type Null, uninitialized object Emp
- Page 164 and 165:
Loop MsgBox s End Sub 7.9. Conclusi
- Page 166 and 167:
Function Line Input #number, var Lo
- Page 168 and 169:
The functions ChDir and ChDrive, al
- Page 170 and 171:
ytes — K, MB, G, or T — dependi
- Page 172 and 173:
The file and directory attributes i
- Page 174 and 175:
Loop i = 0 'Start counting over for
- Page 176 and 177:
Consider storing names of different
- Page 178 and 179:
eturned. If you want to save the po
- Page 180 and 181:
The Print statement does not write
- Page 182 and 183:
Random files assume that the positi
- Page 184 and 185:
l = -2 : Put #n,,l 'FE FF FF FF REM
- Page 186 and 187:
End Sub 8.9. File and directory rel
- Page 188 and 189:
• Creating and using an OOo servi
- Page 190 and 191:
Name $(prog) $(brandbaseurl) $(user
- Page 192 and 193:
Method getFolderContents(url, bool)
- Page 194 and 195:
Dim i% ' Index variable. sStrings =
- Page 196 and 197:
Dim i As Integer Dim s$ oPipe = Cre
- Page 198 and 199:
Table 73. Return values from GetGui
- Page 200 and 201:
nBlue = Blue(nOOoColor) '101 In the
- Page 202 and 203:
9.2.1. Return an argument The IIF f
- Page 204 and 205:
Print Error() & " at line " & Erl E
- Page 206 and 207:
Shell("/home/andy/foo.ksh", 10, """
- Page 208 and 209:
Table 78. User input and output fun
- Page 210 and 211:
Table 79. Valid values for DialogTy
- Page 212 and 213:
window and four inches from the top
- Page 214 and 215:
Figure 68. Error information must b
- Page 216 and 217:
(0) = "Hello" : b(1) = "You" 'b() =
- Page 218 and 219:
3) “5:9” Five numbers from 5 to
- Page 220 and 221:
Table 83. Variable inspection funct
- Page 222 and 223:
Table 84. Variable types and names.
- Page 224 and 225:
End If s = s & " Name = " 'Leading
- Page 226 and 227:
object should be fully loaded befor
- Page 228 and 229:
10. Universal Network Objects The i
- Page 230 and 231:
You must create (or obtain) a UNO s
- Page 232 and 233:
Table 88. Methods defined by the co
- Page 234 and 235:
If iAccept = 1 Then 'What was the r
- Page 236 and 237:
Listing 209. Use HasUnoInterfaces a
- Page 238 and 239:
TIP Use Google to search for “sit
- Page 240 and 241:
Figure 72. A few properties in a Wr
- Page 242 and 243:
End Function What does the event ha
- Page 244 and 245:
TIP The primary visible windows in
- Page 246 and 247:
Listing 219. Test types supported b
- Page 248 and 249:
10.11.1. Your first listener This l
- Page 250 and 251:
The queryInterface method is from t
- Page 252 and 253:
If IsMissing(vOptionalObj) Then vOb
- Page 254 and 255:
Dim s As String 'holds the portion
- Page 256 and 257:
Three things are required to accomp
- Page 258 and 259:
Dim oModuleIdentifier As Object oMo
- Page 260 and 261:
11.1.2.3. Read source code SFX2 bas
- Page 262 and 263:
Use the getFrames() method to enume
- Page 264 and 265:
is, it isn’t possible to determin
- Page 266 and 267:
Listing 242. Demonstrate how to enu
- Page 268 and 269:
Property TemplateDate AutoloadURL A
- Page 270 and 271:
The first argument to the method Lo
- Page 272 and 273:
If IsNull(vDoc) Then Print "Failed
- Page 274 and 275:
Table 98. Valid named parameters fo
- Page 276 and 277:
to open the specified document as a
- Page 278 and 279:
e used for import or export. The Op
- Page 280 and 281:
strval = "" if cflags and &H0000000
- Page 282 and 283:
cflags = cflags-33554432 endif if c
- Page 284 and 285:
args8(4).Value = 0 args8(5).Name =
- Page 286 and 287:
12.4.7. Error handling while loadin
- Page 288 and 289:
13.2. Services and interfaces Think
- Page 290 and 291:
Table 102. Object methods defined b
- Page 292 and 293:
End Sub Sub printDocProperties(oDoc
- Page 294 and 295:
occurs — for example, when a docu
- Page 296 and 297:
master list of links. Use this retu
- Page 298 and 299:
13.8. Close a document: XCloseable
- Page 300 and 301:
Dim oGraph 'The created graphic ima
- Page 302 and 303:
Figure 83. These lines drawn in a D
- Page 304 and 305:
13.9.3. Writer Each Writer document
- Page 306 and 307:
Dim vArgs 'Media descriptor as an a
- Page 308 and 309:
13.11. Saving a document The locati
- Page 310 and 311:
TIP Although the export filter name
- Page 312 and 313:
TIP Listing 284 accesses styles by
- Page 314 and 315:
Listing 287. PrintPageInformation S
- Page 316 and 317:
Print "Style = " & ThisComponent.Cu
- Page 318 and 319:
Table 111. Locale country codes, ca
- Page 320 and 321:
Code Country Code Country NP Nepal
- Page 322 and 323:
Dim s() 'Contains the words to chec
- Page 324 and 325:
eady in OOo 3.5. Thankfully, Niklas
- Page 326 and 327:
Figure 90. Properties of the defaul
- Page 328 and 329:
REM Notice that the printer name is
- Page 330 and 331:
13.15.2. Printing Calc documents To
- Page 332 and 333:
An event is sent to the listener if
- Page 334 and 335:
TIP The very popular routine FindCr
- Page 336 and 337:
oTextFrames = oDoc.getTextFrames If
- Page 338 and 339:
Sub Print_stat(sPageNr AS String) '
- Page 340 and 341:
DIM oDoc AS Object oDoc = ThisCompo
- Page 342 and 343:
REM Print the page PrintDocWithoutB
- Page 344 and 345:
Figure 92. Some Writer document set
- Page 346 and 347:
Property PrintRightPages PrintContr
- Page 348 and 349:
Table 121. Interfaces supported by
- Page 350 and 351:
Table 123. Methods defined by the c
- Page 352 and 353:
Table 124. Properties supported by
- Page 354 and 355:
14.2.1. Paragraph properties Paragr
- Page 356 and 357:
Property ParaOrphans ParaWidows Par
- Page 358 and 359:
Insert a page break To insert a pag
- Page 360 and 361:
Property CharWeight CharPosture Cha
- Page 362 and 363:
Property CharRelief RubyText RubyAd
- Page 364 and 365:
TIP An object that supports paragra
- Page 366 and 367:
Most of the cursor movement methods
- Page 368 and 369:
Defined Method Description XTextCur
- Page 370 and 371:
REM Create a text cursor. oCursor =
- Page 372 and 373:
Cursors provide the ability to quic
- Page 374 and 375:
Table 132. Methods defined by the c
- Page 376 and 377:
Next End If End Sub 14.4.2. Selecte
- Page 378 and 379:
The macro in Listing 330 uses the s
- Page 380 and 381:
REM At this point, both characters
- Page 382 and 383:
If IsWhiteSpace(iThisChar) Then oLC
- Page 384 and 385:
Listing 335. Set all occurrences of
- Page 386 and 387:
14.5.2. Searching and replacing You
- Page 388 and 389:
Character Description + A plus sign
- Page 390 and 391:
Table 136. Content contained in a t
- Page 392 and 393:
If ThisComponent.getBookmarks().has
- Page 394 and 395:
Method getRowDescriptions() getRows
- Page 396 and 397:
getCellByPosition(), returns the ce
- Page 398 and 399:
oTable = ThisComponent.createInstan
- Page 400 and 401:
Listing 349. Place the cursor at th
- Page 402 and 403:
Field Type DatabaseNextSet Database
- Page 404 and 405:
Field Type InputUser JumpEdit Macro
- Page 406 and 407:
Field Type docinfo.ChangeDateTime d
- Page 408 and 409:
The text fields contained in the do
- Page 410 and 411:
Field Type SetExpression User Descr
- Page 412 and 413:
REM Insert some explanatory text be
- Page 414 and 415:
REM You CANNOT change the name of a
- Page 416 and 417:
sFormat=oFormat.FormatString If sFo
- Page 418 and 419:
Table 148. Constants for com.sun.st
- Page 420 and 421:
oCurs.gotoEndofParagraph(True) oDoc
- Page 422 and 423:
Listing 364. Replace text with a Ge
- Page 424 and 425:
Listing 365. Set captions and refer
- Page 426 and 427:
Table 151. Common index properties.
- Page 428 and 429:
oLevel = oIndex.LevelFormat.getByIn
- Page 430 and 431:
Array(MakeProperty("TokenType", "To
- Page 432 and 433:
Table 155. Some interfaces supporte
- Page 434 and 435:
cell name including the sheet name.
- Page 436 and 437:
Figure 96. Values returned by getTy
- Page 438 and 439:
Property AsianVerticalMode TableBor
- Page 440 and 441:
Property FormulaResultType Conditio
- Page 442 and 443:
Validation settings Sheet cells and
- Page 444 and 445:
Table 169. Methods supported by the
- Page 446 and 447:
Retrieving cells and ranges SheetCe
- Page 448 and 449:
oAddr = oAddrs(i) For nRow = oAddr.
- Page 450 and 451:
MsgBox s, 0, "Manipulating A Range"
- Page 452 and 453:
Listing 383. Merge a range of cells
- Page 454 and 455:
Figure 101. The nonempty cells are
- Page 456 and 457:
15.3.8. Clearing cells and cell ran
- Page 458 and 459:
15.3.10. Array formulas I must admi
- Page 460 and 461:
com.sun.star.sheet.FillMode.LINEAR,
- Page 462 and 463:
x = ThisComponent.Sheets(3).getUniq
- Page 464 and 465:
Property CopyOutputData OutputPosit
- Page 466 and 467:
For i = LBound(oSortDescript) To UB
- Page 468 and 469:
If oSheets.hasbyName("LinkIt") Then
- Page 470 and 471:
oSheet = ThisComponent.Sheets(3) oC
- Page 472 and 473:
Tip The removeRange(CellRangeAddres
- Page 474 and 475:
Generating the data Figure 106. Dat
- Page 476 and 477:
Next oRange = oSheet.getCellRangeBy
- Page 478 and 479:
Table 192. Methods defined by the c
- Page 480 and 481:
Property SaveOutputPosition Descrip
- Page 482 and 483:
To understand the behavior of Listi
- Page 484 and 485:
Protecting documents and sheets Cal
- Page 486 and 487:
WahooFunc = s End Function Table 20
- Page 488 and 489:
Print "Something else selected = "
- Page 490 and 491:
Paolo Mantovani posted a very nice
- Page 492 and 493:
Methods getVisibleRange() Descripti
- Page 494 and 495:
You must redraw the forms. A docume