Share via


Custom XML Part Overview for Word Report Layouts in Dynamics NAV

Word report layouts are built on custom XML parts. A custom XML part is structured XML that represents the dataset of a Dynamics NAV report. The custom XML part is used to map the data into a report when the report is run from a Dynamics NAV client.

XML Structure of Custom XML Part

A custom XML part for a Dynamics NAV report consists of elements that correspond to the data items, columns, and labels that comprise the report's dataset as defined in the Report Dataset Designer in Microsoft Dynamics NAV Development Environment.

The following table provides a simplified overview of the XML of a custom XML part.

XML Elements Description
<?xml version="1.0" encoding="utf-16"?> Header
<NavWordReportXmlPart xmlns="urn:microsoft-../report/<reportname>/<id>/" XML namespace specification. <reportname> is the name that is assigned to the report object in Microsoft Dynamics NAV Development Environment. <id> is the ID that is assigned to the report.
..<Labels>

....<ColumnNameCaption>ColumnNameCaption</ColumnNameCaption>

....<LabelName>LabelCaption</LabelName>

..</Labels>
Contains all the labels for the report. The element includes labels that are related to columns that have the IncludeCaption Property set to Yes and labels that are defined in Report Label Designer.

- Label elements that are related to columns have the format <ColumnNameCaption>ColumnNameCaption</ColumnNameCaption>, where ColumnName is determined by the column's Name Property.
- Label elements from Report Label Designer have the format <LabelName>LabelName</LableName, where LabelName is determined by the label's Name Property.
- Labels are listed in alphabetical order.
..<DataItem1>

....<DataItem1Column1>DataItem1Column1</DataItem1Column1>
Top-level data item and columns. Columns are listed in alphabetical order.

The element names and values are determined by the Name Property of the data item or column.
....<DataItem2>

......<DataItem2Column1>DataItem2Column1</DataItem2Column1>

....</DataItem2>

....<DataItem3>

......<DataItem3Column1>DataItem3Column1</DataItem3Column1>

....</DataItem3>
Data items and columns that are nested in the top-level data item. Columns are listed in alphabetical order under the respective data item.
..</DataItem1>

</NavWordReportXmlPart>
Closing element.

Custom XML Part in Word

In Word, you open the custom XML part in the XML Mapping pane, and then use the pane to map elements to content controls in the Word document. The XML Mapping pane is accessible from the Developer tab (for more information, see How to: Show the Developer Tab on the Ribbon).

The elements in the XML Mapping pane appear in a structure that is similar to the XML source. Label fields are grouped under a common Labels element and data item and columns are arranged in a hierarchal structure that corresponds to the XML source, with columns listed in alphabetical order. Elements are identified by their name as defined by the Name property in Report Dataset Designer in development environment.

The following figure illustrates the simple custom XML part from the previous section in the XML Mapping pane of a Word document.

Clip of the XML Mapping pane in word

  • To add a label or field to the layout, you insert a content control that maps to the element in the XML Mapping pane.

  • To create repeating rows of columns, insert a Repeating content control for the parent data item element, and then add content control for the columns.

  • For labels, the actual text that appears in the generated report is the value of the Caption property for the field in the data item table (if the label is related to the column in the report dataset) or a label in the Report Label Designer (if the label is not related to a column in the dataset).

  • The language of the label that is displayed when you run the report depends on the language setting of the report object. For more information, see Multiple Document Languages and Viewing the Application in Different Languages.

    For information about how to open the custom XML part in Word and add fields, see Managing Report Layouts.

See Also

Managing Report Layouts