Text Property

Returns the recognized text as a Unicode string. Read-only String.

expression.Text

*expression   * Required. An expression that returns a Layout, Word, or IMiSelectableItem object.

Example

The following example loads a document, performs optical character recognition (OCR) on the first page, and then displays information including the first 50 characters of text from the page's OCR layout.

Sub TestText()

  Dim miDoc As MODI.Document
  Dim miLayout As MODI.Layout
  Dim strLayoutInfo As String
  
  Set miDoc = New MODI.Document
  miDoc.Create "C:\document1.tif"
  
  miDoc.Images(0).OCR
  
  Set miLayout = miDoc.Images(0).Layout
  strLayoutInfo = _
    "Language: " & miLayout.Language & vbCrLf & _
    "Number of characters: " & miLayout.NumChars & vbCrLf & _
    "Number of fonts: " & miLayout.NumFonts & vbCrLf & _
    "Number of words: " & miLayout.NumWords & vbCrLf & _
    "Beginning of text: " & Left(miLayout.Text, 50) & vbCrLf & _
    "First word of text: " & miLayout.Words(0).Text
  MsgBox strLayoutInfo, vbInformation + vbOKOnly, _
    "Layout Information"
  
  Set miLayout = Nothing
  Set miDoc = Nothing

End Sub

Applies to | IMiSelectableItem Object | Layout Object | Word Object