RegionId Property

Returns the number of the region in the optical character recognition (OCR) layout where the word occurs. Read-only Long.


*expression   * Required. An expression that returns a Word object.


An OCR operation divides a page into regions, lines, and words. The RegionId property returns the index into the implicit zero-based regions collection of the Layout or IMiSelectableItem object for the region in which the word occurs.


The following example performs OCR on the first page of a document, and then reports the properties, including the Region Id, of the third recognized word.

Sub TestWord()
  Dim miDoc As MODI.Document
  Dim miWord As MODI.Word
  Dim strWordInfo As String
  ' Load an existing TIFF file.
  Set miDoc = New MODI.Document
  miDoc.Create "C:\document1.tif"
  ' Perform OCR.
  ' Retrieve and display word information.
  Set miWord = miDoc.Images(0).Layout.Words(2)
  strWordInfo = _
    "Id: " & miWord.Id & vbCrLf & _
    "Line Id: " & miWord.LineId & vbCrLf & _
    "Region Id: " & miWord.RegionId & vbCrLf & _
    "Font Id: " & miWord.FontId & vbCrLf & _
    "Recognition confidence: " & _
    miWord.RecognitionConfidence & vbCrLf & _
    "Text: " & miWord.Text
  MsgBox strWordInfo, vbInformation + vbOKOnly, _
    "Word Information"
  Set miWord = Nothing
  Set miDoc = Nothing

End Sub

Applies to | Word Object