Dynamics 365 Business Central: Convert Word (.docx) To HTML (.html) within BC (No control add-in and APIs)
Converting Word (.docx) files to HTML (.html) format within Business Central using the built-in ConvertWordToHtml procedure from codeunit 9651 without requiring control add-ins or external APIs. The post demonstrates two practical approaches: converting attachments in Document Attachment Details and uploading Word documents for conversion.

post Dynamics 365 Lab
"If you encounter a file that cannot be converted, the following error message will be displayed"
Key points
- Business Central provides a standard method via codeunit 9651 ‘Document Report Mgt.’ with the ConvertWordToHtml procedure
- The conversion can be performed on Word files stored as document attachments or uploaded directly
- Implementation uses TempBlob codeunit to handle file streaming and conversion
- Some Word documents with unsupported package content may fail conversion with a specific error message
Quotes
- “If you encounter a file that cannot be converted, the following error message will be displayed” (Alerts developers to potential conversion failures with unsupported Word document structures and helps with error handling)
AL objects mentioned
As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.
- codeunit 9651 “Document Report Mgt.”
- codeunit 4100 “Temp Blob”
- codeunit 419 “File Management”
- table 1173 “Document Attachment”
- other “DocumentAttachmentDetailsExt”
- other “CustomerListExt”
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- Attachment capabilities and limitations (preview) — possibly related: names Codeunit 4100 “Temp Blob”
- Dynamics 365 Business Central: Convert Word (.docx) To PDF (.pdf) within BC (No control add-in and APIs) — possibly related: both name Codeunit 9651 “Document Report Mgt.”
- Dynamics 365 Business Central: Generate Swiss QR Code without external services/APIs — possibly related: both name Codeunit 4100 “Temp Blob”
- Dynamics 365 Business Central: How to get the page number of a PDF or Word file in AL (Display the page count on Attached Documents and Doc. Attachment List Factbox) — possibly related: both name Table 1173 “Document Attachment”
- Dynamics 365 Business Central: How to prevent users from uploading duplicate files as attachments (Duplicate file names) — possibly related: both name Table 1173 “Document Attachment”
- Dynamics 365 Business Central: How to preview Word (.docx) in web client without downloading (No control add-in and APIs) — possibly related: both name Codeunit 9651 “Document Report Mgt.”
- Dynamics 365 Business Central: How to quickly strip not supported chars in File Name via AL — possibly related: both name Codeunit 419 “File Management”
- Dynamics 365 Business Central: previewing PDF files in web client using the new ExtendedDataType = Document. — possibly related: both name Codeunit 419 “File Management”
- New Application Ideas of Dynamics 365 Business Central (2025 MAY) — possibly related: both name Table 1173 “Document Attachment”
- Step by Step Guide to Importing Excel Data into Business Central — possibly related: both name Codeunit 419 “File Management”
Heads up
- warning: “If you encounter a file that cannot be converted, the following error message will be displayed.” (about codeunit Document Report Mgt.)
Context
- Features: HTML output, document attachment handling, file upload and conversion, stream processing
- Versions: Business Central 2023 wave 2 (BC23)
Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.