Create and Modify a Custom Report or Document Layout
Lesson progress:
By default, a report will have a built-in report layout, which can be either an RDLC report layout, a Word report layout, or both. You cannot modify built-in layouts. However, you can create your own custom layouts that enable you to change the appearance of report when it is viewed, printed or saved. You can create multiple custom report layouts for the same report, and then switch the layout that is used by a report as needed.
Create a custom layout
To create a custom layout, you can either make a copy of an existing custom layout or add a new custom layout, which in most cases is based on a built-in layout. When you add a new custom layout, you can choose to add an RDLC report layout type, Word report layout type, or both.
The new custom layout will automatically be based on the built-in layout for the report if one is available. If there is no built-in layout for the type, then a new blank layout is a created, which you will have to modify and design from scratch.
To create a custom layout for a report
Choose , enter report layout selection, and then choose the related link.
The Report Layout Selection page opens.
The Report Layout Selection page lists all the reports that are available in the company that is specified in the Company field at the top of the page.
Or use the search button to filter the list to the report you are interested in, like for example report 1306 Sales Invoice.
Set the Company field to the company in which you want to create the report layout.
Select the row for the report that you want to create the layout for, and then choose the Custom Layouts action.
The Custom Report Layouts page appears and lists all the custom layouts that are available for the selected report.
If you want to create a copy of an existing custom layout, select the existing custom layout in the list, and then choose the Copy action.
The copy of the custom layout appears on the Custom Report Layouts page and has the words Copy of in the Description field.
If you want to add a new custom layout that is based on a built-in layout, do the following:
- Choose the New action.
The Insert Built-in Layout for a Report page appears. The Report ID and Report Name fields are automatically filled in. - To add a custom Word report layout type, select the Insert Word Layout check box.
- To add a custom RDLC report layout type, select the Insert RDLC Layout check box.
- Choose the OK button.
The new custom layouts appear on the Custom Report Layouts page. If a new layout is based on a built-in layout, then it has the words Copy of a Built-in Layout in the Description field.
If there was no built-in layout for the report, then the new layout has the words New Layout in the Description field, which indicates that custom layout is blank.
- Choose the New action.
By default, the Company Name field is blank, which means that the custom layout will be available for the report in all companies. To make the custom layout available in a specific company only, choose Edit, and then set the Company Name field to the company that you want.
The custom layout has been created. You can now modify the custom layout as needed.
Modify a report layout
To modify a report layout, you must first export the report layout as a file to a location on your computer or network, and then open the exported document and make the changes. When you are finished making the changes, you import the report layout.
To modify a custom layout for a report
You export a custom layout from the Custom Report Layouts page. If this page is not already open, search for and open the Report Layout Selection page, select the report that has the layout that you want to modify, and then choose the Custom Layouts action.
On the Custom Report Layouts page, select the layout that you want to modify, choose the Export Layout action, and then choose Save or Save As to save the report layout document to a location on your computer or network.
You can export an existing custom report layout as a file to and from a location on your computer and network. For example, you can export a report layout, and then send the file to another person to modify. That person can then make the modifications to layout and return the file to you so that you can import it back. You cannot import or export built-in report layouts.
Open the report layout document that you just saved, and then make changes.
If you are changing a Word layout, open the layout document in Word.
If you are changing an RDLC layout, open the layout in Report Builder.
Remember to save your changes when done.
Return to the Custom Report Layouts page, select the report layout that you exported and modified, and then choose the Import Layout action.
In the Import dialog box, select Choose to find and select the report layout document, and then choose Open.
These are the steps to follow in order to modify a custom layout for a report. The details on how to modify a WORD and RDLC layout are explained in the next sections.
Make changes to a Word report layout
To make general formatting and layout changes, such as changing fonts, adding and modifying a table, or removing a data field, just use the basic editing features of Word, like you do with any Word document.
If you are designing a Word report layout from scratch or adding new data fields, then start by adding a table that includes rows and columns that will eventually hold the data fields.
A report dataset can consist of fields that display labels, data, and images. You add fields by using the Word custom XML part for the report and adding content controls that map to the fields of the report dataset. Adding fields requires that you have some knowledge of the report's dataset so that you can identify the fields that you want to add to the layout.
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.
The elements in the XML Mapping pane appear in a structure that is like the XML source. Label fields are grouped under a common Labels element and data item and columns are arranged in a hierarchical structure that corresponds to the XML source, with columns listed in alphabetical order.
The following figure illustrates the simple custom XML part from the previous section in the XML Mapping pane of a Word document.
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.
To open the Custom XML part for the report in Word
If not already open, then open the Word report layout document in Word.
Show the Developer tab in the ribbon of Microsoft Word.
By default, the Developer tab is not shown in the ribbon. To show it you can enable it in the ribbon.
On the Developer tab, choose XML Mapping Pane.
In the XML Mapping pane, in the Custom XML Part dropdown list, choose the custom XML part for add include report, which is typically last in the list.
The name of the custom XML part has the following format:
urn:microsoft-dynamics-nav/reports/report_name/ID
report_name is the name that is assigned to the report.
ID is the identification number of the report.
After you select the custom XML part, the XML Mapping pane displays the labels and field controls that are available for the report.
To add a label or data field
Place your cursor in the document where you want to add the control.
In the XML Mapping pane, right-click the control that you want to add, choose Insert Content Control, and then choose Plain Text.
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.
To add repeating rows of data fields to create a list
Add a table in the Word document.
This table serves as the container for data elements. Use at least two rows, one for the labels and one for the rows.
In the table, 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.
Select the entire row.
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.
Add the repeating fields to the row as follows:
- Place your pointer in a column.
- In the XML Mapping pane, right-click the control that you want to add, choose Insert Content Control, and then choose Plain Text.
For each field, repeat steps a and b.
A report dataset can include a field that contains an image, such as a company logo or a picture of an item. To add an image from the report dataset, you insert a picture content control.
Images align in the top-left corner of the content control and resize automatically in proportion to fit the boundary of the content control.
You can only add images that have a format that is supported by Word, such as .bmp, .jpeg, and .png file types. If you add an image that has a format that is not supported by Word, you will get an error when you run the report from the add include client.
To add image fields
Place your pointer in the document where you want to add the control.
In the XML Mapping pane, right-click the control that you want to add, choose Insert Content Control, and then choose Picture.
To increase or decrease the image size, drag a sizing handle away from or towards the center of the content control.
Make changes to an RDLC report layout
To create an RDLC layout, you use Report Designer for Visual Studio or Report Builder for SQL Server. With RDLC layouts, you can add useful features to your report layouts, such as:
Links from a field on a report to either a page or another report.
Images and graphs.
The ability to toggle columns so that you can hide or display data.
The ability for users to interactively change the column on which data in the report is sorted.
You generally display most data in the body of a report, and you use the header to display information before any dataset fields are displayed. For example, you can display a report title, company, and user information in the header of a report.
You can use Visual Studio Report Designer or SQL Server Report Builder to modify RDLC report layouts. If your computer is running both Visual Studio Report Designer and SQL Server Report Builder, you can configure choose to use one or the other to design RDLC report layouts and open the rdlc files.
To make changes to the RDLC layout of a report
Choose , enter custom report layouts, and then choose the related link.
The Custom Report Layouts page opens.
Select the layout you want to modify, and then select Export Layout.
Open the .rdlc file that was downloaded, with Report Builder. If Report Builder is installed on your machine, a double-click on the downloaded rdlc file automatically triggers report builder to open it.
Make your changes, using report builder, and then save the layout.
On the Custom Report Layouts page, on the action bar, choose Layout > Import Layout.
Next unit
Update Report or Document Layouts
Feedback
To send feedback about this page, select the following link:
To suggest a new idea about how to improve Sparkrock 365, select the following link: