Adding document properties

This page contains:

One of the most common features you'll add to your template is a custom property.

Custom properties allow you to repeat certain information in multiple locations in the report. They are useful for displaying:

  • The client's name throughout different sections.
  • The project name.
  • The document author.
  • ...

Adding new custom properties

Before being able to put our custom properties in different locations of our document, we have to add them:

  • Click the File tab.
  • Click Properties.
  • Click Advanced Properties.

Click on Custom, and add a few properties.

The property Value can be anything as long as it won't be flagged by Word's internal spellchecker.

Inserting custom properties

Now that your template has several custom properties in it, we can place insert them in different locations.

Lets use a common location for this type of content: a table where we list a few details about the document itself:

Lets start with dradis.client. Navigate with the cursor to the cell where you want to insert it.

  1. Click the Insert tab.
  2. Click Quick Parts
  3. Click Field...
  1. Under Field name, choose DocProperty.
  2. Under Property, choose dradis.client

And the new document property will be inserted in the current position. If you click over it, you'll see a darker background indicating this isn't normal text, but a document property:

Finally, we repeat the process for the other properties

  • dradis.project
  • dradis.author
  • dradis.email

If the field is flagged as a spelling error with a red wavy line underneath, you're going to run into problems on export. If this happens, just change the Value of the field. For example, change "ClientCompanyName" to "Client Company Name" to avoid this problem.

Adding property values to your Dradis project

All the work on the template side of things is over. Lets move on to Dradis.

Custom document properties are stored in the Report content page of your Dradis project. For more on how to add your document properties to your Project, check out the Report Content page of the Project guide.

Update your fields and properties post-export

Word objects to automatically updating these document properties on export. When you export a report containing document properties, then on opening the exported Word document for the first time, you will get the following error message: This document contains fields that may refer to other files. Do you want to update the fields in this document? Click "Yes" and the document properties will be updated when you open the report.

On pre-v3.7 versions of Dradis you won't get this warning, but will typically see placeholder text displayed until you force it to show the real value with an update field. You have three options to update your properties and fields (including SEQ fields) post-export:

  1. Manually update

    This option doesn't scale well to large reports. But, you can manually update fields by right-clicking on them and selecting Update Field as shown below.


  2. Select All + Update All

    Open up your exported Word report, then use the following keyboard shortcuts to update all the fields.

    Note: if your document has fields within tables, headers, or footers, this method may not update them.

    1. Press CTRL + A
    2. Press F9

  3. The UpdateAllFields macro

    Alternatively, you can use the following macro to update all the properties and fields in your document at once:

    Sub UpdateAllFields()
     '
     ' Macro to completely update the document
     '
     ' Kudos to Sherief for this one
     '
     ActiveDocument.Fields.Update
    
     For Each sec In ActiveDocument.Sections
        For Each head In sec.Headers
            head.Range.Fields.Update
        Next head
    
        For Each foot In sec.Footers
            foot.Range.Fields.Update
        Next foot
      Next sec
    
      Dim toc As TableOfContents
      For Each toc In ActiveDocument.TablesOfContents
        toc.Update
      Next
    End Sub

Streamline InfoSec Project Delivery

Learn practical tips to reduce the overhead that drags down security assessment delivery with this 5-day course. These proven, innovative, and straightforward techniques will optimize all areas of your next engagement including:

  • Scoping
  • Scheduling
  • Project Planning
  • Delivery
  • Intra-team Collaboration
  • Reporting and much more...

Your email is kept private. We don't do the spam thing.