Skip to content

IGR_Open_File

IGR_Open_File opens a document for content extraction or enumeration of sub-documents.

Prototype

IGR_LONG IGR_Open_File(
    const IGR_UCS2* FileName,
    IGR_LONG Flags,
    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.

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(_UCS2("TEST.DOC"), IGR_BODY_AND_META, &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