Convert from HTML to Word
Audience:
Low-code EngineersSkill Prerequisites:
HTML,Tokens
Converts HTML into a Word document (.docx) and saves it in a portal folder. You can start from a blank document, or from a Word template whose page setup, styles, headers and footers are kept.
This action is marked as obsolete in the product and will be replaced by a specialized Word add-on. It still works. Its replacement is Html to Word (.docx) - Experimental in the Word add-on. Also consider Replace Tokens in Word Document for template-based documents, or Generate PDF if the output doesn't need to be editable.
Typical Use Cases
- Export a record or report as an editable Word document
- Turn rich text entered in a form into a Word file
- Add generated content to a branded template, for example a letterhead with a company header and footer
Don't use it to
- Fill in placeholders in an existing Word layout. Use Replace Tokens in Word Document instead.
- Create documents that must look exactly like a web page. Word supports only part of what HTML and CSS can do.
Related Actions
| Action Name | Description |
|---|---|
| Replace Tokens in Word Document | Fills in content controls in a Word template. |
| Generate PDF | Creates a PDF from HTML. |
| Send Email | Sends the generated document as an attachment. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| HTML | The HTML to convert. Headings, paragraphs, text formatting, lists, tables, links and images are supported. | Yes | empty string | Yes |
| Template File Identifier | Optional. A .docx file to use as the starting document, as a file ID or a path relative to the portal root. For example, if the file is Portals/0/Templates/Letterhead.docx, enter Templates/Letterhead.docx. The HTML is added to the end of the template's body. Leave empty to start with a blank document. | Yes | empty string | No |
| Folder | The folder to save the document in. Select a folder, or in expression mode enter a folder path relative to the portal root, for example Images/ExampleFolder, which is saved in Portals/<PortalID>/Images/ExampleFolder. The folder is created if it doesn't exist. If empty, the document is saved in the Temp folder. | Yes | none selected | Yes |
| Pattern | The name for the document, without the extension, for example generated-document-[User:Username]. .docx is always added. Leave empty to use a random name. | Yes | empty string | No |
| Handle Duplicates | What happens if a file with the same name already exists in the folder. Rename saves the new document with a unique suffix added to its name. Overwrite replaces the existing file. | No | Rename | No |
Output Parameters Reference
| Parameter | Description |
|---|---|
| Output Token Name | Optional. The name of the token that stores details of the new document. See the tokens in the next table. |
If Output Token Name is WordDoc, the following tokens are created. [WordDoc] on its own isn't set, so always use a property.
| Token | Description |
|---|---|
[WordDoc:FileId] | The document's file ID. |
[WordDoc:FileName] | The file name without the extension. |
[WordDoc:FileNameAndExtension] | The file name with the extension. |
[WordDoc:FileExtension] | docx. |
[WordDoc:RelativeUrl] | The URL relative to the site root. |
[WordDoc:AbsoluteUrl] | The absolute URL. |
[WordDoc:FilePath] | The physical path on the server. |
[WordDoc:FolderId] | The ID of the folder that contains the document. |
[WordDoc:FolderPath] | The path of the folder that contains the document. |
[WordDoc:FileSize] | The file size. FileSizeB, FileSizeKB, FileSizeMB and FileSizeGB give the size in a specific unit. |
[WordDoc:MimeType] | The MIME type. |
[WordDoc:Base64] | The file contents as a Base64 string. |
[WordDoc:Stream] | The file contents as a stream, for example to save into a database. |
[WordDoc:LinkClick] | Obsolete. Use RelativeUrl or AbsoluteUrl instead. |
Considerations
- Images. Relative image paths are resolved from the website root, so use paths such as
/Portals/0/Images/logo.png. Absolutehttps://URLs are downloaded when the document is generated. - Styling. Inline styles and basic formatting convert best. Complex CSS layouts, such as flexbox or grid, aren't converted.
- Update fields prompt. When a template is used, the document is set to update its fields when it's opened, so tables of contents in the template are refreshed. Word asks the user to confirm this when the document is opened.
- Folder IDs. Use a folder path in
Folderrather than a folder ID. - The template must have the
.docxextension, otherwise the action fails.
Examples
To understand how to use the below examples, please see Running Examples.
1. Create a Word document from HTML and download it
The first action converts a short HTML summary into Exports/summary-<Username>.docx. The second action redirects the browser to the document so it downloads.
[
{
"Title": "Convert from HTML to Word",
"ActionType": "HTMLtoWord",
"Description": "Build the summary document",
"Condition": null,
"Parameters": {
"HTML": "<h1>Account summary</h1>\n<p>Prepared for <strong>[User:DisplayName]</strong>.</p>\n<table border=\"1\">\n <tr><th>Item</th><th>Value</th></tr>\n <tr><td>Email</td><td>[User:Email]</td></tr>\n</table>",
"TemplateFileIdentifier": "",
"Folder": {
"Expression": "Exports",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"Pattern": "summary-[User:Username]",
"Duplicates": {
"Expression": "",
"Value": "Overwrite",
"IsExpression": false,
"Parameters": {}
},
"OutputTokenName": "WordDoc"
}
},
{
"Title": "Redirect to URL",
"ActionType": "RedirectToUrl",
"Description": "Download the document",
"Condition": null,
"Parameters": {
"Url": "[WordDoc:AbsoluteUrl]",
"EscapeUrl": "",
"OpenInPopup": "",
"PopupTitle": "",
"OpenInNewTab": "",
"ForceDownload": true
}
}
]
Revised 09/25/2026