community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

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

Yun Zhu · 2025-05-14 · 496 words · about 2 min

"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.

No source states these links: they share an object, a model read them, or a person found the same subject.

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.