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

Find/replace a field variable?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
onmotry
Newbie
Newbie


Joined: 08 Jun 2012
Posts: 1

PostPosted: Fri Jun 08, 2012 8:06 am    Post subject: Find/replace a field variable? Reply with quote

Hello,

I have a long text (150K words) and I'd like to be able to number the occurrences of a certain word (say lambda). I would like for the nth lambda in the text to show up as "n lambda"

So basically, I want to insert an incrementing number field in front of every lambda in the text. I can't figure out how to put the field in the replace box, however. I was wondering if there's a way to do this.

Thank you!
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Fri Jun 08, 2012 8:36 am    Post subject: Reply with quote

I suspect you will need a macro or a field connected to a database.
_________________
OpenOffice 4.0.0 and LibreOffice 4.x.x on Fedora 20, Ubuntu 13.10, Windows 8.1 Preview (Triple Boot)
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Sat Jun 09, 2012 8:00 am    Post subject: Reply with quote

Here's a macro that numbers the word "the" as "(n) the".

Code:
Sub InsertNumber
oDoc = ThisComponent
n = 1
FandR = oDoc.createReplaceDescriptor
FandR.SearchString = " the "
Find = oDoc.FindFirst(FandR)
While Not isNull(Find)
 Find.String = " (" & n & ")" & Find.String
 n = n + 1
 Find = oDoc.FindNext(Find.End,FandR)
Wend 
End Sub
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 Writer 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