A Word Custom Report Layout is a design in Microsoft Word, what acts as a template for viewing or printing from Microsoft Dynamics NAV clients. A custom XML part is used to map the data into Word Custom Report Layout at run time, what represents the dataset of a Microsoft Dynamics NAV report.
In Microsoft Dynamics NAV Development Environment, you can create or modify built-in Word report layouts on report objects. The layouts that you create on reports in the development environment will then become part of the report objects in the database.
From the Microsoft Dynamics NAV clients, Microsoft Dynamics NAV users can manage the Word report layouts that are used on reports. This includes adding a built-in Word report layout, creating custom Word report layouts on a report, and changing which report layout is currently active on a report.
Please refer below for a simple demonstration:
- Create a new report in Microsoft Dynamics NAV Development Environment, then add fields into the report as shown below:
- Go to Properties of each field, change Include Caption to TRUE so that captions will available in the report dataset.
- It’s time to create a Word Layout for this report. Go to New Word Layout as shown as below, if Word Layout already exist then you should find that New is inactive.
- Export the Word Layout as shown above in the screenshot and save it in somewhere on your PC.
- Open the exported Word Layout and add Developer Menu from Customize Ribbon Option if you can’t find it in Microsoft Word’s ribbon.
Go to File -> Options – > Customize Ribbon -> Developer
From Developer Option -> Choose XML Mapping Pane -> Display Custom XML Part
In the XML Mapping pane, in the Custom XML Part list, select the XML Part for Microsoft Dynamics NAV report. The name of the XML part has the following format:
Now you can see the XML Dataset Part.
Label groups include all the captions of fields (Property IncludeCaption = True)
Sales Header and Sales Line DataItem with fields as shown below:
- To add a label or field to word layout, you need to place your mouse pointer in the document where you wish to add the control. Then, in the XML Mapping pane, right click the field that you want to add, choose Insert Content Control, then choose Plain Text.
You can’t type the dataset field name manually in the content control, use of XML Mapping pane to map the field is a MUST. Do not use Rich Text because it’s not fully supported yet.
Repeat the same for all other fields.
- To add repeating rows (list), you need to add a table row what includes column for each field that you want to repeat. Table rows will act as a placeholder for repeating fields.
- Select the whole table row, in the XML Mapping pane, right click the DataItem which contained fields you want to repeat, choose Insert Content Control then choose Repeating.
- Insert the field as Plain Text Control into the table column.
- Save the Word Layout once you finish the design.
- Import the Word Layout by select the saved report layout. Alternatively, you can create a new Custom Report Layout and Import the Layout.
- Run the report and see the result.