Technical Notes, Zetadocs

HOWTO: Manually modify Word Layout reports in NAV 2015 or NAV 2016

ZTN4376

ID: ZTN4376

This Zetadocs technical note applies to:

  • Version 7.0 of Zetadocs for NAV or later
  • Windows Client in Microsoft Dynamics NAV 2015 or NAV 2016

Summary

NAV 2015 introduced a new reporting feature to mark up a report using Word layouts. Version 7.0 version of Zetadocs for NAV or later supports this feature. This technical note details how to manually modify your Zetadocs report using Word Layout.

More information

Dynamics NAV does not display a dialog to select the printer when printing Word Layout reports. It is not a fault of Zetadocs it is standard behaviour in NAV. Please select the Zetadocs PDF printer as your default printer if you intend to use Word Layout reports with Zetadocs.

Verify that your Zetadocs Client is up to date. Old versions of Zetadocs Client show “Unable to load printer output. Automatic retry will occur” in the message window which has been corrected in version 9.3.380 of Zetadocs Client.

Please follow the steps below to manually modify Word Layout for Zetadocs:

  • Modify your report to inject Zetadocs code.
  • Test your RDLC report.
  • Add new entry in Zetadocs Report Settings.
  • Add Zetadocs reference to your Word Layout report and test it.
  • Mark up your Zetadocs modified report to use Word Layout

Modify your report to inject Zetadocs code

It is recommended to use the Zetadocs Report Tool to include code changes in your code. Please note, the Tool is not guaranteed to work for all NAV reports, in which case manual steps are also available in the Zetadocs knowledgebase.

This tool may not work with Mini reports introduced in NAV 2015 or NAV 2016, the following instructions need to be followed to modify Mini reports to work with Zetadocs, simply repeat these steps for each report you wish to configure. Note: The example presented is from aMini Sales – Order Confirmation report, similar steps should be followed for other Mini reports in NAV.

  • Open the report designer for the report that you want to modify.
  • Now add the following global variables:

Name

Data Type

Sub Type

ZdSend

CodeUnit

Zetadocs-Send

ZdRecRef

RecordRef

  • At the end of the header and before the loop add a new entry (Right click on the row right underneath it and click New).

  • Give it the following values:
    • Data Type:Column
    • Data Source:ZdSend.GetZdReference(1)
    • Name:Zetadocs_Reference
  • Scroll to the empty row at the bottom and create a new Integer data item called Zetadocs.
  • Indent this data item once.
  • Select the Zetadocs item and click on properties:
    • Change the DataItemTableView property to SORTING(Number).
    • Change the MaxIteration property to 1.
  • Add the following code to the OnPostDataItem trigger for the Zetadocs data item:

ZdRecRef.GETTABLE(

);

ZdSend.AddRecord(ZdRecRef.RECORDID);

Note: The

is the table upon which the report is based e.g. Although Mini Sales Reports would usually uses the Sales Header it is named Header, for that reason you may need to replace that line for the following: ZdRecRef.GETTABLE(Header);

  • Select an empty row on the report and press F9 to view the report code.
  • Enter the following code after any existing code in the OnPreReport trigger:

ZdSend.Initialize(CurrReport.OBJECTID(FALSE), CurrReport.PREVIEW);

  • Enter the following code after any existing code in the OnPostReport trigger:

ZdSend.ProcessRecords;

CLEAR(ZdSend);

  • Save and Compile your report.

Test your RDLC report

It is highly recommended to test that your report works with Zetadocs using the RDLC layout. In order to make it work you may need to follow the manual steps available to modify the RDLC layout of your report.

Add new entry in Zetadocs Report Settings

Please see the Updating the Zetadocs Report Settings to match your Reports section in the Essentials installation guide to create a new entry in Zetadocs Report Settings.

If the Default Batch Name is not populated in Zetadocs Report Settings the resulting batch name will contain a name similar to the image below; modify the Default Batch Name to prevent this from happening.

Add Zetadocs reference to your Word Layout report

Once the report is modified correctly and working for RDLC layout, the next step is to prepare your report to use Word Layout.

  • Open the report designer for the report that you want to modify.
  • Scroll to the empty row at the bottom and open the report properties.
    • Change the WordMergeDataItem property to match the
      e.g. for a Sales Order Confirmation typically is Sales Header.
    • Check that PreviewMode is set to PrintLayout
    • Check that the DefaultLayout is set to Word

  • Save and compile your report

Word Layout reports in NAV work in two different scenarios: Word (Built-in) and Custom Layout. It is required to enable at least one of them, you can expand your knowledge in this area by consulting Dynamics NAV documentation.

Word (Built-in) option

  • Open the report designer for the report that you want to modify.
  • Scroll to the empty row at the bottom and open the report properties.
  • Select “Tools>Word Layout” from the menu to see the options.
    • Create a new one if it is not created.
    • Export the Word layout.
    • Follow the steps in the next section of this technote to mark up the report with the Word Layout.
    • Import the Word layout.
  • Save and compile your report.
  • Open the Windows Client. Search for Report Layout Selection page and select your report.
  • Select “Word (Built-in)” option in the Select Layout column.

  • Please test your Word Layout to verify that it working with Zetadocs.

Custom Layout option

  • Open the Windows Client. Search for Report Layout Selection page. Select your report.
  • Select “Custom Report” option in the Select Layout column.
  • Create a new Custom Report:
    • Create a new one.
      • Select Import Word Layout checkbox.
    • Export the Word layout.
    • Follow the steps in the next section of this technote to mark up the report with the Word Layout.
    • Import the Word layout.
    • Select the custom report and click OK.

Please verify that the Custom Layout Description has been updated correctly.

  • Click Ok to exit the Report Layout Selection page.
  • Please test your Word Layout to verify that it working with Zetadocs.

Mark up your Zetadocs modified report to use Word Layout

To mark up a Word document you may need to consult Dynamics NAV documentation. Once you know how to add a new field in the Word Layout, please follow the manual steps:

  • Open the Word document that contains the Word Layout for the report that you intend to modify in NAV.
  • In the body of the report, create a new row above the header of the table and add the Zetadocs_Reference from the XML Mapping menu. For example, in a Mini Sales – Order Confirmation the result should be similar to this one:

Note: It is very important to give enough space to the Zetadocs_Reference, combine additional cells if needed:

  • Select the entire row that you have created and change the font colour to white to “hide” it.
  • Save the Word document.

 References

HOWTO: Manually modify the NAV pages, forms and reports

Last updated: 21st October 2015 (JV) 

Keywords: support for NAV 2015 Word layout reports NAV 2016