CreateVirtualZoneFullWidth

Creates a new field that spans the entire width of the page.

Syntax

bool CreateVirtualZoneFullWidth ( string  sFieldName)

Parameters

sFieldName
The name of the field, which has its zone assigned based on the previously set virtual start and end positions. If the field does not exist, it is created. Smart parameters are supported.

Returns

Returns True if the zone is set on the field. Returns False if an error occurs or if the start and end points for the zone are not set.

Level

Page or Field level.

Details

*** This Action Is Deprecated ***

This action has been deprecated and is scheduled to be removed in a future release. It is recommended that you no longer use this action. Instead, use the action CreateVirtualZoneFullWidth in the LocateText action library.

This action assigns zone coordinates to a field based on previously set start and end positions that were identified by using SetVirtualPageStartPosition and SetVirtualPageEndPosition actions. It expands the selection to capture all the text to the left and right of the area between the located coordinates. Using the actions SetVirtualPageStartPosition and SetVirtualPageEndPosition, a rectangular segment of text from within the current page can be identified at run time and set as a zoned area. This approach is useful to set the zone position of a field that is not a fixed location by searching for the recognized text to find the top-left corner and bottom-right corner of the zone area.

This function is similar to CreateVirtualZone but has the added feature that it expands the left and right coordinates of the zone area to contain all the text within the designated area. For example, a page might have a section of text that needs to be zoned, but you are unable to create start and end points that can capture all the text. A paragraph of text is one type of area that does not have even text, allowing creation of a zone that captures all the text to the left and right. If it is possible to correctly locate the designated portions of the text to capture, then this action selects all the text between those two points and creates that area as a zone. A layout file is required to use this action and the CCO must be loaded from the layout file by using the CreateCcoFromLayout action. The recognition of the layout file and creation of the CCO for the page can be performed in the same ruleset or in an earlier ruleset.

After the zone is set, it can be used just like a zone that is created from a fingerprint. Subsequent actions can be used to process the zoned text for the field.

A field with coordinates set based on the contents of the recognized page can have many uses. One less obvious use would be for table identification when the table boundary is not determined by grid lines or the engine is not properly determining the table area. In this scenario, use the locate actions to determine the upper-left and lower-right coordinates of the table with steps similar to the following example. This finds the table location based on the text that exists on the page. There would need to be expected text or positions to identify the table boundaries. After you call CreateVirtualZone, the field can be identified with the variable y_TableZone. The OCR/A Recognize action can provide table boundaries for better table identification by making a second call to the Recognize action.

Example

RecognitionRuleset 
- Recognize() 
- SetMaxCharacterHeightAVG("0") 
- SetMaxCharacterHeightTMM("0") 
- CreateCcoFromLayout() 

LocateRuleset
- WordFind("Hello")
- SetVirtualPageStartPosition()
- WordFindNext("Good bye")
- GoUpLine("1")
- SetVirtualPageEndPosition()
- CreateVirtualZoneFullWidth("MyField")
Sample page text
Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text

Hello

Text1 Text1 Text1 Text1 Text1 Text1 Text1
Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1
Text1 Text1 Text1 Text1

Good Bye

Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2
Explanation

This example recognizes a page, creating a layout file. The CCO is created from the layout file. The Locate actions are used to create the boundaries for the new zone.

The action WordFind starts at the top of the page and it finds the first occurrence of the word "Hello". The search is case-sensitive. If the word case can change, then a keyfile with different cases for the word and the keyfile locate action can be used to find the starting point of the zone.

SetVirtualPageStartPosition causes the locate actions to remember that this word is the start of the zone. If the start should be the line under the word "Hello", then the action GoBelowWord("1") might be added to move to the next line to exclude that line before you call SetVirtualPageStartPosition.

The locate action FindWordOnPageNext starts at the current locate location to look for "Good Bye". If that word is found, the action GoUpLine("1") selects the line before the word "Good Bye", so the word "Good Bye" is not included within the zone. The last call is to SetVirtualPageEndPosition to mark the ending point of the new zone.

Lastly, the action CreateVirtualZoneFullWidth sets the position for the field called "MyField" off of the current object, which is typically a page. All the text in between that is identified by SetVirtualPageStartPosition and SetVirtualPageEndPosition is included in the zone. This zone area is automatically enlarged to capture the full text to the left and right. The field zone position is set and the text of the field is set to the text within the new boundary. If the field "MyField" does not exist, the field is created.

Using the sample page text previously shown, this example captures the following field text:
Hello

Text1 Text1 Text1 Text1 Text1 Text1 Text1
Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1
Text1 Text1 Text1 Text1