---
title: "Codeunit 9651 Document Report Mgt."
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/9651-document-report-mgt/
type: codeunit
id: 9651
name: "Document Report Mgt."
app: "Base Application"
namespace: Microsoft.Foundation.Reporting
versions: "17-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/9651-document-report-mgt/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 9651 Document Report Mgt.

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/9651-document-report-mgt/

| | |
| --- | --- |
| App | Base Application |
| Namespace | Microsoft.Foundation.Reporting |
| Versions | 17-28 |
| Source file | Foundation/Reporting/DocumentReportMgt.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| MergeWordLayout | (Integer, Option, InStream, Text) | - | public | 17 | Pending 15.3 | Update calling code to use the function with an OutStream parameter |
| MergeWordLayout | (Integer, Option, InStream, Text, var OutStream) | - | public | 17-22 | Pending 20.0 | This procedure will be replaced by the report event CustomDocumentMerger. Subscribe to it to override the merging behavior. |
| TryXmlMergeWordDocument | (var InStream, var InStream, var OutStream) | Boolean | public | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| ValidateWordLayout | (Integer, InStream, Boolean, Boolean) | Boolean | public | 17-28 | - | - |
| TryUpdateWordLayout | (InStream, var OutStream, Text, Text) | Text | public | 17-28 | - | - |
| TryUpdateRdlcLayout | (Integer, InStream, OutStream, Text, Text, Boolean) | Text | public | 17-28 | - | - |
| NewWordLayout | (Integer, var OutStream) | - | public | 17-28 | - | - |
| ConvertWordToPdf | (var Codeunit Temp Blob, Integer) | - | public | 17-28 | - | - |
| ConvertWordToHtml | (var Codeunit Temp Blob) | - | public | 17-28 | - | - |
| IsStreamHasDataset | (InStream) | Boolean | public | 17-28 | - | - |
| ApplyUpgradeToReports | (var DotNet ReportUpgradeCollection, Boolean) | Boolean | public | 17-28 | - | - |
| CalculateUpgradeChangeSet | (var DotNet ReportUpgradeCollection) | - | public | 17-22 | Pending 20.0 | The upgrade will be handled by the platform. |
| BulkUpgrade | (Boolean) | - | public | 17-28 | - | - |
| GetWordLayoutStream | (Integer, var OutStream, var Boolean) | - | public | 20-22 | Pending 20.0 | This procedure will be eventually replaced by platform functionality. Subscribe to the event FetchReportLayoutByCode instead. |
| NewRdlcLayout | (Integer, var OutStream) | - | public | 25-28 | - | - |
| NewExcelLayout | (Integer, var OutStream) | - | public | 25-28 | - | - |
| NewExcelLayout | (Integer, Enum Excel Sheet Configuration, var OutStream) | - | public | 26-28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnAfterConvertToPdf | (var Codeunit Temp Blob, Integer) | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| Integration event | OnAfterGetCustomLayoutCode | (Integer, var Code[20]) | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| Integration event | OnAfterMergeWordDocument | (Integer, InStream, var Codeunit Temp Blob) | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| Integration event | OnBeforeMergeDocument | (Integer, Option, var InStream, Text, OutStream, var Boolean, Boolean) | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| Integration event | OnBeforeMergeWordDocument | () | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| Integration event | OnBeforeCalculateUpgradeChangeSetSetCustomReportLayoutFilters | (var Record Custom Report Layout) | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| Integration event | OnMergeReportLayoutOnSuppressCommit | (Integer, var Boolean) | 17-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |
| Integration event | OnAfterTryXmlMergeWordDocument | (var OutStream) | 19-22 | Pending 20.0 | The rendering of Word documents will be handled on the Platform. To override the behavior, subscribe on the report event CustomDocumentMerger. |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
