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)
The Dynamics NAV object type that is run. Currently only Report is supported.
The ID of the Dynamics NAV object.
The action that runs a report the request page or function call. The parameter has the following values: SaveAsPdf, SaveAsWord, SaveAsExcel, Preview, or Print.
The report data as structured XML.
The delivered XML is in the same format as the XML that is produced by calling the SAVEASXML Function (Reports).
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.
Report layout implementation in codeunit 1 ApplicationManagement.
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.
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..
IF ObjectType <> ObjectType::Report THEN ERROR(NotSupportedErr); DocumentReportMgt.MergeWordLayout(ObjectID,ReportAction,XmlData,FileName);