Loads the custom Word layout that is currently set up to use on the report and renders it in the targeted format, such as Word or PDF.

MergeDocument(ObjectType : 'Report'; ObjectID : Integer;ReportAction : 'SaveAsPdf,SaveAsWord,SaveAsExcel,Preview,Print'; XmlData : Instream; FileName : Text)

Parameters

ObjectType

Type: Option

The Microsoft Dynamics NAV object type that is run. Currently only Report is supported.

ObjectID

Type: Integer

The ID of the Microsoft Dynamics NAV object.

ReportAction

Type: Option

The action that runs a report the request page or function call. The parameter has the following values: SaveAsPdf, SaveAsWord, SaveAsExcel, Preview, or Print.

XmlData

Type: Instream

The report data as structured XML.

Note
The delivered XML is in the same format as the XML that is produced by calling the SAVEASXML Function (Reports).

FileName

Type: Text

The path and the name of the report file that is returned by the report request page action or function calls SaveAsWord, SaveAsPdf, or SaveAsExcel. The parameter is empty for Preview and Print actions.

Applies To

Report layout implementation in codeunit 1 ApplicationManagement.

Remarks

At report run time, this function is called if the HasCustomLayout Function determines that the report is currently set up to use a custom Word layout. The MergerDocument function is called after the OnPostReport Trigger is invoked.

Example

The following example shows the default implementation on the function in codeunit 1. This example uses a variable DocumentReportMgt that has the data type Codeunit and subtype Document Report Mgt..

 Copy Code
IF ObjectType <> ObjectType::Report THEN
    ERROR(NotSupportedErr);
DocumentReportMgt.MergeWordLayout(ObjectID,ReportAction,XmlData,FileName);

See Also