Applying a template to an existing document

Everything related to our flagship word processor.
Post Reply
vwnisus
Posts: 31
Joined: 2016-04-24 00:13:31

Applying a template to an existing document

Post by vwnisus » 2019-04-21 00:29:49

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)?

User avatar
phspaelti
Posts: 1015
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Applying a template to an existing document

Post by phspaelti » 2019-04-21 01:07:07

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.
philip

vwnisus
Posts: 31
Joined: 2016-04-24 00:13:31

Re: Applying a template to an existing document

Post by vwnisus » 2019-04-21 01:55:44

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...

User avatar
phspaelti
Posts: 1015
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Applying a template to an existing document

Post by phspaelti » 2019-04-21 06:50:45

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
philip

ToddO
Posts: 33
Joined: 2015-10-18 14:25:32

Re: Applying a template to an existing document

Post by ToddO » 2019-04-28 05:10:31

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.

Post Reply