| View previous topic :: View next topic |
| Author |
Message |
Gonzalo Power User

Joined: 13 Apr 2004 Posts: 56
|
Posted: Wed Apr 14, 2004 6:55 am Post subject: Text manipulation |
|
|
Hi, i'm trying to make a dialog that wotks like a spellchecker.
What i did until now is to search errors in the text, going word by word until antoher cursor that is in the end of the text. When i find an error, i show the word and the possibilities in a listbox using a dialog. If i select a word and press a button "replace" i call another macro to do something. This macro have to replace the word i found with the selected from the listbox. I can get the word selected from the list box but i don't know how to replace the word from the document with the selected one.
Can anybody help me, please?
Thanks |
|
| Back to top |
|
 |
Iannz OOo Advocate

Joined: 14 Feb 2004 Posts: 494 Location: Christchurch, New Zealand
|
Posted: Wed Apr 14, 2004 5:58 pm Post subject: |
|
|
In the following, I assume that you have a variable called oFound that points to a textCursor object and that the textCursor object currently points to the piece of text that you wish to replace. sReplace is the variable containing the desired replacement word.
In OOo BASIC use | Code: | | oFound.string = sReplace |
In other languages use | Code: | | oFound.setString(sReplace) |
If this doesn't help then post the relevant code portion. _________________ Cheers, Ian
http://wiki.services.openoffice.org/wiki/Extensions_development_basic a wiki about writing OpenOffice.org extensions. |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Thu Apr 15, 2004 8:00 am Post subject: |
|
|
| Iannz wrote: | In OOo BASIC use | Code: | | oFound.string = sReplace |
In other languages use | Code: | | oFound.setString(sReplace) |
|
Since the
oFound.setString( ... )
works in any language, including OOo Basic, that is my preferred style. Why use any other style? One syntax to rule them all, and in the darkness.... oh, nevermind.  _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
|