14 September 2016

Designing Word Report Layout in NAV 2016

Hi All, 


A Word report layout is a based on Word document (.docx file type) that acts as a template for viewing and printing reports from Microsoft Dynamics NAV clients. Word report layouts enable you to design report layouts by using Word 2013. Word report layouts are built on custom XML parts in Word. A custom XML part is structured XML that represents the dataset of a Microsoft Dynamics NAV report. The custom XML part is used to map the data into a report at run time.
From the Microsoft Dynamics NAV Development Environment, you can create and modify built-in Word report layouts on reports. The layouts that you create on reports in the development environment become part of the report objects in the database.
From the Microsoft Dynamics NAV clients, Microsoft Dynamics NAV users you 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.
Here I am designing a small Sales Order Report for demonstration.

1)  I have created a new report with few fields as shown below.




2) Go to Property of each field and make Include Caption to True so that captions are available in report dataset.



3) Now create a New Word Layout as shown for the Report. If Word Layout already exist then the New option will be inactive.




4) Now Export the Word Layout as shown above in the screenshot and save it somewhere.

5) Open the Exported Word Layout and add Developer Menu from Customize Ribbon Option if its not already there.

Go to File --> Options -->Customize Ribbon-->Developer







From Developer Option --> Please select XML Mapping Pane--> To display Custom XML Part

In the XML Mapping pane, in the Custom XML Part list, choose the XML part for Microsoft Dynamics NAV report. The name of the XML part has the following format

urn:microsoft-dynamics-nav/reports/report_name/ID




Now you can see the XML Dataset Part. 
Labels group include all the captions of  fields (having property Includecaption=True)
Below that you can see the Sales Header and Sales Line Data Item with the fields





6)  To add a Label or  Data Field to Word Layout :
  1. Place your pointer in the document where you want to add the control.
  2. In the XML Mapping pane, right-click the control that you want to add, choose Insert Content Control, and then choose Plain Text. ( Please see the screenshot)
Note : 
You cannot add a field by manually typing the dataset field name in the content control. You must use the XML Mapping pane to map the fields.

Do not choose Rich Text because rich text controls are not fully supported. If you use a rich text control, content might not be displayed correctly.






Repeat the same for all other fields.


7)  To add repeating rows of data fields to create a list :
  1. If not already existing, add a table row that includes a column for each field that you want repeated. This row will act as a placeholder for the repeating fields.
  2. Select the whole row.
  3. In the XML Mapping pane, right-click the control that corresponds to the report data item that contains the fields that you want repeated, choose Insert Content Control, and then choose Repeating.
  4. Add the repeating fields to the row as follows:
    1. Place your pointer in a column.
    2. In the XML Mapping pane, right-click the control that you want to add, choose Insert Content Control, and then choose Plain Text.













Repeat the same for all other fields and Save the Word Layout


8) Import the Word Layout as shown below by selecting the saved Word Layout. Alternatively you can create a new Custom Report Layout and Import the Layout.

Refer my previous post for the Custom Report Layout
https://nandeshgowda-navblog.blogspot.in/2016/09/report-layout-selection-custom-report.html





9) Now run the report and see the output.




Thanks & Regards, 
Nandesh Gowda

No comments:

Post a Comment