Custom properties can be used to store additional information about the document in the document itself. These properties remain with a document and can be viewed by all MS Word users that open the document. Several property management servers provide data tracking capabilities to search for, sort, and track documents based on document properties.

In our reference implementation ReportingCloud, a reporting template can be edited online using our HTML5-based Web.TextControl. Additionally, JSON objects can be uploaded to be used as data sources in the online editor. When opening a template, a JSON data source must be selected from which merge fields and blocks should be added to the template.

Using Custom Document Properties to store additional data

To prevent that the user needs to select this data source again and again every time the document is edited, the association between the template and the data source should be stored somewhere. To keep everything as simple as possible, we decided to store the connected data source in the document itself by creating a custom document property.

When the document is edited, the selected data source name is stored in the document in the Controller code:


A new UserDefinedPropertyDictionary is created and a new custom property with the unique name rc_datasource is created with the value of the selected data source. This dictionary can be added to the UserDefinedDocumentProperties of the SaveSettings class. Finally, the document is saved with the created SaveSettings object.

When the overview page is loaded the next time, the data source can be selected in the drop-down list by reading the custom property from the document:


The stored custom properties are available in the UserDefinedDocumentProperties of the LoadSettings class.

The custom document properties provide a very flexible way of storing additional data to documents without keeping them in a separate database. The data is directly stored where it belongs to - the document.

This feature is available in TX Text Control X14. Download a trial version to test this on your own.