Skip to main content

Advanced Document Coding for Word

Learn the finer points of advanced merge coding for Neos Word templates, including how to format variable information, build conditional statements, and handle common formatting needs.

Tags, Prompts, and Tag Lists can be added to your template with the Neos Word Add-in. However, there may be times when variable information must appear in your template in a specific format. This article explains the finer points of more advanced document merge codes.

NOTE: Advanced document coding must be performed in the latest version of Word Desktop.

There may be times when you want to make sure a field does not get updated (e.g., multiple staff working on the same document template). By locking a statement field, this prevents any changes, however, it will also prohibit data from being filled in during the Document Generation process in Neos. If your generated document does not show the expected result, open the template in Word and ensure that all fields are unlocked. To unlock all fields, press Ctrl+A to select the entire document and press Ctrl+Shift+F11 on your keyboard. You won't see any changes visually in the template, but after saving and replacing the file in the Template Setup, the next time it is used, you should see the expected data filled in.

General Information

When you view this document in Word, you may be unable to view the coded examples. If you cannot view the codes, press Alt + F9. If you wish to automatically view the field codes when you open Word 365 or Word 2016 or later, click File > Options. Select the Advanced tab and scroll to the Show document content section. Select the checkbox for Show field codes instead of their values and click OK.

To include the field codes when you print a document, click File > Options > Advanced and scroll to the Print section. Select the checkbox for Print field codes instead of their values and click OK.

NOTE: Make sure you turn off (uncheck) this feature when you are printing your merged documents; otherwise, some fields (for example, the date) will print as a code.

Spaces and punctuation must be properly placed within the code statements. Within any coded document you cannot use double quotes ("") in the body of the letter, or Word will process the double quotes as merge fields. Instead, use two single quotes in the document.

Word limits the number of IF statements that can be embedded in any one coded statement to twenty (20).

Shortcut Files

To simplify the process of recreating complicated codes, create a "shortcut" folder containing examples of frequently used codes from this article, or simply cut and paste the codes to your document. The following steps will help you create a shortcut.

  1. Select and copy a portion of a document that contains the desired coding. (e.g., "Re:Our Client:[[ Name Full Name | Case.Parties.Name.FullNameFirstLast | Select Our Client ]]" line in a letter).

  2. Open a new blank document. Edit > Paste the selected codes into the document.

  3. Change the placeholders to the correct merge code tag using the Neos Word Add-in, e.g., [[ Claim # | Case.Insurance.Claim ]].

  4. Click on File > Save. Save the file to a Shortcut folder.

To insert these files into a new document:

  1. Click or tap where you want to insert the content of the existing document.

  2. Click Insert and select the arrow next to Object (in the Text group).

  3. Select the Text from File option.

  4. Browse for the file and double-click or click Insert. Change any placeholders within the new document to reflect the appropriate tag. For example, when using a Party Full Name tag, you may need to specify the Plaintiff or Claimant.

  • [[ Name Full Name | Case.Parties.Name.FullNameFirstLast | Plaintiff ]]

  • [[ Name Full Name | Case.Parties.Name.FullNameFirstLast | Claimant ]]

5. To add content from additional Word documents, repeat these steps.

Current Date Tag

To insert the current date in the document, copy and paste the following date code:

NOTE: This tag can be found in the Neos Word Add-in.

[[ Current Date | CurrentDate ]]

If…Then…Else

The "If …Then . . . Else" merge code is the most commonly used advanced code for Neos Word merges. To manually insert curly braces, type the command, Ctrl + F9, e.g. { }. NOTE: The command is case-sensitive.

NOTE: After a document using an If statement is generated in Neos, all merge code changes should be made using the right-click > Edit Field option. When the Update Field check automatically runs, any text that is not part of the actual merge code will be removed. Changes to merge codes within the generated document could be reverted unless the actual code is changed in the Edit Field… > Field window.

The statement creates a comparison between variables and inserts the appropriate text as a result of the comparison:

IF Expression1 Operator Expression2 TrueText FalseText

Example 1: If the Neos field "Our Client" is checked, "Plaintiff" is inserted into the document; otherwise "Defendant" is inserted.

Field name: [[ Our Client | Case.Parties.OurClient ]]

Comparison: Equal to

Compare to: True

Insert this text: Plaintiff

Otherwise insert this text: Defendant

The final coding displays as follows:

The statement functions as follows:

If Our Client equals true, insert Plaintiff; otherwise insert Defendant.

Example 2: A field must be greater than a number, depending on the Case information in a Neos field (i.e. Age at DOI).

Field name: [[ Age At DOI | Case.Parties.AgeAtDateOfIncident ]]

Comparison: Greater than

Compare to: 18

Insert this text: Adult

Otherwise insert this text: Minor

The resulting coding displays as follows:

The statement functions as follows: If Age At DOI is greater than 17, insert Adult; otherwise insert Minor

IF Statements using Prompts

A combination of an If statement and a Fill In prompt can be used within an If statement, as displayed in the two examples below.

Example: A field must not be blank, depending on the Case information in a Neos field (i.e. Claim #).

Field name: [[ Claim # | Case.Insurance.Claim ]]

Comparison: not equal

Compare to: blank

Insert this text: [[ Claim # | Case.Insurance.Claim ]]

Otherwise insert this text: Prompt the User to Enter Claim# or type Please provide

The resulting coding displays as follows:

The statement functions as follows: If Claim # (Claim Number) is not blank, the Claim Number is inserted into the document; otherwise, if there is no data in that field, the user can enter the Claim Number or request the recipient provide the Claim Number, by typing in "Please provide" in the prompt while generating the template.

NOTE: An update has been made to IF statements that use Case Date fields. If the Case Date is not populated in the Case, when the document is generated, the field will now show "is not scheduled at this time".

States

If the full name of a state is required rather than the abbreviated state code, copy and paste the entire code in your document. While the code is long, only the matching state will display.

NOTE: Only the Default, Home, or Business address can be used to display the name's full state name. For other address types, change the default to where mail should be sent.

Refer to the attached document for the entire list of State codes.

Inserting Gender-based Pronouns (He/She, etc.)

To insert gender-based pronouns in a form document, code the following If…Then…Else statement. This statement looks to the individual's Gender field to determine the appropriate pronoun. Note that each set of pronouns below has an example that automatically inserts a gender-neutral pronoun or prompts the user to enter a pronoun, if the individual's gender is not identified (left blank) in Neos. You may need to edit the tag to correspond to the Neos field for the Party or Provider's Gender fields in your document.

He/She

Variation with prompt for pronoun

Him/Her

Variation with prompt for pronoun

His/Her

Variation with prompt for pronoun

Salutation

Coding a document to include the salutation if it is not blank. Salutation is field located in the Addresses block on the Party and Provider tabs and is used for customizing correspondences based on the address (e.g., Mr. & Mrs. Adams for a Home address).

For Party:

This reads as follows: If Party Default Salutation is not blank then Insert Party Default Salutation. If Party Default Salutation is blank, and Party Prefix is not blank then insert Party Prefix and Party Last Name. If Party Default Salutation and Party Prefix are blank, insert Sir/Madam.

For Provider:

This reads as follows: If Value Provider Default Salutation is not blank then Insert Value Provider Default Salutation. If Value Provider Default Salutation is blank, and Value Provider Prefix is not blank then insert Value Provider Prefix and Value Provider Last Name. If Value Provider Default Salutation and Value Provider Prefix are blank, insert Sir/Madam.

Typist Initials

To insert the typist initials at the end of a form, insert the Staff Initials tag using the Insert Multi-Record option.

The final result displays as follows:

[[ Initials | StaffPerson.Initials | Select Typist ]]

Add tags for Signer and Typist Initials and the result displays the Signer Initials\Typist Initials.

[[ Initials | StaffPerson.Initials | Select Signer ]]\[[ Initials | StaffPerson.Initials | Select Typist ]]

Insertdoc/Insertpic Tags

Insertdoc and Insertpic tags are used for commonly referenced text or images that appear in various documents. For example, an Insertdoc tag can be used to insert a letterhead. Using the tag enables the firm to manage letterhead changes by updating a single location without having to update each template.

The Neos Word Add-in contains tags for INSERTDOC and INSERTPIC. The file path of the document or picture must be located in your firm's SharePoint. When the document and picture file is updated, the changes will be automatically reflected in all templates that use the path with these tags.

First, create the file that contains the letterhead or commonly used text. Save the file in your firm's SharePoint that is accessible by the Global Admin account linked to the OneDrive integration (e.g., CloudDocs > TemplateFiles).

Then, open the file in which you wish to include the text and locate the insertion point at the appropriate place. Refer to Insert Picture and Document Tags in Word for more details.

  • Use the Neos Word Add-in to add the Insertdoc or Insertpic tags.

  • To locate the link of the file you wish to insert, navigate to the file in your firm's SharePoint and select the three dots menu > Details > More Details > and click the Copy icon to copy the path.

  • Highlight "<file path>" and replace with the exact path copied above.

Using Insertdoc/Insertpic to Insert from Multiple Letterheads

Use this IF statement when selecting from Multiple Letterhead options. Word limits the number of IF statements that can be embedded in any one coded statement to twenty (20). This limit may require you to create separate IF statements for your INSERDOC/INSERTPIC coding of different groups (i.e. attorneys, paralegals, secretaries, etc.).

Insert Letterhead from a Prompting Question:

To use either of the above letterhead methods, change the path of the three letterheads after "INSERTDOC". Make sure to use the exact path with correct spacing and type case.

Using the List Tag for a Demand in a Table to Select Multiple Items and Sum the Total

List tags create a list of multiple items from a tab in Neos (e.g., Value Tab). The following list tag will generate the Case Value Tab items with the Provider Full Name, start and end Service Dates, and Value Total for all entries with a Medical Value Code.

[[ LIST | Value | Case.ValueItems.Provider.FullNameFirstLast, Case.ValueItems.StartDate, Case.ValueItems.StopDate, Case.ValueItems.TotalAmount | MEDICAL ]]

By default, the table generates in a gray and white design. Using the Table Design ribbon, you may change the table style as needed. Refer to Creating Tag Lists for more details on using List tags.

To add the SUM in Word Desktop:

  • Right-click the table and select Insert > Insert Rows Below.

  • Put your cursor in the field of the new row that should contain the SUM formula.

  • Select the Layout ribbon in Word (should be next to Table Design), then Formula.

  • On the Formula window, enter =SUM(ABOVE) and click OK.

  • The Value items should now be totaled in the new row.

Multiple Addressees

A merge letter may need to be sent to three addressees and all the addresses must be on one letter. This code involves If…Then…Else statements. If there are less than three addresses chosen, the blank space will not appear.

In the example below, the letter is being sent to three attorneys. The first two tags are for the first Counsel Full Name and Counsel Default Full Address tags. In the first IF statement, the tags for the second Counsel Full Name and Counsel Default Full Address are listed. In the second IF statement, the tags for the third Counsel Full Name and Counsel Default Full Address tags are listed.

The following example allows the selection of an address from Home and Business AND includes the Salutation for each of those addresses (Neos allows a separate salutation for each address per Party/Provider).

The codes are translated as follows: Prompt the user to select "1. Home Address and Salutation or 2. Business Address and Salutation". If "1. Home Address and Salutation" is selected the home address and salutation is entered; if "2. Business Address and Salutation" is selected the business address and salutation is entered.

Prompt for Language

A Prompt is used to create a menu in a merge document (e.g., Should this letter be in English, Spanish, or French?)

The resulting coding displays as follows:

The statement functions as follows:

If the user selects "1 English" insert the English version of letter, if the user selects "2 Spanish" insert the Spanish version of letter, or if the user selects "3 French" insert the French version of letter.

Removing Blank Lines

Use the paragraph marker to remove blank lines from your merge codes. For example, if there are several items and you only wish to display data that meets the criteria of the merge code, this process will eliminate blank lines from being added to your document.

NOTE: When creating merge codes from User Defined Tabs, firms must update the exact tags as they relate to their own Neos database (i.e., Id codes are unique to your firm).

Example 1: The generated document adds extra spaces.

Example 2: To eliminate extra spaces, turn on the paragraph marker and move it so it appears outside the brackets inside your code.

Certification of Service

The Counsel Tab in each Case has a Cert/Notice Filing Order field, which is used to control the order in which Counsel will appear in a Certificate of Service. Assign each Counsel a Cert/Notice order number, greater than zero if you wish for them to appear on the list. You can choose either the Paragraph or the List Format to merge the Full Name and Default Address of each Counsel into the document.

The single tag will pull all Counsel names and their addresses if they have a Cert Order of 1 or greater assigned.

  1. Select Case in Merge Type.

  2. Select SpecialCase in Category.

  3. Select either of the following Merge Parameters to choose the format in which you wish the information to appear:

  • Certificate of Service in List | [[ Certificate Of Service in List | CertificateOfService.List ]]

    • <Counsel>, <Address>, Fax: <fax number>, Attorney for: <Representing Name>

  • Certificate of Service in Paragraph | [[ Certificate of Service in Paragraph | CertificateOfService.Paragraph ]]

    • <Counsel>

      <Address>

      Fax: <fax number>

      Attorney for: <Representing Name>

Additional related tags are available in Case (Merge Type) > Case (Category) and are outlined below:

[[ Cert/Notice List Format | Case.CertificateNoticeListFormat ]]

<Counsel>, <Email>, <Address>, Attorney for: <Representing Name>

[[ Cert/Notice Paragraph Format | Case.CertificateNoticeParagraphFormat ]]

<Counsel>

<Email>

<Address>

Attorney for: <Representing Name>

[[ Certificate Of Service in List | CertificateOfService.List ]]

<Counsel>, <Address>, Fax: <fax number>, Attorney for: <Representing Name>

[[ Certificate of Service in Paragraph | CertificateOfService.Paragraph ]]

<Counsel>

<Address>

Fax: <fax number>

Attorney for: <Representing Name>

[[ Cert Of Srv Order | Case.Counsel.CertificateOfServiceOrder ]]

<Filing Order # of single selected Counsel >

4. The Counsel and Representing names are now displayed in FirstLast format when generated.

CERTIFICATE OF SERVICE

I HEREBY CERTIFY that on this _____ day of ________ , 20___ a copy of the foregoing <Title of Pleading> was mailed, first class, postage prepaid, to the following person(s):

[[ Certificate of Service in Paragraph | CertificateOfService.Paragraph ]]

Example: The 31 day of December, 2020

From a Neos date field:

The [[ Date Of Incident | Case.DateOfIncident | @"dd" ]] day of [[ Date Of Incident | Case.DateOfIncident | @"MMMM, yyyy" ]]

From the current system date:

The [[ Current Date | CurrentDate | @"dd" ]] day of [[ Current Date | CurrentDate | @"MMMM, yyyy" ]]

Did this answer your question?