createdocxfromhtml
Web icon

CreateDocxFromHtml

Stable version 2.2.11 (Compatible with OutSystems 11)
Other versions available for 10
Uploaded
 on 18 December 2018
 by 
5.0
 (12 ratings)
createdocxfromhtml

CreateDocxFromHtml

Documentation
2.2.11

CreateDocx From Html

Outsystems Forge provides a large set of reusable assets that help accelerate application delivery. These assets are made available by our community uses and by Outsystems.

When searching CreateDocxFromHtml in Outsystems Forge.


Overview

The CreateDocxFromHtml extension allows developers to generate .docx files dynamically from HTML content. The extension writes the generated .docx file to a specified location on the server. After the file is created, it can be read and downloaded using the appropriate OutSystems actions.

How It Works

  1. Input Parameters:

FilePath: Full path and filename (e.g., C:\Files\GeneratedDocument.docx).

HtmlContent: The HTML source string to be converted into a .docx file.

  1. Output:

A .docx file is created at the specified location.

  1. Follow-up Steps:

Use the File_ReadBinary action to read the generated file into binary format.

Serve the binary content to the end user as a downloadable file.

  1. MIME Type:

For downloading, use the MIME type:
application/vnd.openxmlformats-officedocument.wordprocessingml.document.

How to Use

  1. Add the Extension to Your Application
    Install the CreateDocxFromHtml extension from Forge and add it as a dependency to your module.
  2. Configure Input Parameters
    Use the CreateDocxFromHtml action and provide:

FilePath: Path with filename where the document should be created.

HtmlContent: HTML source to be converted.

  1. Read the Generated File
    Use the File_ReadBinary system action to read the generated file from the path specified in FilePath.
  2. Enable File Download
    Use a download widget or logic to send the binary file to the user with the correct MIME type.

Example Usage

Input Example:

FilePath: C:\Files\Document.docx

HtmlContent:

html

Copy code

<html>

  <body>

    <h1>Hello, World!</h1>

    <p>This is a sample document generated from HTML.</p>

  </body>

</html>


Output:

A .docx file containing:

css

Copy code

Hello, World!

This is a sample document generated from HTML.


Common Issues

File Path Not Accessible:
Ensure that the server has write permissions to the specified location.

Invalid HTML Content:
The HTML source should be well-formed. Ensure that all tags are properly closed.

Dependencies

OutSystems Platform.

File System Permissions (to create and read files).

Additional Notes

This extension is suitable for scenarios like report generation, exporting rich-text content, or creating dynamic documents in an OutSystems application.

Compliance

License adherence: Ensure that external libraries (like the Microsoft Excel Package) comply with their respective licensing terms.

Support and Maintenance

Up-to-date with OutSystems version: Ensure the extension is compatible with the latest version of OutSystems.

Active support: Be responsive to user feedback, resolve reported issues promptly, and provide updates.

Documentation updates: Keep the extension's documentation current with any new features or changes.