You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by "K.Misha" <mi...@4k.com.ua> on 2013/09/25 15:31:52 UTC

Find\replace in writer

Hello!

 

What interface i need to use to find\replace text in writer documet?

Or i need to write it by hands like this:

 

      rtl::OUString uText = xText->getString();

      rtl::OString str = rtl::OUStringToOString( uText,
RTL_TEXTENCODING_MS_1251 );

      string s = str.getStr();

      int iPos = s.find("@@ADRESS_HOUSE@@");

      string s1 = "@@ADRESS_HOUSE@@";

 

      Reference<XTextCursor> xTextCursor = xText->createTextCursor();

      xTextCursor->goRight(iPos, 0);

      xTextCursor->goRight(s1.length(), 1);

      xTextCursor->setString(wVal); // wVal = "some string"

 

Thanks!


Re: Find\replace in writer

Posted by Andrew Douglas Pitonyak <an...@pitonyak.org>.
On 09/26/2013 01:20 AM, Ariel Constenla-Haile wrote:
> On Wed, Sep 25, 2013 at 04:31:52PM +0300, K.Misha wrote:
>> Hello!
>>
>>   
>>
>> What interface i need to use to find\replace text in writer documet?
> Search and Replace in text documents is described in the Developer's
> Guide:
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Navigating#Search_and_Replace
>
>
> Regards

If you are using Basic, I have examples of this in AndrewMacro as well 
as OOME (both available as downloads from my web site).

-- 
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Re: Find\replace in writer

Posted by Ariel Constenla-Haile <ar...@apache.org>.
On Wed, Sep 25, 2013 at 04:31:52PM +0300, K.Misha wrote:
> Hello!
> 
>  
> 
> What interface i need to use to find\replace text in writer documet?

Search and Replace in text documents is described in the Developer's
Guide:
http://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Navigating#Search_and_Replace


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina