{"title":"WordMergeDataItem Property","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/properties/devenv-wordmergedataitem-property/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-wordmergedataitem-property, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-wordmergedataitem-property","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Specifies the root-level DataItem that is used to generate separate reports for multiple records.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Applies to","slug":"applies-to","at":158,"chars":22},{"level":2,"title":"Syntax","slug":"syntax","at":180,"chars":128},{"level":2,"title":"Remarks","slug":"remarks","at":308,"chars":1408},{"level":2,"title":"Example","slug":"example","at":1716,"chars":1079},{"level":2,"title":"Related information","slug":"related-information","at":2795,"chars":260}],"text":"> Version: _Available or changed with runtime version 1.0._\nSpecifies the root-level DataItem that is used to generate separate reports for multiple records.\n## Applies to\n Report\n## Syntax\n```al\nWordMergeDataItem = MyDataItem; // MyDataItem must be present as a top-level dataitem in the report dataset\n```\n## Remarks\nThe WordMergeDataItem property is only applied when rendering a report using a Word layout.\nWhen you specify a dataitem in the WordMergeDataItem property, the Business Central server does a \"Mail merge\" between that data item (and the ones below it) and the Word layout when rendering the report using the Word layout.\nIn versions before Business Central 2024 release wave 2, Business Central Server implements the document merging by first generating the full merged document in Word. Then, it inserts Word sections to reset headers, footers, and page numbers between each document generated from the WordMergeDataItem. This behavior means that the use of Word sections in layouts for reports using the WordMergeDataItem property aren't allowed. At runtime, the Business Central Server shows an error message such as `You cannot run the report because the {0} layout contains section breaks that conflict with the sections in the report. Remove the section breaks from the report layout, and then run the report`.\nStarting from version 2024 release wave 2, the Business Central Server implements the document merging by generating one document in Word for each row in the WordMergeDataItem. It then converts each document to a PDF and merges all the PDF documents. As a result, there's no longer the restriction on using Word sections in layouts for reports using the WordMergeDataItem property.\n## Example\nThe following example is showing how the WordMergeDataItem property is used on the \"Standard Sales - Invoice\" report when rendered with a Word layout.\nHere, the Word layout is applied to each element in the Header dataitem. So, if you defined a different first page, page numbers, totals at the end, and similar report design elements in the Word layout, they're \"reset\" for each element in the Header dataitem.\n```al\nreport 1306 \"Standard Sales - Invoice\"\n{\n    // Other report properties set here\n\n    WordMergeDataItem = Header;\n\n    dataset\n    {\n        dataitem(Header; \"Sales Invoice Header\")\n        {\n            ...\n        }\n    }\n\n    ...\n\n    rendering\n    {\n        layout(\"StandardSalesInvoice.docx\")\n        {\n            Type = Word;\n            LayoutFile = './Sales/History/StandardSalesInvoice.docx';\n            Caption = 'Standard Sales Invoice (Word)';\n            Summary = 'The Standard Sales Invoice (Word) provides a simple layout that is also relatively easy for an end-user to modify.';\n        }\n\n        // more layouts here\n    }\n}\n```\n## Related information\nCreating a Word layout report<../devenv-howto-report-layout>\nWorking with Word layouts</ui-how-add-fields-word-report-layout?toc=/dynamics365/business-central/dev-itpro/toc.json>\n../devenv-report-object\nReport overview<../devenv-reports>"}