Part of Nobumi Iyanaga's website. n-iyanag@ppp.bekkoame.ne.jp. 10/17/04.

logo picture

Add styles to paragraphs of same style values: Nisus Writer Express v. 2.0.x

When you import Classic Nisus files to Nisus Writer Express 2.0.1, paragraph style settings, such as tabs, indents, justifications, etc., are generally preserved, but the style names (or paragraph names) seem most often to get lost. This is an important loss, especially if you have edited your original files with style/paragraph names, in a well organized way.

You can easily create new styles in NWE using "Insert -> New Style -> Based On Selection".  If for example your original file had a paragraph style named "Prose" and another paragraph style named "Poetry", you can duplicate these styles in NWE -- but the problem is that you will have to assign these style names to each paragraph manually. This is not practical at all. So, I wrote a macro (s Perl script) which assigns a style name to every paragraph of the same style attributes, if that style is defined in the style sheet.

I should give a clearer example:
Say that I have a paragraph style named "Prose", which would be something like this:

   Some text goes here so you can see what your style will look like.
Some text goes here so you can see what your style  will   look like.
Some text goes here so you can see what your style  will   look   like.

I have another style named "Poetry":

The quick brown fox jumped over the lazy dogs.
The quick brown fox jumped over the lazy dogs.

You file is composed of paragraphs of these two styles, but they are not named, so that any change in the style sheet will not have effect on your paragraphs...

Put this macro in your /Users/[your_account]/Library/Application Support/Nisus Writer/Macros folder; you can run the macro from NWE Macro menu, under the menu-item named "add_parag_styles".

Here is how this macro is supposed to work:

1. It reads the rtf raw code of a file, and analyzes the style sheet; it gets each style's id, name and value (settings);
2. It searches in the body text part of the rtf code for paragraphs which have the same settings as each of the styles defined in the style sheet, but which have not that style name (id in the rtf code), and adds to these paragraphs the corresponding style name (id).
3. It creates a new file in the tmp directory, with the new rtf code, and opens it with NWE.

In fact, you can do the same thing in NWE using a built-in feature (I learned this from Charles Jolley of Nisus Software):

1. Choose a paragraph with the formatting you want and create a new style using Insert-> New Style -> Based on Selection.
2. Edit the name of your new style and press return. Switch back to page/draft view.
3. Choose the paragraph with the formatting you want again and click on the ruler icon at the bottom of the window (it's called a "tag").
4. Choose "Select All" from the menu. This will select all text in your document with the same ruler settings.
5. Apply your new style.

The only difference with my macro is that it works at once for all the defined styles.


Please download the macro from this link (1K to download).


Go to Nisus Macros and Nisus/Frontier combo page
Go to NI Home Page


Mail to Nobumi Iyanaga


frontierlogo picture

This page was last built with Frontier on a Macintosh on Sun, Oct 17, 2004 at 9:49:11 PM. Thanks for checking it out! Nobumi Iyanaga