Template with XML Mapping content in Quick part fields?

Copper Contributor

I have a Word template with embedded XML Mapping fields that was generated by Dynamics 365. This works great in building a document with just text , but when I try and place one of these XML content controls inside a merge field, this value is not populated when the template is used.


XML content fields are filled out when the the template is used, but if it was placed inside the quick part field, only the label for the field is shown. 


This makes it impossible to leverage the cool Word features like using quick part fields to generate QR codes, which is my goal with this template.


For example:

Name: [BorrowerName ContentControl]

Borrower ID: [CardID Content Control]

{DisplayBarcode "[CardID Content Control] QR}


Will display this when opened with XML mapping data:


Name: John Citizen

Borrower ID: ABC123

QR Code with data "CardID Content Control" (field name, not expected value ABC123)


Is there any clever way to let XML content fields be used like document property fields, or alternative approach like an XML data field that has a URL path for an image that could be used to load the image in a Word template?

5 Replies


I am uncertain that I understand your question.

You seem to be conflating merge fields, document properties, and mapped Content Controls.

If you map a content control and copy that into another document, the new document will not have the XML node. If it is a Document Property Content Control, it will be mapped to that XML node in the recipient document, it does not carry the data with it.


Here are some resources.

Repeat text in MS Word Using Document Property content controls

Repeat Text in MS Word by Mapping Content Controls with the XML Pane

Hi Charles, thank you for the message and suggested reading.

You are correct that I was conflating merge fields and mapped content controls, sorry for any confusion.

What I am trying to do is use functionality available for merge fields like the DisplayBarcode field, with the content from a Content Control inside the field. This does work when using XML Content Controls to repeat text in a document as demonstrated in Laura Townsend's excellent videos, but does not work when the XML Content Controls are created and populated by Dynamics 365. Perhaps that is simply not possible.


I am a fellow user and  have no knowledge of Dynamics 365. You may want to see if there is a help forum specifically for that.

I have used the DisplayBarCode field with mapped content controls without problems. Note, though, that it is a field which must be updated upon a change in the content. It may update when you do a print preview. See Dealing with Fields in Microsoft Word.


P.S. The DisplayBarCode field is a field but not a merge field. The equivalent merge field is MergeBarCode. I have used both in merges, though. The DisplayBarCode field can contain data from a merge field to display a bar code.


Here is a link to the Microsoft Dynamics 365 forum. (It appears to be new and empty.)


Nevertheless, your question is likely to be seen there by people who know more about it than I do.

Thank you again Charles, that's also very good to know that you have used DisplayBarcode with mapped content controls in the past. I'll follow-up in the Dynamics 365 forum.