Created on 19 April 2021
icon_unfollowing
Login to follow
worddocumentutility

Word Document Utility

Stable version 1.0.2 (Compatible with OutSystems 11)
Uploaded on 14 February 2022 by 
worddocumentutility

Word Document Utility

Documentation
1.0.2

Word utility is providing below functionality 

  1. Convert Word to HTML
  2. Convert Normal Json String to Key Pair JSON 
  3. Search Text and replace plain text + HTML string 

1. Convert Word to HTML

Using here the OpenXML library for converting the word to HTML string 


2. Convert Normal Json String to Key Pair JSON

This will help for sample JSON to key pair JSON for replacing the string

e.g. 

{

'CompanyName':'ABC Pvt. Ltd.'

}

Convert To Key Pair 

[{'Name':'CompanyName','Value':'ABC Pvt. Ltd.'} 


3. Search Text and replace plain text + HTML string  


Create word template and place the parameter values from your database.


  1. Refer the sample string and create the word document. 


{{CompanyName}}

{{StreetAddress}}

{{Phone}} 

{{Email}}

{{WebSite}}

Case Number :{{CaseNumber}}

{{RecipientName}}

{{StreetAddress1}}


Dear Recipient,

Write the body of your letter here.  To update any of the information in this letter, simply click and start typing!

Want to customize your color palette?  Just go to the Design ribbon, and select Colors from the list.  If you choose a color palette that you like, the colors of the header images will update, as will the text colors.  Make the document yours!

Want to change the fonts that are used?  That is just as easy to update.  Just go to the Design ribbon and choose Fronts from the menu options.  You can use a built-in font combination or choose one of your own.  

Warm regards,

{{UserName}}

{{Title}}


Refer the below JSON for replacing text values 

[{'Name':'CompanyName','Value':'ABC Pvt. Ltd.'},

  {'Name':'StreetAddress','Value':'Head Office, Santacruz East.'},

  {'Name':'Phone','Value':'9067001347'},

  {'Name':'Email','Value':'shahaji.nangare@gmail.com'},

    {'Name':'WebSite','Value':'www.google.com'},

   {'Name':'CaseNumber','Value':'28923'},

  {'Name':'RecipientName','Value':'test'},

  {'Name':'StreetAddress1','Value':'n/a'},

    {'Name':'UserName','Value':'Shahaji'},

    {'Name':'Title','Value':'<b>Mr.</b>'}

  ]


Supported Html tags

Refer to w3schools’ tag list to see their meaning

  • <a>
  • <h1-h6>
  • <abbr> and <acronym>
  • <b>, <i>, <u>, <s>, <del>, <ins>, <em>, <strike>, <strong>
  • <br> and <hr>
  • <img>, <figcaption>
  • <table>, <td>, <tr>, <th>, <tbody>, <thead>, <tfoot> and <caption>
  • <cite>
  • <div>, <span>, <font> and <p>
  • <pre>
  • <sub> and <sup>
  • <ul>, <ol> and <li>
  • <dd> and <dt>
  • <q> and <blockquote> (since 1.5)
  • <article>, <aside>, <section> are considered like <div>

Javascript (<script>), CSS <style>, <meta> and other not supported tags does not generate an error but are ignored.

Tolerance for bad formed HTML

The parsing of the Html is done using a custom Regex-based enumerator. These are supported:


samples
Ignore case<span>Some text<SPAN>
Missing closing tag or invalid tag position<i>Here<b> is </i> some</b> bad formed html.
no need to be XHTML compliantBoth <br> and <br/> are valid
Colorred, #ff0000, #f00, rgb(255,0,0,.5), hsl(0, 100%, 50%) are all the red color
Attributes<table id=table1> or <table id="table1">

Support options
This asset is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from  who created this asset.
Dependencies
Word Document Utility has no dependencies.