KeyView 23.4

# 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 the `HtmlOptionInfo` class to set the option to `HtmlExport.STYLESHEET_CSS_INLINE`.

- Set the `eStyleSheetType` parameter in a template file to `CSS_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

1. Set the style sheet type to an external file by using one of the following methods:

   - Use the `setStyleSheetType` method of the `HtmlOptionInfo` class to set the type to `HtmlExport.STYLESHEET_CSS_TOFILE` .

   - Set the `eStyleSheetType` parameter in a template file to `CSS_TOFILE`.

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 `setExternalStyleFile` method of the `Export` 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.

Copyright 1997-2023 Open Text
Version 23.4 | Last updated September 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL KeyView 23.4

Topic Title: Use Style Sheets