Word equivalent of text snippets

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
rodrikwade
Posts: 14
Joined: Sat May 05, 2018 5:41 pm

Word equivalent of text snippets

Unread post by rodrikwade »

Hi

Is there any equivalent for the Word output of the text snippet functionality that is available in MNL templates?

We use text snippets to reference topics containing variant copyright notices, which are then inserted into the Title 2 page in PDF output. It would convenient to be able to reproduce this in the Word output (which we are occasionally asked to provide for clients).

Regards

Rodrik
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Word equivalent of text snippets

Unread post by Tim Green »

Hi Rodrik,
Is there any equivalent for the Word output of the text snippet functionality that is available in MNL templates?
Unfortunately not, because the Word templates are regular Word files, edited in Word, and Word doesn't know anything about Help+Manual files. To emulate that in your Word templates you would need to use Word's auto text feature(for example) or one of Word's other reusable text features. That means building your "snippet" collection in Word, in parallel to Help+Manual.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
rodrikwade
Posts: 14
Joined: Sat May 05, 2018 5:41 pm

Re: Word equivalent of text snippets

Unread post by rodrikwade »

Thank you, Tim.

That what I expected but I thought I'd ask just in case.

Regards

Rodrik
Simon_Dismore
Posts: 205
Joined: Thu Jul 13, 2017 2:57 pm

Re: Word equivalent of text snippets

Unread post by Simon_Dismore »

rodrikwade wrote:We use text snippets to reference topics containing variant copyright notices, which are then inserted into the Title 2 page in PDF output. It would convenient to be able to reproduce this in the Word output (which we are occasionally asked to provide for clients).
If the copyright notices are plain text there are a couple of ways to include them.

The simplest method is to create custom variables in H+M, put the copyright notices into those variables, and then insert those variables in the output. That works for all the publishing methods. But it means that if the notices change, the variables must be updated in H&M.

Alternatively you can maintain the notices in plain text files and include them in the Word template, using INCLUDETEXT fields. Examples:

Code: Select all

{ INCLUDETEXT "c:\\path\\to\\snippet.txt" \c AnsiText \* MERGEFORMAT}
{ INCLUDETEXT "<%MYFILENAME%>" \c AnsiText \* MERGEFORMAT}
After you've published your documentation to Word, you have to update all the fields (Control<A> to select the whole document, then <F9> to update the fields). For flexibility, you can use an H+M variable to hold each file name and path rather than hard-code them into your Word template. In the example, %MYFILENAME% is set to c:\\path\\to\\snippet.txt in the H+M project. Looks like you have to use absolute paths, which may be inconvenient when you send the published version to your client. The \* MERGEFORMAT option ensures your template formatting will be preserved, otherwise you may see a monospaced code font instead. If this happens when you edit your template, change the affected text to +Body font. You can find more details in this explanation on Stack Exchange.

I prefer the simple method myself, unless you have a lot of document automation to do. :?
rodrikwade
Posts: 14
Joined: Sat May 05, 2018 5:41 pm

Re: Word equivalent of text snippets

Unread post by rodrikwade »

Hi Simon

Thank you for the advice. When setting up the MNL template, I used the snippet approach rather than text variables because the copyright notice has paragraphs and I haven't been able to figure how to include a carriage return in a text variable. Setting up a new project in Russian then involves simply changing the reference from Sn-Legal-Notice-en.xml to Sn-Legal-Notice-ru.xml (both of which are located in the repository).

In any case, I think that the simplest approach for the Word output is just to create two templates (English and Russian) with the appropriate notices on the reverse of the title page.

Regards
Simon_Dismore
Posts: 205
Joined: Thu Jul 13, 2017 2:57 pm

Re: Word equivalent of text snippets

Unread post by Simon_Dismore »

rodrikwade wrote:Is there any equivalent for the Word output of the text snippet functionality that is available in MNL templates?
Tim Green wrote:Hi Rodrik,Unfortunately not, because the Word templates are regular Word files, edited in Word, and Word doesn't know anything about Help+Manual files. To emulate that in your Word templates you would need to use Word's auto text feature(for example) or one of Word's other reusable text features. That means building your "snippet" collection in Word, in parallel to Help+Manual.
Simon_Dismore wrote:You can do this with [intricate steps to include text file contents in Word via INCLUDETEXT and H+M variable substitution]
later...
rodrikwade wrote:I used the snippet approach rather than text variables because the copyright notice has paragraphs and I haven't been able to figure how to include a carriage return in a text variable.
Perhaps you should get Ошибка XY (the XY problem) clear in your head before posting another question like that? :frustration:
rodrikwade
Posts: 14
Joined: Sat May 05, 2018 5:41 pm

Re: Word equivalent of text snippets

Unread post by rodrikwade »

With respect, Simon, this was not a case of the XY problem.

I asked the question to which I had anticipated the answer but wanted confirmation. Tim provided this.

You then jumped in with an extended answer, which I appreciated. Perhaps I should have left it at a simple thank you but I felt your answer deserved more. In any event, I learnt something about INCLUDETEXT, which I may be able to apply elsewhere -- just not in this case.

Rodrik
Post Reply