Microsoft Dynamics NAV

Designing A Custom Report Layout in Word (NAV 2017)

Posted on Posted in Microsoft Dynamics NAV

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:

  1. Create a new report in Microsoft Dynamics NAV Development Environment, then add fields into the report as shown below:

           https://4.bp.blogspot.com/-lpAd1kpQ8DE/V9gpP4gy49I/AAAAAAAAAWY/OWclbYkhzq0oQyyNl7rZAyldcn88mfOsgCK4B/s1600/Rep.png

  1. Go to Properties of each field, change Include Caption to TRUE so that captions will available in the report dataset.

           https://4.bp.blogspot.com/--5mHTufm08Q/WG3FY0IRThI/AAAAAAAABZU/8AmfCACAfQ4xUXkr7Qd0HtB2x0PxO4f6ACK4B/s1600/Include%2BCaption.png

  1. 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.
    https://1.bp.blogspot.com/-xey9I_C8tOo/WG3FldrUoqI/AAAAAAAABZc/VxlEB5_sLKMkyGMfhrlQFU5L_AXoCrWxwCK4B/s1600/New%2Band%2BImport.png
  2. Export the Word Layout as shown above in the screenshot and save it in somewhere on your PC.
  3. 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

          https://2.bp.blogspot.com/-dOx9HG_L9OA/V9gr3XgmhbI/AAAAAAAAAWw/EYyTSoV7IzwwUfHg6FjkmLCjYv1ZRPpdgCK4B/s1600/options.png

           https://2.bp.blogspot.com/-uK_lf6QvqYU/V9gr7gwhm4I/AAAAAAAAAW4/EztDq6PqAA8i5HgkHcnMkZKxVg4MEsXnwCK4B/s640/Developer.png

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:
urn:microsoft-dynamics-nav/reports/report_name/ID

           https://2.bp.blogspot.com/-EwK2pZxapmU/V9gtKUW2t_I/AAAAAAAAAXA/VWp-rSJNa0QJ2IJhPFNqKdXXVYVpLGgOACK4B/s1600/XML.png

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:

           https://4.bp.blogspot.com/-doVQcAMhqfo/V9gtkJTBfwI/AAAAAAAAAXI/GWxpe_NmRNksdkZu4Vhdza2jDNSsEHsjgCK4B/s1600/word.png

  1. 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.

Note:
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.

           https://4.bp.blogspot.com/-eE0SaLa1lzw/V9gvozfa87I/AAAAAAAAAXU/r4LNgoml_6oU6Pp_9OB4ivtgFMO0l7FYQCK4B/s1600/add%2Bfield.png

           https://4.bp.blogspot.com/-rJnNO2JM-lE/V9gvzQ302nI/AAAAAAAAAXc/u972w26Is8w6KgjOcydBXCDRO6gxmUrggCK4B/s1600/field%2B1.png

Repeat the same for all other fields.

  1. 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.

           https://4.bp.blogspot.com/-5QiRzCvKNWw/V9gwxfus_MI/AAAAAAAAAXs/1c4XxPMKTyQJDSSNPuTnSi_VLQOUxWBiACK4B/s1600/table.png

  1. 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.

           https://2.bp.blogspot.com/-bR827huAZFU/V9gxU4nw0aI/AAAAAAAAAX0/0NtCfiwW14gTGUt6-fmWr2yapetGCRRVQCK4B/s1600/table%2B1.png

  1. Insert the field as Plain Text Control into the table column.

           https://3.bp.blogspot.com/-UQWvIOP1nhU/V9gyIPB8nNI/AAAAAAAAAYA/knuWZaY_rRg8AYAhvMKLjXYGyTxOXHZ-QCK4B/s640/table%2B3.png

           https://3.bp.blogspot.com/-dxTQz0HlBTg/V9gyKIOgv5I/AAAAAAAAAYI/nbToD-2Wm9ML88PHp27mR6KX0Ayl6NNzQCK4B/s1600/table%2B4.png

  1. Save the Word Layout once you finish the design.
  2. Import the Word Layout by select the saved report layout. Alternatively, you can create a new Custom Report Layout and Import the Layout.

           https://4.bp.blogspot.com/-vRubjrVnrTU/WG3F1Lzc5QI/AAAAAAAABZk/U0dNpf58UFQ1-RvlzHQkD0A3beUKzBEcwCK4B/s1600/import.png

  1. Run the report and see the result.

https://3.bp.blogspot.com/-ucuUnk1AKSg/V9g0dfSP2tI/AAAAAAAAAYg/bUBcs-p_GX4-CTHPrZBeDw37eVPTN7osACK4B/s1600/output.png

Leave a Reply

Your email address will not be published. Required fields are marked *