Bulk changing paragraph styles

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
mlaird
Propeller Head
Posts: 49
Joined: Wed Feb 06, 2013 3:18 pm

Bulk changing paragraph styles

Post by mlaird »

I've imported some documents from other sources (such as FrameMaker) and have been working on tweaking various styles.

One thing that I would like to change is that several of the names for paragraph styles that were imported have turned out to be unclear. However, I don't want to go through and individually change the style associated with each paragraph.

Is it possible to automatically change all paragraphs of one style to another style? Or should I just go into the XML directly and find/replace <p class="style1" with <p class="style2" ? I'd rather not fiddle with the XML directly, if I can help it, for fear of breaking things, but I don't know another way to do what I want to do.
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: Bulk changing paragraph styles

Post by Msquared »

I would do this using Notepad++ (free), using the Find in Files feature, which allows you to do a search and replace for all files below a folder that you specify.

Many people here recommend FAR HTML (I think that's what its called), which I have installed and keep meaning to try, but haven't got round to yet! So far, I've always managed to do what I need to with Notepad++, and a small amount of care. FAR allows you to do global search and replace too, but it's specifically designed for XML syntax. Notepad++ uses regular expressions which don't cope with nested tags very well, so you need to be a bit careful. But for the example you give, where you are trying to modify the tags, rather than what is between them, Notepad++ would be just fine. But if you have to learn a new tool, then start with FAR as it will be more flexible later.

Before you make any wholesale changes, take a backup of your files! You're right to be wary of modifying the sources directly, but it is the best way to do some things.
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
NorthEast
Master Propellus Maximus
Posts: 6372
Joined: Mon Mar 05, 2007 8:33 am

Re: Bulk changing paragraph styles

Post by NorthEast »

For a simple task like this, you could just use Flare's own find/replace.

For your example, it might be better to find/replace class="style" (if the class name is unique), as including the opening <p tag will not match any variations where the class isn't the first property in the tag.
Msquared wrote:FAR allows you to do global search and replace too, but it's specifically designed for XML syntax.
FAR isn't designed for XML, it'll work with any text-based files, so you can use it with Flare topic/project files.
I use FAR frequently, and it's a great tool for find/replace jobs.

Tools that use regular expressions will do the same job, and there are plenty free ones too; although I must admit the learning curve for regular expressions has put me off trying them out properly.
mlaird
Propeller Head
Posts: 49
Joined: Wed Feb 06, 2013 3:18 pm

Re: Bulk changing paragraph styles

Post by mlaird »

Thanks for the feedback! It's good to know that for these sorts of changes, just changing the XML files directly using an editor like notepad++ is the way to go. I'll do that, as necessary.

Also, good note about backing up first! I'll make sure to do that, as well.
Post Reply