OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Text manipulation

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Gonzalo
Power User
Power User


Joined: 13 Apr 2004
Posts: 56

PostPosted: Wed Apr 14, 2004 6:55 am    Post subject: Text manipulation Reply with quote

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
View user's profile Send private message
Iannz
OOo Advocate
OOo Advocate


Joined: 14 Feb 2004
Posts: 494
Location: Christchurch, New Zealand

PostPosted: Wed Apr 14, 2004 5:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Thu Apr 15, 2004 8:00 am    Post subject: Reply with quote

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. Smile
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group