Skip to content

IGR_Open_File_Ex

IGR_Open_File_Ex opens a document for content extraction or enumeration of sub-documents and controls the output format, including converting the source document to HTML.

Prototype

IGR_LONG IGR_Open_File_Ex(
    const IGR_UCS2* FileName,
    IGR_LONG Flags,
    const IGR_UCS2* Options,
    IGR_LONG* Capabilities,
    IGR_LONG* DocType,
    IGR_LONG* DocHandle,
    Error_Control_Block* ISYSError);

Parameters

FileName: Unicode string (UCS2)

Path to the document to be opened.

Flags: IGR_LONG

Specifies what type of data is returned from subsequent calls to the IGR_Get_Text function. These Open Document Flags affect the verbosity or the format of the extracted data.

Options: Unicode string (UCS2)

Extended processing options, used when converting the document to HTML. The Open Document Options are expressed as Name=Value with a semicolon delimiter.

Capabilities: Pointer to IGR_LONG

Returns the Document Capabilities as a bit field.

DocType: Pointer to IGR_LONG

Returns the Document Format Code of the document.

DocHandle: Pointer to IGR_LONG

Returns a handle to be used in subsequent calls.

ISYSError: Pointer to Error_Control_Block

Returns error details if the call fails.

Return value

Success: IGR_LONG

Returns IGR_OK.

Failure: IGR_LONG

Returns one of the possible IGR_E error codes.

Sample code

Error_Control_Block ISYSError;
IGR_LONG Capabilities, DocType, DocHandle;

IGR_LONG RC = IGR_Open_File_Ex(_UCS2("TEST.DOC"), IGR_BODY_AND_META | IGR_FORMAT_HTML,
 _UCS2("IMAGEPATH=C:\\Temp"), &Capabilities, &DocType, &DocHandle, &ISYSError);

if (RC == IGR_OK)
{
    // Extract document text or sub-documents...
    IGR_Close_File(DocHandle, &ISYSError);
}

Additional information

The call will establish a link to the document and populates a handle. The handle can be used to extract the text by calling IGR_Get_Text, generate page images with IGR_Open_Page, or enumerate and extract the sub-documents by calls to IGR_Get_Subfile_Entry and IGR_Extract_Subfile respectively.

The application must call IGR_Close_File when finished using the document.

See also