DocumentTemplateXRay 1.2.20

dotnet add package DocumentTemplateXRay --version 1.2.20
                    
NuGet\Install-Package DocumentTemplateXRay -Version 1.2.20
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DocumentTemplateXRay" Version="1.2.20" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DocumentTemplateXRay" Version="1.2.20" />
                    
Directory.Packages.props
<PackageReference Include="DocumentTemplateXRay" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DocumentTemplateXRay --version 1.2.20
                    
#r "nuget: DocumentTemplateXRay, 1.2.20"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DocumentTemplateXRay@1.2.20
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DocumentTemplateXRay&version=1.2.20
                    
Install as a Cake Addin
#tool nuget:?package=DocumentTemplateXRay&version=1.2.20
                    
Install as a Cake Tool

alternate text is missing from this package README image Document Template XRay

NuGet XrmToolBox

An XrmToolBox tool that extracts and displays all Dynamics 365 field references from Word (.docx) document templates.

When you build Word templates for Dynamics 365, it's easy to lose track of which entity fields, relationships, and repeating sections are actually used. Document Template XRay reads the underlying XML content controls and presents every field in a clear flat list or tree view — no need to click through the template one control at a time.

The problem it solves

Here is a real template open in Word:

A Dynamics 365 template open in Word

Three of those lines say description. Two say name. address1_city appears four times. Column names repeat across tables — every table in Dataverse has a description and a createdon — so the moment a template pulls in a related record, the page fills up with controls that look identical and read from completely different places. Nothing you can see says which is which: the difference is a data binding buried in the XML, and Word will not show it to you without clicking each control in turn.

Here is the same file in Document Template XRay:

The same template in Document Template XRay

The three description fields turn out to be account/description, account/account_parent_account/description and account/account_primary_contact/description — the account, its parent account, and its primary contact. The Table and Column columns name each one the way the business does, so telephone1 on the account is Main Phone while telephone1 on the contact is Business Phone.

Features

  • Fetch templates from Dynamics 365 — connects via XrmToolBox and lists all Word document templates in your environment
  • Browse local files — open any .docx template from disk
  • Drag & drop — drop .docx files directly onto the tool
  • Flat list view — shows every field reference with table, column, tag, alias, repeating section, and location (document body / header / footer)
  • Tree view — groups fields by their entity/relationship path for a structural overview
  • Display name resolution — resolves logical names to display names using Dataverse metadata (when connected)
  • Repeating section detection — identifies and highlights repeating sections and their child fields

Tree view

Tree view makes the same point structurally — three description leaves hanging off three different parents:

Tree view

Repeating sections and document parts

Repeating sections appear in bold with (section), and every field inside one is coloured and tagged with the section it repeats under — so you can tell the description that prints once from the one that prints per contact and the one that prints per task:

Repeating sections

The Location column covers the fields that are easiest to miss entirely: the ones in the header and the footer rather than the body.

Header and footer fields

How It Works

Word document templates for Dynamics 365 store field bindings as structured document tags (content controls) in the underlying XML. Each content control has a w:dataBinding element with an XPath like:

/ns0:DocumentTemplate[1]/account[1]/name[1]

The plugin opens the .docx as a ZIP archive, reads word/document.xml and any header*.xml / footer*.xml parts, then extracts these XPath bindings and converts them into readable field paths like account/name.

When connected to Dynamics 365, it also fetches entity metadata to resolve logical names (e.g., account/name) to display names (e.g., Account / Account Name).

A template built against an environment it no longer matches still reads: every binding is listed, and only the display names it cannot resolve are left blank.

A stale template

Testing

fixtures/ holds a Word template per behaviour worth checking — duplicate column names, repeating sections, header and footer fields, stale bindings, and a document with no bindings at all — together with the script that generates them. See fixtures/README.md for what each one proves. Every screenshot above is one of them, loaded against a live environment.

xtb.ps1 builds the tool and launches a private XrmToolBox containing nothing but it, connected to the current pac auth environment, so you can try a change against a real environment without disturbing the XrmToolBox you use for work.

License

MIT

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.20 55 8/18/2026
1.2.19 77 8/18/2026
1.2.18 81 8/17/2026
1.2.17 168 4/13/2026
1.2.16 334 4/12/2026
1.2.15 111 4/12/2026
1.2.14 119 4/12/2026

v1.2.20 - Rename to "Document Template XRay". The hyphen in "X-Ray" meant a search for "xray" in the XrmToolBox tools list did not match this tool.