Hi

I'm working with the python api and am trying to repeat part of a document, but can't figure out how to.

Supposed I have the following in my document:

###BEGIN_MARKER###
This should be repeated 3 times
###END_MARKER###

Using the SearchDescriptor service I'm able to find the markers and I've created a TextCursor which is set to the found text:

range = text.createTextCursor()
groupLoopBegin = doc.createSearchDescriptor()
groupLoopEnd = doc.createSearchDescriptor()
groupLoopBegin.setSearchString('###BEGIN_MARKER###')
groupLoopEnd.setSearchString('###END_MARKER###')
begin = doc.findFirst(groupLoopBegin)
while begin:
    end = doc.findNext(begin.End,groupLoopEnd)
    if end:
        range.gotoRange(begin,False)
        range.gotoRange(end,True)
        # Here range contains the text to be repeated
    begin = doc.findNext(end.End,groupLoopBegin)

But how do I:

1) repeat range three times?
2) search/replace only in range?

Thanks in advance for any response...

--
peace, love & harmony
Atte

http://atte.dk       | http://myspace.com/attejensen
http://anagrammer.dk | http://modlys.dk

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to