Page 1 of 1

Applying a template to an existing document

Posted: 2019-04-21 00:29:49
by vwnisus
Is it still the case there is no direct way of apply a template to an existing document, as it appears from the posting:
https://nisus.com/forum/viewtopic.php?f ... 631#p25668.

What I wish to do:

1. open a Nisus Writer Pro file;
2. apply an existing template to that open file (not only paragraph styles but also margin settings etc)?

Re: Applying a template to an existing document

Posted: 2019-04-21 01:07:07
by phspaelti
It's true that you can't apply a template to an existing file. And while you can easily replace the style sheet of an existing file, you can only change the margins etc. by hand through the settings in the palette.

On the other hand what you can do easily is import a document into a (template-based) new file, which would have the same effect — especially if you save the result over the original file. It should also be possible to write a macro to do this.

Re: Applying a template to an existing document

Posted: 2019-04-21 01:55:44
by vwnisus
Philip,

Thank you for confirming that it is not possible to directly apply an existing file.

Importing a document into a new file does have the same effect (and saving over the original file), but does not a few extra steps.

I am sure a Nisus Writer Pro macro would solve the problem...

Re: Applying a template to an existing document

Posted: 2019-04-21 06:50:45
by phspaelti
vwnisus wrote: 2019-04-21 01:55:44 I am sure a Nisus Writer Pro macro would solve the problem...
Not sure this is the best solution, but …

Code: Select all

# Save Current File With Template
$doc = Document.active
$docPath = $doc.filepath
$dmPath = User Property “document manager folder path”
$templatePath = $dmPath.filePathByAppendingComponent "MyTemplate.dot"
New $templatePath
$newDoc = Document.active
$newDoc.text.insertAtIndex 0, $doc.text
$doc.close
Save As $docPath

Re: Applying a template to an existing document

Posted: 2019-04-28 05:10:31
by ToddO
I use the Styles Library for this. Insert > New Style > Import From Style Library . . .

Rather than using templates, I save all my styles there to different sets with different looks. Then can just overwrite the styles in my current document with the look I select. Much better than jostling all those template files.