HTML Add-on Interface
You do not necessarily need to create a Htn object to do standard import and export of HTML data within TE Edit Control. Simply copy htn24.dll to the application directory containing tern32.dll.
Now use the TerSetHtnLicenseKey method to set the license key for HTML Add-on. The license key for HTML Add-on is e-mailed to you after your order for HTML Add-on is processed. Please note that your license key for TE Edit Control is not valid for HTML Add-on.
tern1.TerSetHtnLicenseKey("xxxxx-yyyyy-zzzzz")Export TE document as HTML:
First set the output format to SAVE_HTML using the TerSetOutputFormat method:
tern1.TerSetOutputFormat(tc.SAVE_HTML)
Now you can use any of the TE's output methods or properties to extract the data in the HTML format:
string HtmlText=tern1.Data
Import an HTML document into TE:
First set the input format as html:
tern1.TerSetFlags4(True,tc.TFLAG4_HTML_INPUT)
Now you can use any of the TE's input methods or properties to insert html data into TE:
tern1.Data = HtmlText
In the above examples, TE automatically creates an HTML object for you to do input or output of html data. However, you can also create the HTML object explicitly. The later method is suitable if you need to call the html methods (such as HtsSetFlags) prior to doing export or import of html data.
Explicitly creating Htn object for doing HTML import/export:
First create an Htn object and pass it to TE:
using SubSystems.TE; // namespace containing TE methods - C# syntax
using SubSystems.HT; // namespace containing Htn methods
Imports SubSystems.TE ' VBN syntax
Imports SubSystems.HT ' VBN syntax
HTN htn1=new Htn(tern1) // pass the Tern class object to bind to the
new Htn object// set the license key. Your license key for HTML Add-on is e-mailed to you after your order for HTML Add-on is processed.
Htn.HtsSetLicenseKey(xxxx-yyyy-zzzz)
// Now pass the Htn object to TE.
tern1.TerSetHtnObject(htn1)
Now TE can use this Htn object to do import or export of HTML data as described earlier in this topic.