incubator-ooo-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johnny Rosenberg <gurus.knu...@gmail.com>
Subject Re: Macro or its equivalent to replace double spaces with single space.
Date Tue, 17 Jul 2012 17:39:18 GMT
2012/7/17 Rory O'Farrell <ofarrwrk@iol.ie>:
> On Tue, 17 Jul 2012 13:06:30 -0400
> Doug <dmcgarrett@optonline.net> wrote:
>
>> On 07/17/2012 07:06 AM, Rory O'Farrell wrote:
>> > On Tue, 17 Jul 2012 12:47:01 +0200
>> > Johnny Rosenberg<gurus.knugum@gmail.com>  wrote:
>> >
>> >> 2012/7/17 Srinivasulu Bhattaram<bhattarams@gmail.com>:
>> >>> I am new to Open Office.
>> >>> InWORD 2003 (and also in WORD 2007),
>> >>> I have craeted macros to remove double spaces with single spaces and
used
>> >>> them extensively..
>> >>> How to have an equivalent of it in Open Office writer?
>> >>>
>> >>> I do not want to go through   Find    Replace.... kind of thing.
>> >>> seena
>> >> What about letting a macro do the search and replace for you?
>> >>
>> >> I just wrote this one, with inspiration from ”Useful Macro Information
>> >> For OpenOffice.org By Andrew Pitonyak”, which is a PDF that you can
>> >> download somewhere:
>> >>
>> >> REM  *****  BASIC  *****
>> >>
>> >> Sub RemoveRedundantSpaces
>> >>    Dim oReplace as object
>> >>    oReplace = ThisComponent.createReplaceDescriptor()
>> >>
>> >>    With oReplace
>> >>            .SearchString = "  "
>> >>            .ReplaceString = " "
>> >>    End With
>> >>
>> >>    While ThisComponent.ReplaceAll(oReplace)>0
>> >>    Wend
>> >> End Sub
>> >>
>> >>
>> >> This macro also takes care of tripple spaces and… well, it just
>> >> removes all spaces until there are only single spaces left. And it is
>> >> fast. Really fast.
>> >> I tested it myself, and it worked in all my test cases. Well, I didn't
>> >> test it THAT thoroughly, but still…
>> >>
>> >> Much better than using the crappy macro recorder anyway. And shorter…
>> >>
>> >> If you write the documents yourself, there is a simple way to prevent
>> >> double spaces in the first place, something like:
>> >> Tools → Options for auto correction… → Click the Options tab → ☒
>> >> Ignore double spaces
>> >>
>> >> You can still make double spaces if you really want to, but it's less
>> >> likely to happen accidently.
>> >>
>> >>
>> >> Kind regards
>> >>
>> >> Johnny Rosenberg
>> >> ジョニー・ローゼンバーグ
>> >>
>> > Or why not use the Language Tool extension, which will flag double spaces as
you type with a blue wiggly underline?
>> >
>> That wouldn't help with text that is already written, that you're
>> editing.  --doug
>
> When I have redundant double spaces, I use Find and Replace to search for them and replace
them.  Quick and simple - no need for any macros.
>
> --
> Rory O'Farrell <ofarrwrk@iol.ie>

Yes, but that was not the question. The OP wrote, in the first post in
this thread: ”I do not want to go through   Find    Replace.... kind
of thing.”


Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ

---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Mime
View raw message