- 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 12: 15.3.5. Retrieving, inserting, and
- Page 15 and 16: 2. Getting Started In OpenOffice.or
- Page 17 and 18: 2.1.3. Modules and dialogs Figure 2
- Page 19 and 20: TIP I have always renaming modules
- Page 21 and 22: Figure 8. The new library is shown
- Page 23 and 24: Figure 11. Basic Integrated Debuggi
- Page 25 and 26: Use to open the Objects catalog (se
- Page 27 and 28: Figure 13. The opened document cont
- Page 29 and 30: 2.9. Using breakpoints If you set a
- Page 31 and 32: 2.12. Conclusion Macros and dialogs
- Page 33 and 34: You should liberally add remarks, w
- Page 35 and 36: precede Option Explicit because the
- Page 37 and 38: Table 6. Examples of supported Def
- Page 39 and 40: Decimal Binary Octal Hexadecimal 13
- Page 41: CostPerDog = 100.0 / 3.0 REM Prints
- Page 45 and 46: 3.2.9. Declare variables with speci
- Page 47 and 48: Here are some specific benefits of
- Page 49 and 50: Listing 18. Demonstrate simple arra
- Page 51 and 52: The arguments passed to the Array f
- Page 53 and 54: than copying the data. All changes
- Page 55 and 56: Print "Running FirstSub" End Sub To
- Page 57 and 58: Optional arguments You can declare
- Page 59 and 60: Loop IterativeFactorial = answer En
- Page 61 and 62: Table 13. Life cycle of a variable
- Page 63 and 64: Precedence Operator Type Descriptio
- Page 65 and 66: Multiplication (*) and Division (/)
- Page 67 and 68: Figure 30. Integer division. With i
- Page 69 and 70: The bit-wise operators are all illu
- Page 71 and 72: s = s & x(i) & " OR " & y(i) & " =
- Page 73 and 74: MsgBox s, 0, "Operator IMP example"
- Page 75 and 76: TIP GoSub is a persistent remnant f
- Page 77 and 78: Print "i is less than 1" elseif i =
- Page 79 and 80: TIP The Case IS statement is differ
- Page 81 and 82: For the difficult cases, it suffice
- Page 83 and 84: [Exit Do] Block Loop You can place
- Page 85 and 86: counter = counter + step Loop The
- Page 87 and 88: Table 22. Error-related variables a
- Page 89 and 90: sub ExampleErrorResumeNext On Error
- Page 91 and 92: Listing 63. Resume next error handl
- Page 93 and 94:
Listing 65. Copy a file. Sub Exampl
- Page 95 and 96:
The mathematical functions presente
- Page 97 and 98:
COS(x) = Adjacent Leg / Hypotenuse
- Page 99 and 100:
Listing 70. Single-precision variab
- Page 101 and 102:
Logarithms were devised by John Nap
- Page 103 and 104:
"&HFFFFFFFFF",_ "&HE", "&HFE", "&HF
- Page 105 and 106:
s = s & CSng(" 12 34") s = s & CHR$
- Page 107 and 108:
Print Fix("12.5") ' 12 Print Int("x
- Page 109 and 110:
Case "3" sBin = sBin & "0011" Case
- Page 111 and 112:
Dim s As String Dim n As Long Dim n
- Page 113 and 114:
5. Array Routines This chapter intr
- Page 115 and 116:
Table 32. A Variant can contain an
- Page 117 and 118:
5.3. Change the dimension of an arr
- Page 119 and 120:
Join(Array(1, 2, 3), "") '123 speci
- Page 121 and 122:
iCurDim = 1 'Ready to check the fir
- Page 123 and 124:
6. Date Routines This chapter intro
- Page 125 and 126:
contains only 28 days. The same val
- Page 127 and 128:
• ISO 8601 is easily comparable a
- Page 129 and 130:
Purely invalid dates generate an er
- Page 131 and 132:
"12/28/1899 00:00:00", "12/28/1899
- Page 133 and 134:
Listing 108. Use DatePart to extrac
- Page 135 and 136:
Use FormatDateTime to display the d
- Page 137 and 138:
i = i + 3 Loop MsgBox s Exit Sub OO
- Page 139 and 140:
TIP The Timer function returns the
- Page 141 and 142:
Dim nLoopTicks As Long Dim nGCD_1_T
- Page 143 and 144:
It’s easy to find the first day o
- Page 145 and 146:
Function Replace(strng, find, rpl,
- Page 147 and 148:
Hex DEC Symbol Description 0E 14 SO
- Page 149 and 150:
This will show the characters used
- Page 151 and 152:
Listing 124. Demonstrate UCase and
- Page 153 and 154:
Print InStrRev("CBAABC", "b", -1, 1
- Page 155 and 156:
Else 'Replace somewhere in the midd
- Page 157 and 158:
Figure 53. RSet and LSet justify st
- Page 159 and 160:
Format specifiers related to date a
- Page 161 and 162:
Other string format specifiers used
- Page 163 and 164:
Listing 145. using the TextSearch s
- Page 165 and 166:
8. File Routines This chapter intro
- Page 167 and 168:
Special characters, such as the spa
- Page 169 and 170:
Table 59. File and directory attrib
- Page 171 and 172:
Figure 56. You can learn a lot abou
- Page 173 and 174:
Each file and directory has an attr
- Page 175 and 176:
file. The Open statement is used to
- Page 177 and 178:
8.7. Information about open files O
- Page 179 and 180:
The macro in Listing 156 opens a fi
- Page 181 and 182:
Listing 158. Use Input to read text
- Page 183 and 184:
Type Bytes Comment String Len(s) Ea
- Page 185 and 186:
This is the primary reason why the
- Page 187 and 188:
RmOOMEWorkDir() = NOT FileExists(s)
- Page 189 and 190:
For i = LBound( aProperties ) To UB
- Page 191 and 192:
Dim oPathSub Dim s$ Dim sTemp$ ' Pa
- Page 193 and 194:
Method Stream Description readFloat
- Page 195 and 196:
s = s & " : OK " End If s = s & "("
- Page 197 and 198:
9. Miscellaneous Routines This chap
- Page 199 and 200:
Twips are the standard on which all
- Page 201 and 202:
Table 74. Color representation in O
- Page 203 and 204:
End Function Function f2$ Print "I
- Page 205 and 206:
Dim strIn As String Dim strOut As S
- Page 207 and 208:
Listing 177. Use DDE as a Calc func
- Page 209 and 210:
For i=0 To 10 Print "In the loop, i
- Page 211 and 212:
In other words, if you want the mac
- Page 213 and 214:
Function Erl Err Error Error(error_
- Page 215 and 216:
Print Cbool("Truee") 'run-time erro
- Page 217 and 218:
aProp1 = CreateObject("com.sun.star
- Page 219 and 220:
Figure 69. Partition shows the inte
- Page 221 and 222:
Listing 194. IsNumeric is very pick
- Page 223 and 224:
BASIC VarType TypeName Len Descript
- Page 225 and 226:
Dim ss$ ta() = Array(i, l, f, d, c,
- Page 227 and 228:
widthToUse = GetDialogZoomFactorX(i
- Page 229 and 230:
Table 87. Functions related to Univ
- Page 231 and 232:
Print "Person = " & x.FirstName & "
- Page 233 and 234:
service. The XWordCursor interface
- Page 235 and 236:
Listing 207. View context element n
- Page 237 and 238:
Listing 210. Verify that the docume
- Page 239 and 240:
s = aInfo(UBound(aInfo())) 'Grab th
- Page 241 and 242:
Dim vObj vObj = ThisComponent Print
- Page 243 and 244:
s = "" 'Clear string, start over En
- Page 245 and 246:
vMod = BasicLibraries.getByName(vLi
- Page 247 and 248:
If NOT (oTst IS ThisComponent) Then
- Page 249 and 250:
6) Create the UNO listener and save
- Page 251 and 252:
' removes the listener vSelChangeBr
- Page 253 and 254:
Listing 228. Return type informatio
- Page 255 and 256:
11. The Dispatcher This chapter bui
- Page 257 and 258:
TIP You cannot call a routine in a
- Page 259 and 260:
oSheets.getCellByPosition(4, i+1, n
- Page 261 and 262:
12. StarDesktop The desktop acts as
- Page 263 and 264:
defined in the XFrames interface. T
- Page 265 and 266:
any listener says no, then OOo will
- Page 267 and 268:
Listing 243. ThisComponent referenc
- Page 269 and 270:
The code in Listing 246 shows one o
- Page 271 and 272:
Dim sURL As String 'URL of the docu
- Page 273 and 274:
Dim s As String 'Display string REM
- Page 275 and 276:
Parameter ReadOnly Referer RepairPa
- Page 277 and 278:
# Name Description list are not exe
- Page 279 and 280:
sPropNames(fpCol) = oProp.Name End
- Page 281 and 282:
endif if cflags and &H00002000 then
- Page 283 and 284:
em --------------------------------
- Page 285 and 286:
args(1).Name = "FilterOptions" args
- Page 287 and 288:
13. Generic Document Methods OpenOf
- Page 289 and 290:
com.sun.star.lang.XEventListener co
- Page 291 and 292:
MsgBox s, 0, "Properties" s = "" En
- Page 293 and 294:
MsgBox s, 0, "Document Statistics"
- Page 295 and 296:
Figure 81. Events supported by This
- Page 297 and 298:
You can use jump marks (link target
- Page 299 and 300:
13.9. Draw Pages: XDrawPagesSupplie
- Page 301 and 302:
oGraph.SetSize(oNewSize) oGraph.Set
- Page 303 and 304:
• Symmetric Arrow In testing, the
- Page 305 and 306:
13.10. The model Figure 85. These l
- Page 307 and 308:
getArgs() object method. The OOo AP
- Page 309 and 310:
TIP The method storeAsURL() is simi
- Page 311 and 312:
oStyleNames = oStyles.getElementNam
- Page 313 and 314:
com.sun.star.sheet.TablePageStyle b
- Page 315 and 316:
Dim v REM Cursor's coordinates rela
- Page 317 and 318:
Code Language Code Language Code La
- Page 319 and 320:
Code Country Code Country FI Finlan
- Page 321 and 322:
Code Country Code Country GB United
- Page 323 and 324:
'******Thesaurus Example! Dim vThes
- Page 325 and 326:
Listing 292. Display printer proper
- Page 327 and 328:
ThisComponent.print(Props()) When a
- Page 329 and 330:
Dim s$ 'Display string If HasUnoInt
- Page 331 and 332:
Dim oRanges(1) As New com.sun.star.
- Page 333 and 334:
End Select REM Remove the listener
- Page 335 and 336:
oFrameDT = oDoc.createInstance("com
- Page 337 and 338:
' but that you want to show up when
- Page 339 and 340:
REM Set backgroundImage-option in D
- Page 341 and 342:
Sub closeDocument(oDoc AS Object) '
- Page 343 and 344:
13.16. Creating services An object
- Page 345 and 346:
Property PrinterSetup IsKernAsianPu
- Page 347 and 348:
14. Writer Documents Writer documen
- Page 349 and 350:
Table 122. Methods defined by the c
- Page 351 and 352:
method and related methods, because
- Page 353 and 354:
Listing 310. Clear the entire docum
- Page 355 and 356:
Property ParaExpandSingleWord ParaL
- Page 357 and 358:
Property ParaIsAutoFirstLineIndent
- Page 359 and 360:
14.2.2. Character properties Paragr
- Page 361 and 362:
Property CharCrossedOut CharFlash C
- Page 363 and 364:
TIP When a property supports a DONT
- Page 365 and 366:
oParEnum = ThisComponent.Text.creat
- Page 367 and 368:
REM Get the view cursor from the cu
- Page 369 and 370:
Do While oCursor.gotoNextParagraph(
- Page 371 and 372:
REM You require a text cursor so th
- Page 373 and 374:
Do While oEnum.hasMoreElements() v
- Page 375 and 376:
Listing 326. Determine if anything
- Page 377 and 378:
14.4.3. Selected text framework Whi
- Page 379 and 380:
Listing 331. Determine if a charact
- Page 381 and 382:
A text range (cursor) may contain t
- Page 383 and 384:
TIP To count words correctly, visit
- Page 385 and 386:
Searching for all occurrences It is
- Page 387 and 388:
Listing 339. Replace bold text. Sub
- Page 389 and 390:
Character Description ( ) Text plac
- Page 391 and 392:
Figure 93. Tables contained in a do
- Page 393 and 394:
document was designed so that the t
- Page 395 and 396:
Property RepeatHeadline Description
- Page 397 and 398:
Table 141. Methods defined by the c
- Page 399 and 400:
Table 142. Methods defined by the c
- Page 401 and 402:
14.8. Text fields A text field is t
- Page 403 and 404:
Field Type FileName GetExpression G
- Page 405 and 406:
Field Type SetExpression TableCount
- Page 407 and 408:
Table 144 contains the valid values
- Page 409 and 410:
14.8.1. Text master fields Some tex
- Page 411 and 412:
Next I REM Directly obtain a master
- Page 413 and 414:
Listing 355. Insert field master. S
- Page 415 and 416:
14.10. Sequence fields, references,
- Page 417 and 418:
formatNum = oFormats.addNew(sFormat
- Page 419 and 420:
' Create the master field if needed
- Page 421 and 422:
Table 149. Constants for com.sun.st
- Page 423 and 424:
n = 0 oFound = oDoc.findFirst(oDesc
- Page 425 and 426:
Listing 366. Insert a standard TOC
- Page 427 and 428:
Table 153. Supported TokenType valu
- Page 429 and 430:
While creating a TOC manually, the
- Page 431 and 432:
15. Calc Documents The primary purp
- Page 433 and 434:
Dim oSheets 'The sheets object that
- Page 435 and 436:
Tip When setting a cell’s formula
- Page 437 and 438:
Property Description VerticalLine L
- Page 439 and 440:
Although setting attributes is gene
- Page 441 and 442:
eturned by getAnnotations() also su
- Page 443 and 444:
Table 167. Conditions defined by th
- Page 445 and 446:
Conditional formatting Conditional
- Page 447 and 448:
Table 172. Methods to query a cell
- Page 449 and 450:
com.sun.star.sheet.CellFlags.STRING
- Page 451 and 452:
and column E is similar to column B
- Page 453 and 454:
Table 174. Individual row and colum
- Page 455 and 456:
Sheet cell ranges also provide the
- Page 457 and 458:
Table 177. The com.sun.star.sheet.F
- Page 459 and 460:
oRange = oSheet.getCellRangeByName(
- Page 461 and 462:
oColCell = oSheet.getCellByPosition
- Page 463 and 464:
Table 182. The com.sun.star.table.T
- Page 465 and 466:
REM Sort on the third field in the
- Page 467 and 468:
Interfaces com.sun.star.sheet.XShee
- Page 469 and 470:
REM Insert the new sheet at the end
- Page 471 and 472:
Table 190. Methods supported by the
- Page 473 and 474:
Data pilot tables The DataPilot is
- Page 475 and 476:
Listing 401. CreateDataPilotSource
- Page 477 and 478:
oCellAddress.Sheet = oRangeAddress.
- Page 479 and 480:
Table 194. Values defined by the co
- Page 481 and 482:
Component com.sun.star.sheet.XUsedA
- Page 483 and 484:
Table 201. Constants defined by the
- Page 485 and 486:
Listing 405. GoalSeekExample is in
- Page 487 and 488:
Using the current controller Each O
- Page 489 and 490:
For i = 0 To oRanges.getCount() - 1
- Page 491 and 492:
Dim oOldSelection 'The original sel
- Page 493 and 494:
Table 207. Properties supported by
- Page 495:
Conclusion Calc documents are featu