How to convert everything using one style to using another?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Gamepro
Propeller Head
Posts: 18
Joined: Mon Jun 14, 2010 4:11 pm

How to convert everything using one style to using another?

Post by Gamepro »

This has to be easy but I can't figure it out.

When importing my Word document, a lot of unnecessary extra styles were created and used for the same type of text. So, for example, with the hundreds of captions I have, some use a p.Caption style, some use p.Caption_1, some use p.Caption_2, etc. This messes up autonumbering and causes the hassle of keeping 5 styles up to date when I only want it formatted one way. So I want get rid of all those extra styles and make all captions simply use p.Caption. I thought upon deleting p.Caption_1, it would give me a message like "there are 18 instances of text using p.Caption_1, would you like to convert them over to another style or keep them the same?". But no, everything just stays labeled p.Caption_1.

So how do I convert everything using p.Caption_1 to using p.Caption without going through and switching them one by one?
DurtyMat
Sr. Propeller Head
Posts: 224
Joined: Wed Aug 22, 2007 8:09 am
Location: ClrH2o, Fl

Re: How to convert everything using one style to using another?

Post by DurtyMat »

find and replace.

find: <p class="Caption_1">

replace: <p class="Caption">

make sure you select: find in source code (checkbox at the bottom of the FnR pane)

select: find in all files (drop down selection)

have a topic open, click Find

when it finds one instance, select Replace in All Files

click No to the dialog window that displays

game over
Flare: I bought it ... so that means I can break it, right?
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: How to convert everything using one style to using another?

Post by LTinker68 »

DurtyMat wrote:have a topic open, click Find
Actually you'll want to click the Start button first. Once it's found one, click Find Next to find the next instance in that topic. Once you've found all the instances in that one topic, click the >> button above the Start button to go to the next topic it's found in. Unfortunately, clicking Find Next and getting to the end of the topic doesn't take you to the next topic automatically. Likewise, clicking >> takes you directly to the next topic without finishing the search of the current topic. So you click the Start button initially, then thereafter switch back and forth between Find Next and >>.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Gamepro
Propeller Head
Posts: 18
Joined: Mon Jun 14, 2010 4:11 pm

Re: How to convert everything using one style to using another?

Post by Gamepro »

Thanks a lot, it worked!
LTinker68 wrote:
DurtyMat wrote:have a topic open, click Find
Actually you'll want to click the Start button first. Once it's found one, click Find Next to find the next instance in that topic. Once you've found all the instances in that one topic, click the >> button above the Start button to go to the next topic it's found in. Unfortunately, clicking Find Next and getting to the end of the topic doesn't take you to the next topic automatically. Likewise, clicking >> takes you directly to the next topic without finishing the search of the current topic. So you click the Start button initially, then thereafter switch back and forth between Find Next and >>.
I was able to just go "Replace in all files" and it just went and automatic searched through all the topics and found them and replaced them. I put in a wildcard so I didn't have to do it for caption_1, caption_2, etc.
dmcmillan
Jr. Propeller Head
Posts: 1
Joined: Fri Jun 25, 2010 6:20 pm

Re: How to convert everything using one style to using another?

Post by dmcmillan »

New to Flare and it appears that I might be able to do what I hope to, but the example above doesn't work for my situation:

I have a number of paragraphs across all my topics using the p style (no class). Almost all of these need to be changed to the p.BodyText style from my style sheet. I need to preserve the p style (the same stylesheet is used across multiple projects), so I don't want to edit it. I tried a variation on the Find/Replace strategy using find: <p style = " ">, and replace: <p style = "BodyText"> which threw an error and didn't change anything. Any more tips on how to get this done?
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: How to convert everything using one style to using another?

Post by NorthEast »

dmcmillan wrote:New to Flare and it appears that I might be able to do what I hope to, but the example above doesn't work for my situation:

I have a number of paragraphs across all my topics using the p style (no class). Almost all of these need to be changed to the p.BodyText style from my style sheet. I need to preserve the p style (the same stylesheet is used across multiple projects), so I don't want to edit it. I tried a variation on the Find/Replace strategy using find: <p style = " ">, and replace: <p style = "BodyText"> which threw an error and didn't change anything. Any more tips on how to get this done?
Is there any reason you're searching for style = " " ; do your paragraphs include style attributes?

Also, you'd not replace it with <p style = "BodyText"> ; you're applying a class, so it would be <p class="BodyText">.


Anyway, if your paragraphs have no formatting, you should be able to search for <p> and replace with <p class="BodyText">.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: How to convert everything using one style to using another?

Post by i-tietz »

dmcmillan wrote:I have a number of paragraphs across all my topics using the p style (no class). Almost all of these need to be changed to the p.BodyText style from my style sheet. I need to preserve the p style (the same stylesheet is used across multiple projects), so I don't want to edit it. I tried a variation on the Find/Replace strategy using find: <p style = " ">, and replace: <p style = "BodyText"> which threw an error and didn't change anything. Any more tips on how to get this done?
Generally speaking: The format for "almost all" paragraphs should be the format of the ordinary <p> tag. I would assign classes to those few paragraphs that don't have that format ...
Or what reason could you have to have more exceptions than ordinary cases?
Gamepro
Propeller Head
Posts: 18
Joined: Mon Jun 14, 2010 4:11 pm

Re: How to convert everything using one style to using another?

Post by Gamepro »

i-tietz wrote:
dmcmillan wrote:I have a number of paragraphs across all my topics using the p style (no class). Almost all of these need to be changed to the p.BodyText style from my style sheet. I need to preserve the p style (the same stylesheet is used across multiple projects), so I don't want to edit it. I tried a variation on the Find/Replace strategy using find: <p style = " ">, and replace: <p style = "BodyText"> which threw an error and didn't change anything. Any more tips on how to get this done?
Generally speaking: The format for "almost all" paragraphs should be the format of the ordinary <p> tag. I would assign classes to those few paragraphs that don't have that format ...
Or what reason could you have to have more exceptions than ordinary cases?
Well I suppose if you used the same stylesheet for say, 5 projects, and in one of the projects you wanted the typical body paragraphs to be something different but every other style to remain the same, you might want to change "almost all" paragraphs in that one project to a new style.

With me though, each project is an imported word file, which means it's going to assign random styles and random numbers for everything during the import phase (latest project had over 60 paragraph styles). Unless there is some way to prevent that from happening which I don't know of, it's pretty much impossible to maintain a global stylesheet unless I find and replace basically every style.
Post Reply