Sample code for 30+ languages & platforms
DataFlex

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 DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoMht
    String sMhtText
    String sTemp1
    Boolean bTemp1

    Get Create (RefClass(cComChilkatMht)) To hoMht
    If (Not(IsComObjectCreated(hoMht))) Begin
        Send CreateComObject of hoMht
    End

    //  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.
    Send ComAddExternalStyleSheet To hoMht "https://example-code.com/crumb/style.css"

    //  Create the MHT web archive.  The external style sheet is downloaded and embedded.
    Get ComGetMHT Of hoMht "https://example-code.com/crumb/index.html" To sMhtText
    Get ComLastMethodSuccess Of hoMht To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoMht To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln sMhtText


End_Procedure