Ask Your Question

How can one search & replace direct formatting with styles? [closed]

asked 2013-05-24 22:51:52 +0100

You There gravatar image

updated 2016-02-19 06:02:23 +0100

Alex Kemp gravatar image

I understand how to use Find/Replace to grab things based on text and even specific formatting conditions, as well, but not how to find specific formatting and apply an existing style. I have a number of documents that I'd like to repair the formatting in by switching them to styles.

They are consistently formatted. If I could search for a specific combination of font, text color, and size, and apply a selected style, I'd be done swiftly.

A workaround in Word would be a simple little macro in VB to apply the formatting per, but I can't get custom macros working worth a hang in LO, either, so I'm kinda stuck with doing this manually or fiddling around in the XML, which isn't going to hot... or going back to the dark side, I suppose.

Options? Thoughts?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-19 06:02:36.854741


Please, what is your LibreOffice version?

m.a.riosv gravatar imagem.a.riosv ( 2013-05-24 23:15:30 +0100 )edit

Version Why would that matter? Does 4.0.3 fix it or something?

@David: That does sound like it does what I need. Thanks. I wonder why that has yet to be folded into the program.

I gave up on OO/LO macros quite a while back. They have cost me far more time than they ever saved; It's simply not a feature until I can trust it to consistently work. I'll probably tinker with it a whit, but not seriously.

You There gravatar imageYou There ( 2013-05-25 01:43:57 +0100 )edit

Oh, and I can't vote your answer up, BTW

You There gravatar imageYou There ( 2013-05-25 03:46:26 +0100 )edit

All point releases (i.e., v4.0.1.2 > v4.0.3.3) are mainly bug fixes. You can check the details under the individual release details. I am not saying this particular issue has been addressed as I haven't looked.

oweng gravatar imageoweng ( 2013-05-25 05:02:56 +0100 )edit

@You There - Re: LO macros: it took a bit of working out for me, too. I posted one use for them here: It might help, especially if (as it sounds like) you're already familiary with macros from MS Word.

David gravatar imageDavid ( 2013-05-25 10:02:43 +0100 )edit

2 Answers

Sort by » oldest newest most voted

answered 2013-05-24 23:55:08 +0100

David gravatar image

updated 2018-09-21 00:17:21 +0100

I think you need the Alternative Find & Replace extension ("AltSearch", below). Recently I was pointed to it for a different task, and it's a very powerful tool. You will need to save it (from link above) locally, then Tools > Extension Manager... > Add > [browse to saved file, click, etc.] to install.

Once you've got it (for me, needed a LO restart; toolbar icon could be prettier! ;) ) then ... how to use it?! There is a help file (linked on the download page), and you can search AskLibo for other answers that explain it. (I had a very helpful reply about it recently which provides one good example.)

I just tried something akin to your question (I think!):

  • Fire up AltSearch.
  • In "Search for:" , choose Properties dropdown > Same format of characters (based on cursor) (= last option) > then FInd All.
  • Give it some time! (Or maybe it's just that I have an antique laptop!)
  • Once it announces the number of hits found, click in "Replace:" dropdown, choose "Paragraph style". The list of available styles will pop up.
  • Choose the one you want to apply (double click), and the line will populate.
  • Then > Replace all.
  • Give it some time! ;) (or maybe it's my antique, etc.). That should do it.

I tried it with "Hanging indent" on a 15 page (single space) document. Worked a treat.

That might not be the precise set of steps for your use case, but it's one approach that worked for me (on Linux Mint Xfce + LO 4.0.3). More expert users will hopefully be along shortly! Hope this helps in the meanwhile.

P.s. On macro recording, have you enabled it?

edit flag offensive delete link more


Installation succeeds without errors on my swedish LibreOffice but I can't find it anywhere in my menus. I've read that it should lie under the "Edit" menu but there is no extra "Ext S/R" there. Isn't this extension supposed to work on the swedish version?!

Nordlöw gravatar imageNordlöw ( 2014-01-23 13:39:23 +0100 )edit

@Nordlöw - it appears as an icon in your toolbar <-- look for the "green binoculars".

David gravatar imageDavid ( 2014-01-23 20:48:23 +0100 )edit

I don't see any such icon in my LibreOffice. Which toolbar should it lie in?

Nordlöw gravatar imageNordlöw ( 2014-01-23 22:15:38 +0100 )edit

@Nordlöw - make sure that View > Toolbars > Alternative searching has a "check".

David gravatar imageDavid ( 2014-01-24 00:15:46 +0100 )edit

Sorry, but no Alternative searching entry is shown under View > Toolbars.

Nordlöw gravatar imageNordlöw ( 2014-01-24 14:06:47 +0100 )edit

@Nordlöw - then it sounds like it has not installed properly. Your i18n or l10n version shouldn't matter at all. What is your LibO version and platform?

David gravatar imageDavid ( 2014-01-25 00:15:32 +0100 )edit

I'm using Ubuntu's 13.10's standard Version: Build ID: 410m0(Build:2). Extension manager tells me "Alternative searching 1.4" is installed.

Nordlöw gravatar imageNordlöw ( 2014-01-25 01:44:09 +0100 )edit

@Nordlöw - I use it regularly in the same setting. Beyond my competence now! The only thng I can think of is resetting the user profile (follow the "Resolving corruption" instructions) and see if that helps. It's my last idea!

David gravatar imageDavid ( 2014-01-25 12:26:33 +0100 )edit

Hi, I can't fin d the extention anymore ?! has it become obsolete ?

jbonlinea gravatar imagejbonlinea ( 2018-09-19 10:19:20 +0100 )edit

@jbonlinea - No, it's not obsolete: it's still available on the LibreOffice extensions website, which has been restructured since this answer was written. I'll update the URL in the answer itself, too.

David gravatar imageDavid ( 2018-09-21 00:13:44 +0100 )edit

answered 2014-02-02 23:32:57 +0100

jonjermey gravatar image

Unfortunately neither Find and Replace nor extended search seem capable of applying both a style and a formatting criterion at once: e.g. there is no way to find italic characters only in Level 3 headings. Until this can be done the program is going to lag seriously behind Word.

edit flag offensive delete link more


I think "lag seriously" is hyperbole since this is functionality that probably applies to less than a fraction of a percent of the user base. Would it be good to have? Sure. The related enhancement is fdo#64970.

oweng gravatar imageoweng ( 2014-02-02 23:46:07 +0100 )edit

Question Tools

1 follower


Asked: 2013-05-24 22:51:52 +0100

Seen: 5,475 times

Last updated: Sep 21 '18