Custom template tutorial

This section describes how to make a simple custom template.

About this task

In this section we will create a simple custom template for generating a table of remediation tasks for all issues discovered during the scan. The template output will have the structure shown below, though obviously the actual data will depend on the scan you use when generating the report.

Index Name Count Priority
1/2 RemediationTaskA 4 High
2/2 RemediationTaskB 2 High
1/3 RemediationTaskC 5 Medium
2/3 RemediationTaskD 2 Medium
3/3 RemediationTaskE 7 Medium
2/2 RemediationTaskF 3 Low

High priority tasks will be listed first, followed by Medium and then Low. For each task the table will indicate the task Index (e.g. 1/n), Name, Count (number of issues that the task applies to), and its priority.

Note: Basic familiarity with field codes is assumed in this tutorial. For information about field codes refer to your MS Word documentation.
Note: A complete list of valid merge fields can be opened by clicking Tools > Report > Template Based > View Field Reference.

Procedure

  1. Open the list of valid merge fields by clicking Tools > Report > Template based > View Field Reference. You will need this as a reference from which to copy field names.
  2. Open an MS Word document, type in the heading "Remediation Tasks", and save it.
  3. Create the table header: Create a table with 4 columns and 1 row and type in the headers "Index", "Name", "Count", and "Priority".
  4. Add the fields that will generate the High priority entries in the table:
    1. From the Field Reference table, copy the code: AS:RemediationTypeRepeaterStart<Priority=High>
    2. In the Word document, place your cursor after the header table.
    3. Paste the merge field into the document as a field (MS Word 2003: Insert > Field > MergeField > Field name field; MS Word 2010: Insert > Quick Parts > Field > MergeField > Field name).
      The merge field is created in the document in the form:
      {MERGEFIELD AS:RemediationTypeRepeaterStart<Priority=High>\*  MERGEFORMAT}
      Note: By default Word displays the tags in a truncated form which, since they are long, may omit relevant information. To see the full tag names "show field codes" by clicking [Alt] + [F9] (toggles field codes on/off).
    4. Click Enter and create another table with 4 columns and 1 row. This table will later be populated with all the rows of High priority tasks.
    5. After the table add the following merge field: AS:RemediationTypeRepeaterEnd
      This appears as:
      {MERGEFIELD AS:RemediationTypeRepeaterEnd\*  MERGEFORMAT}

      You have now entered the opening and closing merge fields for the section of the document listing High Priority remediation tasks. These two fields form a "loop" that will create a listing based on the fields inserted between them. You can now enter the four fields that will create the content in the four columns in the table you added above.

    6. In the left hand column, add the merge field: AS:RemediationTypeRepeaterIndex. This will create a counter (in the form: 1/n, 2/n, etc.) for each of the n tasks in this section.
    7. In the second column, add the merge field for RemediationTypeName.
    8. In the third column, add the merge field for RemediationTypeName.
    9. In the fourth column, type the word "High".

    The High priority section of the table is now complete. It will produce multiple rows of data: one for each High priority remediation task in your scan results. Your document should now look like this:


    Mergefields inserted as described
  5. Repeat Step 4 for Medium and Low priority tasks (in the Priority column, type "Medium" and "Low" respectively). Make sure that each table row (High, Medium and Low) has a Start merge field before it and an End merge field after it, as shown in the image below.
    Note: The field content of the three rows is the same, so you can copy-and-paste the "High" priority row in between the Start and End tags for Medium and Low priority tasks, simply changing the text in the "Priority" column.
    Note: Since the Name column will contain text strings, while the Index, Count and Priority columns will contain only numbers or a short word, you may want to adjust the column widths with this in mind.

    Mergefields inserted as described
  6. Add explanatory text and apply any formatting to the rest of the document as required.
  7. Save the file.
  8. To create a report using this template, see Importing a custom template