Sample code for 30+ languages & platforms
PowerBuilder

Add an External Style Sheet for MHT Conversion

See more MHT / HTML Email Examples

Demonstrates Mht.AddExternalStyleSheet, which adds a style-sheet URL to the list of external CSS resources downloaded and embedded during conversion.

Background. This is normally unnecessary because Chilkat automatically discovers references present in the static HTML. It is useful when a stylesheet is applied by means Chilkat cannot detect from the static markup.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Mht
string ls_MhtText

loo_Mht = create oleobject
li_rc = loo_Mht.ConnectToNewObject("Chilkat.Mht")
if li_rc < 0 then
    destroy loo_Mht
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  Add an external style-sheet URL to the list of CSS resources downloaded and embedded during
//  conversion.  This is normally unnecessary because Chilkat automatically discovers
//  <link rel="stylesheet"> references in the static HTML.
loo_Mht.AddExternalStyleSheet("https://example-code.com/crumb/style.css")

//  Create the MHT web archive.  The external style sheet is downloaded and embedded.
ls_MhtText = loo_Mht.GetMHT("https://example-code.com/crumb/index.html")
if loo_Mht.LastMethodSuccess = 0 then
    Write-Debug loo_Mht.LastErrorText
    destroy loo_Mht
    return
end if

Write-Debug ls_MhtText


destroy loo_Mht