KeyView 23.2

# Convert

Converts a document to text, RTF, or HTML format.

Before you convert a document, you must open it by using the Open method. To make sure that the entire document is opened before the document is converted, set the OPENWaitOnOpen property to `TRUE`. Use the CanSaveAs property to check whether the document is completely processed and is ready for conversion.

To convert a document without viewing it, set the OPENMode property to `2` (open without generating a view).

## Syntax

    bRet = KeyView.Convert(FormatCode, TargetFile)

## Parameters

Parameter | Type | Description
--- | --- | ---
`FormatCode` | String | The format code of the format to which to convert the document. The following options are available: `txt` — conversion to text format `rtf` — conversion to RTF format `htm` — conversion to HTML format
`TargetFile` | String | The target path and file name for the converted file.

## Returns

Type | Description
--- | ---
Boolean | `TRUE` if the method succeeds. `FALSE` if the method fails.

## Example

The following code converts a file to RTF:

    Function ConvertToRTF(FileName As String, TargetFile As String) As Boolean

    KeyView.OPENMode = 2

        nRet = KeyView.Open(FileName)

        If (nRet = 1) Then

            bRet = KeyView.Convert("rtf",TargetFile)

        End If

        bRet2 = KeyView.Close

        ConvertToRTF = bRet

    End Function

In this example, `OPENMode` is set to `2` to prevent a view of the document.

Copyright 2016-2023 Open Text
Version 23.2 | Last updated March 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.2

Topic Title: Convert