transforming paragraph style to pagebreak
Page 1 of 1

Author:  janklug [ 2014-05-11 03:36:39 ]
Post subject:  transforming paragraph style to pagebreak


I'm having some problems with my workflow: writing in Scrivener, exporting as .fodt, finishing up in Nisus Writer Pro.
One of the issues is that pagebreaks in Scrivener are translated to a paragraph style containing a horizontal line in Nisus Writer (happens because the .fodt export assumes that pagebreaks are not necessary for webpages..)

Anyway, I was hoping to be able to write a macro that 1) finds all the occurrences of the paragraph style called 'Horizontal Line', and 2) replaces these with a pagebreak...
Unfortunately, I'm just getting started with macros, and my time until submission deadline shrinks, so I was wondering if anybody had a tip to help me getting started!



Author:  phspaelti [ 2014-05-12 04:52:35 ]
Post subject:  Re: transforming paragraph style to pagebreak

The quickest way to do this is not with a macro at all. Use "Find and Replace".
  1. Open the Find dialog
  2. In the Find box enter either (a) "Special characters > Return" or (b) "Special positions > End of Paragraph" depending on the desired result
  3. Apply the "Horizontal Line" style to the Find box. Make sure "Attribute sensitive" is now clicked.
  4. Move to the Replace box. Enter a page break.
  5. Do "Replace All"

If you want, you can use "Macroize" to save this as a macro, for later reuse.

Author:  janklug [ 2014-05-12 11:06:23 ]
Post subject:  Re: transforming paragraph style to pagebreak

Thanks a lot!

The find-and-replace works well; the macrioze-version unfortunately not.

This is what I get from the 'copy to clipboard' macroization:
Find and Replace '(End of Paragraph)', '(Page Break)', 'eauU'

The 'Horizontal Line' attribute is somehow not included, so all 'end of paragraph's are replaced...


Author:  phspaelti [ 2014-05-12 14:20:58 ]
Post subject:  Re: transforming paragraph style to pagebreak

Yeah, that's the usual problem.
Apparently Nisus' "Macroize" feature doesn't transfer the necessary styles automatically. You'll have to copy the "Horizontal Line" style into the macro file and make sure it is applied to the relevant "Find and Replace" line of the macro. Even then the macro version may give you problems, depending on the attribute settings of the styles in either the macro file or the file where you are trying to run the macro. This is one area where the WYSIWYG nature of Nisus' interface is really not ideal.

Author:  janklug [ 2014-05-12 14:43:30 ]
Post subject:  Re: transforming paragraph style to pagebreak

thank for the quick reply!
indeed I run into problems (although it's great to be able do do this; didn't expect that Nisus can do so many tricks!).

Problem seems to be that if I apply the 'Horizontal Style" to the search string, it is also applied to the replace string, which means that it places horizontal lines in the text after deleting them... But the page breaks are inserted!



Author:  phspaelti [ 2014-05-12 15:53:21 ]
Post subject:  Re: transforming paragraph style to pagebreak

Speaking of tricks that Nisus can do, here's a different approach:

$doc =
$hlStyle = $doc.styleWithName 'Horizontal Line'
Select Document Start
While Find Next $hlStyle, '-W'
    Insert:Page Break

Author:  janklug [ 2014-05-13 10:43:24 ]
Post subject:  Re: transforming paragraph style to pagebreak

fantastic, that works!
a bit strange is that still Horizontal Lines are there after the Macro did its thing, but that was easily solved by changing the 'Horizontal Line' style to a style without a horizontal line ;)

Thanks a lot,


Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group