Use Style Sheets

You can use style sheets to define the overall layout and type specifications of the HTML output. Export can write style sheet information to an external Cascading Style Sheet (CSS) file, or read the information from an existing CSS file during the conversion. The formatting data can either be stored within the output HTML file (inline), or externally in a CSS file. Using an external style sheet makes the HTML output significantly smaller, and allows you to use the same style sheet for many conversions. The style sheet options are enumerated in KVHTMLStyleSheetType.

NOTE: Cascading style sheets can be used only with word processing documents.

To enable CSS formatting and output the generated formatting data within the output HTML stream, set eStyleSheetType member to CSS_INLINE, either directly in the KVHTMLOptionsEx structure or in the template file.

NOTE: You cannot retrieve the CSS if you have set bNoPictures to TRUE (see KVHTMLOptionsEx).

To enable CSS formatting and output the generated formatting data in an external CSS file that is referenced in the HTML output as a tag

  1. Set eStyleSheetType to CSS_TOFILE, either directly in the KVHTMLOptionsEx structure or in the template file.

  2. In the template file, use the $STYLESHEET token to specify the URL of the style sheet in the HTML output. The external CSS file is referenced in the output HTML by a LINK statement of the form:

    <LINK rel="STYLESHEET" href="CSS_file" type="text/css">
  3. Call the KVHTMLSetStyleSheet() function to set the path and file name of the external style sheet. See KVHTMLSetStyleSheet().

The sample program htmlini provides an example of using style sheets. htmlini.