22.01.2015 Views

OpenOffice.org Macros Explained - LibreOffice-NA.US

OpenOffice.org Macros Explained - LibreOffice-NA.US

OpenOffice.org Macros Explained - LibreOffice-NA.US

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

13.15.1. Printing Writer documents............................................................................325<br />

13.15.2. Printing Calc documents................................................................................327<br />

13.15.3. A Calc example with a Print listener.............................................................328<br />

13.15.4. Print examples by Vincent Van Houtte.........................................................330<br />

13.16. Creating services...................................................................................................340<br />

13.17. Document settings.................................................................................................341<br />

13.18. The coolest trick I know........................................................................................343<br />

13.19. Conclusion.............................................................................................................343<br />

14. Writer Documents...........................................................................................................344<br />

14.1. Basic building blocks..............................................................................................345<br />

14.1.1. Primary text content: the XText interface.......................................................345<br />

14.1.2. Text ranges: the XTextRange interface...........................................................346<br />

14.1.3. Inserting simple text........................................................................................348<br />

14.1.4. Text content: the TextContent service.............................................................348<br />

14.2. Enumerating paragraphs..........................................................................................350<br />

14.2.1. Paragraph properties........................................................................................351<br />

Insert a page break...................................................................................................355<br />

Set the paragraph style.............................................................................................355<br />

14.2.2. Character properties.........................................................................................356<br />

14.2.3. Enumerating text sections (paragraph portions)..............................................360<br />

14.3. Cursors....................................................................................................................362<br />

14.3.1. View cursors....................................................................................................362<br />

14.3.2. Text (non­view) cursors..................................................................................364<br />

14.3.3. Using cursors to traverse text..........................................................................365<br />

Keep the view cursor and text cursor in sync..........................................................367<br />

14.3.4. Accessing content using cursors......................................................................368<br />

14.4. Selected text............................................................................................................371<br />

14.4.1. Is text selected................................................................................................371<br />

14.4.2. Selected text: Which end is which.................................................................373<br />

14.4.3. Selected text framework..................................................................................374<br />

14.4.4. Remove empty spaces and lines: A larger example........................................375<br />

What is white space...............................................................................................375<br />

Rank characters for deletion....................................................................................376<br />

Use the standard framework....................................................................................377<br />

The worker macro....................................................................................................377<br />

14.4.5. Selected text, closing thoughts........................................................................379<br />

14.5. Search and replace...................................................................................................380<br />

14.5.1. Searching selected text or a specified range....................................................381<br />

Searching for all occurrences.......................................................................................382<br />

14.5.2. Searching and replacing..................................................................................383<br />

14.5.3. Advanced search and replace..........................................................................383<br />

vii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!