Header Ads Widget

Top Picks


Report in Business Central: Word Layout


In this blog, I will show you how to create reports in word layout. 

The purpose of a report is to either print or show data from a database. Print documents like invoices with the help of reports that organize and summarise data. For instance, you may compile a report detailing each customer's added orders and customers. Make a report that may be used as an invoice once it is filled out with the necessary data.

In addition to printing or displaying material, reports can be used to handle data. Use a report to automatically revise a price list's totals, for instance. Creating a report to process data can be simpler than creating a codeunit to accomplish the same processing due to the following reasons:

  • You can find these options and filters for data items in a report, but it's challenging to add them to a codeunit, therefore you should make a request for the capability to be added to a page. 
  • Instead of having to write code to open tables and get records, just report the data items.
  • There is a data modeling option in the report creation process.

Primary Task of a Report

The design of the data collection should come before creating the report object. The dataset decides which records from the Dynamics 365 Business Central database tables will be used to generate the report's output. 

The visual layout of the report is created after the dataset has been designed. 

Types of Layouts

  • Report definition language (RDL) layouts
  • Word report layouts
  • Excel report layouts 

A Report Extension Object can be used to enhance an existing report by adding new columns to the report dataset, new data items, a new layout, or any combination of these.

Report Snippet

Steps to Create a Word Layout

1. Write the code in Visual Studio and save it. The code is shown below.

In the below code, I have created the report for the "Customer" table. The basic table is the "Customer" table.

Note: No need to create Customer Report.docx. The document will be automatically generated once you execute the code.

report 50111 "Report Customer"

    Caption = 'Report Customer';
    UsageCategory = ReportsAndAnalysis;
    WordLayout = 'Customer Report.docx'; //mandatory to point the report file
    DefaultLayout = Word; //best to use
    ApplicationArea= All;

        dataitem(Customer; Customer)
            column(Name; Name)
            column(City; City)
            column(Balance; Balance)
            column(Contact; Contact)
            column(PartnerType; "Partner Type")

2. Save the program. and create the package.
Save: ->Ctrl+S
Package creation: -> Ctrl+Shift+B
Execute: Ctrl+F5

3. Now open the document file (inside the project folder) which is created automatically while you run the code.

Note: The document will be empty (Without any design as shown below)

4. Design the document according to your requirement.

5. Now, connect the word and BC using XML Mapping Pane. The XML Mapping Pane is available in the Developer Tab.

5.1. Go to the Developer tab in the Word file.

Note: If you didn't find the Developer Tab then do this in the Word file. (File->Options->Customize Ribbon->Check the Developer->Ok)

5.2. Select the XML mapping Pane

5.3. Select the Report object from the drop-down.

5.4 Expand the Table

5.5 Select the Fields

5.6 Repeat the process for all the rows

6. Now save the document and close

7. Save the report code (in Visual studio code) (Ctrl+S)

8. Build the package (Ctrl+Shift+B)

9. Execute the code (Ctrl+F5). Business Central Role center page will open.

10. Open the report.


10.2 Preview the report

Please leave your comments if you have queries. 

Happy day ahead.

Dr. Gomathi

Post a Comment


  1. hello madam, how to calculate subtotal,vat%,and total amount in word layout


Youtube Channel Image
goms tech talks Subscribe To watch more Tech Tutorials