[Office Template] Creating custom fields in a Word document

[Office Template] Creating custom fields in a Word document

  
Forge Component
(22)
Published on 2014-01-03 by Paulo Garrudo
22 votes
Published on 2014-01-03 by Paulo Garrudo
Hi All

I am having some issues on creating the fields that I would like to change in my word document. When I run my 'print' functionality and use the OfficeTemplate Word_FillMergeFields action I am not seeing anything on the output word document, i.e. my document is blank, except for my table layouts.

I am creating the fields in Word by going to Properties -> Custom and entering new properties, i.e.

Name: RequestNumber
Type: Text
Value: APR

In the attached document from the ProjectStatus.Template.docx (from the supplied Template_Example.oml) the fields have a leading '<<' and trailing '>>' around the field, or part of it. So, is there a specific format for creating custom fields in the Word document? Or, is there something that we need to set again the document?

Thanks for your help.

Greg Price wrote:
Hi All

I am having some issues on creating the fields that I would like to change in my word document. When I run my 'print' functionality and use the OfficeTemplate Word_FillMergeFields action I am not seeing anything on the output word document, i.e. my document is blank, except for my table layouts.

I am creating the fields in Word by going to Properties -> Custom and entering new properties, i.e.

Name: RequestNumber
Type: Text
Value: APR

In the attached document from the ProjectStatus.Template.docx (from the supplied Template_Example.oml) the fields have a leading '<<' and trailing '>>' around the field, or part of it. So, is there a specific format for creating custom fields in the Word document? Or, is there something that we need to set again the document?

Thanks for your help.
 
 Ok, so after much trial and error, the solution is: when creating custom properties in Word, do the following:

1. Go to where your would like to place your field and hold down CTRL + F9 to insert a field - this will create the opening and closing brackets, '{}'.
2. Type the following: 'MERGEFIELD X \* MERGEFORMAT' Inside the brackets. For example, I have a custom property called RequestNumber, so I will type: MERGEFIELD RequestNumber \* MERGEFORMAT.
3. The final result should then be: {MERGEFIELD RequestNumber \* MERGEFORMAT}, which will output in the Word document as: <<RequestNumber>>

You do NOT need to create custom properties in the Word document.

I hope that this helps.