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.
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 the style sheet type to inline by using one of the following methods:
-
Use the
setStyleSheetType
method of theHtmlOptionInfo
class to set the option toHtmlExport.STYLESHEET_CSS_INLINE
. -
Set the
eStyleSheetType
parameter in a template file toCSS_INLINE
.
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
-
Set the style sheet type to an external file by using one of the following methods:
-
Use the
setStyleSheetType
method of theHtmlOptionInfo
class to set the type toHtmlExport.STYLESHEET_CSS_TOFILE
. -
Set the
eStyleSheetType
parameter in a template file toCSS_TOFILE
.
-
-
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 aLINK
statement of the form:<LINK rel="STYLESHEET" href="CSS_file" type="text/css">
-
Call the
setExternalStyleFile
method of theExport
object to set the path and file name of the style sheet file.-
If the file does not exist in the specified location, it is created.
-
If the file exists, but is empty, CSS styles are written to the file.
-
If the file exists and is not empty, the conversion attempts to use the predefined styles, and appends any new styles that are required for the conversion.
-
If the file is not a CSS file or if it points to a non-existent directory, the
LINK
statement is written, but the style sheet information is added inline (CSS_INLINE
), and an external CSS file is not generated. -
If a style file has been set, you can disable it for the next convert call by calling the
setExternalStyleFile
method again and passing in an empty string.
-