Nicomsoft OCR: Developer's Guide


Blk_GetWordText


Syntax

C++:int Blk_GetWordText(HBLK BlkObj, int LineIndex, int WordIndex, UNICODECHAR* TextStr, int MaxLen)
C#:int Blk_GetWordText(int BlkObj, int LineIndex, int WordIndex, out string TextStr)
Visual Basic:Function Blk_GetWordText(ByVal BlkObj As Integer, ByVal LineIndex As Integer, ByVal WordIndex As Integer, ByRef TextStr As String) As Integer
Java:int Blk_GetWordText(HBLK BlkObj, int LineIndex, int WordIndex, StringBuffer TextStr)
Delphi:function Blk_GetWordText(BlkObj:HBLK; LineIndex:integer; WordIndex:integer; TextStr:PWCHAR; MaxLen:integer):integer


Description

Retrieves the recognized text for the specified word in the block after performing OCR with the Img_OCR function. Use the Blk_GetLineCnt function to get the total number of text lines in the block. Use the Blk_GetWordCnt function to get the total number of words in the specified line.


Parameters

BlkObj [IN] – the Block object. You can also specify the Image object if you want to work with the global list of text lines for the entire image.
LineIndex [IN] – the index of the text line to retrieve; 0 – the first line.
WordIndex [IN] – the index of the word in the specified text line to retrieve; 0 – the first word.
TextStr [OUT] – the buffer that will get a Unicode, null-terminated string with the text.
MaxLen [IN] – the buffer size, in Unicode characters, including the null termination character. If 0, then the function will not copy anything to the buffer, but will only return the buffer size (in Unicode characters, without the null termination character) needed to store the text.


Return value

If success, the text length in Unicode characters, without the null termination character; otherwise, an error code.


Remarks

None.


Example

See the sample code for the Img_GetBlockCnt function.