I wrote this blog about how to rename styles in your current document to match the style names in a different template or document, then import styles from that different template or document to update the definitions.
Now, that's a reasonable approach. More or less. Renaming can be useful also if you just realize, d'oh! you really should be renaming things something like Directive_Heading, Directive_Text, rather than Textfordirectives and headingtouseindirectives. It's nice to have all the styles you use together sorted together alphabetically.
But unfortunately the Nancy Drew in me is sometimes drawn more toward hacks than to regular ol' features already there in the software.
Felipe wrote to that post and said "Is there a way to search and replace styles?"
And I slapped myself on the forehead and said, "Well, yes, that feature DOES exist and that would, OK, be a perfectly reasonable way to deal with replacing one style with another."
So here's the scenario.
You have a wonderful document with great styles.
But then Bob the Annoying Boss comes along and says "You need to use THIS template with THESE styles."
If all the names of the styles were the same you could just import the styles and be done with it. BUT the styles in the template are DIFFERENT so it's not that simple.
What do you do?
Follow the instructions in this blog if you want to try that approach to rename the styles in your document to match the ones in the template.
Or just search for your style names, and replace them with the style names from the template.
Here's how to do the second one.
Step 1: Import styles from the new template
Open your document.
Choose Format > Styles and Formatting.
Click and hold down on the far right icon and choose Load Styles.
In the next window, mark all the checkboxes and click From File.
Find the file with the styles you need to use and click Open.
That document's styles will show up in your Styles and Formatting window.
Step 2: Search for Your Styles and Replace With the New Styles
Be sure you're in your document.
Choose Edit > Find and Replace or just press Ctrl F.
In the Find and Replace window, click More Options and select only the Search for Styles item. NOTE: An alert reader, Julian, has this warning. "The option
to search for styles disappears if you have specified some formatting in one of the search
or replace boxes. Clicking No Format brings it back."
In the first dropdown list, select the style in your document, and in the other dropdown list, select the style you just imported that you want to replace the existing style with.
Click Find, then Replace as appropriate. Or if you're feeling confident, click Replace All.
Repeat for each style you need to replace.
You'll see that the old styles have been replaced by the new styles. (In this illustration, the style ChapterTitle used to be applied, and it looked like the style illustrated near the top of this blog.)
Useful webpage, however it would be handy if you mentioned what version of openoffice you were using. The Find and Replace box on mine (2.0.4) looks quite different with, alas, no search for styles option.
Posted by: Julian | December 11, 2006 at 10:52 AM
Having explored the problem some more I see that I made a mistake. My version of openoffice does have search for styles, however the option disappears if you have specified some formatting in one of the search or replace boxes. Clicking No Format brings it back.
Posted by: Julian | December 11, 2006 at 11:16 AM
Hi Julian,
Thanks for the tip about the formatting! I will add that to the blog.
Solveig
Posted by: Solveig Haugland | December 11, 2006 at 11:36 AM
Hi, this is really great - however I found this when looking for a way to _select_ all the objects in a drawing which has a specific style applied. Do you know of a way to do this?
Example in oodraw: I open Styles and formatting (F11) and then right click a particular style and there should be a menu entry "select objects". Using that should be the same as selecting using the mouse the objects which have this style applied. This would be very useful - one could use styles as "layers" (and gnuplot produced material would be much easier to edit).
Posted by: Peter | November 07, 2007 at 02:43 PM
That would be a great feature, Peter, but I don't think there's a way to do it. That would be huge for workin' fast, though.
Solveig
Posted by: Solveig | November 07, 2007 at 06:38 PM