Re: A Specific Macro with Find-Replace?
Posted: Tue Aug 01, 2017 11:07 am
So there is no duplication of effort, this same question is asked on the Ask LibO site under a different username.
User community support forum for Apache OpenOffice, LibreOffice and all the OpenOffice.org derivatives
https://forum.openoffice.org/en/forum/
Code: Select all
sub main
doc = thiscomponent
rajibando_find_and_remplace(doc.Text)
end sub
sub rajibando_find_and_remplace(T)
do
for each para in T
if T.compareRegionEnds(T, para) = 0 then
exit sub
end if
c = T.createTextCursorByRange(para.End)
c.goRight(2, True)
firstchar = mid(c.String, 3, 1)
if not isnumeric(firstchar) then
c.String = chr(10) & firstchar
exit for
end if
next para
loop
end sub
Code: Select all
firstchar = mid(c.String, 2, 1)
Edit: More simple, to stay plateform independant: Code: Select all
|