KeyView 24.2

# KVHTMLSetStyleSheet()

This function is called directly and is used to specify the full path and file name of an external Cascading Style Sheet (CSS).

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

## Syntax

    BOOL pascal KVHTMLSetStyleSheet(
        void    *pContext,
        char    *pszStyleSheetName,
        char    *pszUrlRef);

## Arguments

`pContext` | A pointer to a KeyView Export session that you initialized by calling fpInit().
`pszStyleSheetName` | A pointer to the full path and file name of the style sheet.
`pszUrlRef` | A pointer to the URL or file name of style sheet.

## Returns

- If the call is successful, the return value is `TRUE`.

- If this call is unsuccessful, the return value is `FALSE`.

## Discussion

- When the value for `eStyleSheetType` in `KVHTMLOptionsEx` is set to CSS_TOFILE, and the token `$STYLESHEET` is specified in the templates, an external CSS file is referenced in the output HTML by a LINK statement of the form:

      <LINK rel="STYLESHEET" href="pszRef" type="text/css">

- If the name of the style sheet is not specified by using this function, a style sheet file is created with an automatically generated file name.

- If this function is used to specify the name of the style sheet file, that file name is used in the conversion.

  - 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 value for `pszStyleSheetName` includes the output directory, the `href` only consists of the file name because the HTML output resides in the same directory as the CSS file.

- If the value for `pszStyleSheetName` points to a directory other than the output directory, the `href` consists of the full path and file name.

- If the value for `pszStyleSheetName` points to a file that is not a CSS file or 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 there are multiple calls made to `fpConvertStream()` or `KVHTMLConvertFile()`, and the name of the style sheet is set with `KVHTMLSetStyleSheet`, the file name can be disabled by calling `KVHTMLSetStyleSheet` again with the `pszStyleSheetName` and `pszUrlRef` set to `NULL`. The file name can then be set to a different value by calling `KVHTMLSetStyleSheet` with the new file name prior to the next call to `fpConvertStream()` or `KVHTMLConvertFile()`.

- This function runs in-process or out of process. See Convert Files Out of Process.

- When converting out of process, this function must be called after the call to `KVHTMLStartOOPSession()` and before the call to `KVHTMLEndOOPSession()`. See KVHTMLStartOOPSession() and KVHTMLEndOOPSession().

- On Windows, `pszStyleSheetName` must be in the local Windows code page.

Copyright 1997-2024 Open Text
Version 24.2 | Last updated March 2024

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 MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL KeyView 24.2

Topic Title: KVHTMLSetStyleSheet()