An accessor property that returns the collection of bounding rectangles in the optical character recognition (OCR) layout that contain the specified word. Read-only MiRects.
*expression * Required. An expression that returns a Word object.
Use the Rects accessor property of the Word object to return an MiRects collection. Use the Item property of the MiRects collection to return an MiRect object and gain access to the properties that describe its coordinates.
All of the rectangle objects and properties in the Microsoft® Office Document Imaging 2003 object model work as follows:
- The Top and Bottom properties represent the distance in pixels from the top edge of the containing image.
- The Left and Right properties represent the distance in pixels from the left edge of the containing image.
The following example performs OCR on the first page of a document, and then reports the bounding rectangle properties of the third recognized word.
Sub TestRects() Dim miDoc As MODI.Document Dim miWord As MODI.Word Dim miRects As MODI.miRects Dim miRect As MODI.miRect Dim strRectInfo As String Set miDoc = New MODI.Document miDoc.Create "C:\document1.tif" miDoc.Images(0).OCR Set miRects = miDoc.Images(0).Layout.Words(2).Rects strRectInfo = "Word falls within " & miRects.Count & _ " bounding rectangle(s)." & vbCrLf For Each miRect In miRects strRectInfo = strRectInfo & _ " Rectangle coordinates: " & vbCrLf & _ " - Left: " & miRect.Left & vbCrLf & _ " - Right: " & miRect.Right & vbCrLf & _ " - Top: " & miRect.Top & vbCrLf & _ " - Bottom: " & miRect.Bottom Next MsgBox strRectInfo, vbInformation + vbOKOnly, _ "Rectangle Information" Set miRect = Nothing Set miRects = Nothing Set miWord = Nothing Set miDoc = Nothing End Sub
Applies to | Word Object