OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Editing Text Documents 102<br />
Cursor.gotoEndOfWord(True)<br />
Cursor.String = "Ups"<br />
Proceed = Cursor.gotoNextSentence(False)<br />
Cursor.gotoNextWord(False)<br />
Loop While Proceed<br />
If the TextCursor contains a highlighted area, an assignment to the String property<br />
replaces this with the new text. If there is no highlighted area, the text is inserted at the<br />
present TextCursor position.<br />
Inserting Control Codes<br />
In some situations, it is not the actual text of a document, but rather its structure that<br />
needs modifying. <strong>OpenOffice</strong>.<strong>org</strong> provides control codes for this purpose. These are<br />
inserted in the text and influence its structure. The control codes are defined in the<br />
com.sun.star.text.ControlCharacter<br />
group of constants. The following control codes are available in <strong>OpenOffice</strong>.<strong>org</strong>:<br />
PARAGRAPH_BREAK<br />
paragraph break.<br />
LINE_BREAK<br />
line break within a paragraph.<br />
SOFT_HYPHEN<br />
possible point for syllabification.<br />
HARD_HYPHEN<br />
obligatory point for syllabification.<br />
HARD_SPACE<br />
protected space that is not spread out or compressed in justified text.<br />
To insert the control codes, you need not only the cursor but also the associated text<br />
document objects. The following example inserts a paragraph after the 20th character of a<br />
text:<br />
Dim Doc As Object<br />
Dim Cursor As Object<br />
Dim Proceed As Boolean<br />
Doc = StarDesktop.CurrentComponent<br />
Cursor = Doc.Text.createTextCursor<br />
Cursor.goRight(20, False)<br />
Doc.Text.insertControlCharacter(Cursor, _<br />
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)