(PowerBuilder) Convert HTML to Plain Text
Demonstrates how to convert HTML to plain text.
integer li_rc
oleobject loo_H2t
string ls_Html
string ls_PlainText
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_H2t = create oleobject
// Use "Chilkat_9_5_0.HtmlToText" for versions of Chilkat < 10.0.0
li_rc = loo_H2t.ConnectToNewObject("Chilkat.HtmlToText")
if li_rc < 0 then
destroy loo_H2t
MessageBox("Error","Connecting to COM object failed")
return
end if
ls_Html = loo_H2t.ReadFileToString("c:/temp/test.html","utf-8")
if loo_H2t.LastMethodSuccess = 0 then
Write-Debug loo_H2t.LastErrorText
destroy loo_H2t
return
end if
ls_PlainText = loo_H2t.ToText(ls_Html)
if loo_H2t.LastMethodSuccess = 0 then
Write-Debug loo_H2t.LastErrorText
destroy loo_H2t
return
end if
Write-Debug ls_PlainText
destroy loo_H2t
|