IGR_Get_Text¶
IGR_Get_Text extracts the text of previously opened document.
Prototype¶
IGR_LONG IGR_Get_Text(
IGR_LONG DocHandle,
IGR_UCS2* Buffer,
IGR_LONG* BufferSize,
Error_Control_Block* ISYSError);
Parameters¶
DocHandle: IGR_LONG
Handle to a document, opened by a call to IGR_Open_File, IGR_Open_File_Ex, IGR_Open_Stream, IGR_Open_Stream_Ex or IGR_Open_Ex.
Buffer: Unicode string (UCS2)
Application allocated memory block that will be filled with the next portion of text.
BufferSize: Pointer to IGR_LONG
Prior to the call: The size in Unicode (UCS2) characters of the buffer.
After the call: The actual number of Unicode (UCS2) characters extracted.
ISYSError: Pointer to Error_Control_Block
Returns error details if the call fails.
Return value¶
Success: IGR_LONG
Returns IGR_OK.
Success and the end of the document was reached: IGR_LONG
Returns IGR_NO_MORE.
Failure: IGR_LONG
Returns one of the possible IGR_E error codes.
Sample code¶
Error_Control_Block ISYSError;
IGR_UCS2 Buffer[BUFFER_SIZE+1];
IGR_LONG Size, rc;
while (true)
{
Size = BUFFER_SIZE;
rc = IGR_Get_Text(DocHandle, Buffer, &Size, &ISYSError);
if (rc != IGR_OK)
{
if (rc != IGR_NO_MORE)
// ReportError(rc);
break;
}
Buffer[Size] = 0;
// DoSomethingWithTheText(Buffer);
}
Additional information¶
The previously opened document must have the IGR_FILE_SUPPORTS_TEXT capability.
Note The populated buffer will not be null-terminated. If required, a null terminator may be explicitly added to the buffer at position BufferSize as shown in the Sample code (above).
After a successful call to IGR_Open_File, IGR_Open_File_Ex, IGR_Open_Stream or IGR_Open_Stream_Ex, the document pointer is set to the beginning of the text to be returned. Each call to IGR_Get_Text will retrieve the next portion of the text and a maximum of BufferSize characters will be copied to Buffer. To extract the whole text, the application will need to call IGR_Get_Text in a loop until the function returns IGR_NO_MORE.
Text returned may contain markup characters that your application will need to process.