Accusoft.FSInvoices1.Net - Updated
Validate Results
User Guide > How To > Validate Results

Validation is the last operation and is actually a manual operation in the process. At this point you have to accept the results, edit or reject them. Setting the "UserValidated" flag in Fields and Tables validates them. This flag is also used in template processing to give greater preference to these "validated" values and locations.

In all the below examples:

Form Fields

The field data and label location values can be set with the following methods:

FormField.SetData 

and

FormField.SetLabel 

These methods will set the bounding area for the specified Data/Label. They also set the text value by selecting any text in the bounding area on the specified page. In the event that the returned value is not correct, the Data/Label value can be overridden. The area of the Data/Label should be set even if the values are overridden.

Example -  demonstrates the use of SetData/SetLabel methods
Copy Code
            // Set the data area
            formResult.Fields[itemIndex].SetData(docPageIndex, boundingBoxForData, false);
 

            // Set the label area
            formResult.Fields[itemIndex].SetLabel(docPageIndex, boundingBoxForLabel, false);


Example - demonstrates overriding the Data/Label values
Copy Code
            // Set the data value
            formResult.Fields[itemIndex].Data.Value = "My Data Value";
 

            // Set the label value
            formResult.Fields[itemIndex].Data.Value = "My Label Value";

The Form Fields is not validated though until the UserValidated has been set.


Copy Code
        // Set the user validated flag
           formResult.Fields[itemIndex].UserValidated = true;

FormTables

Before validation the Form Tables components may be changed with the following method calls:

FormTable.SetColumnHeader

Columns are selected using the FormTable. SetColumnHeader method.  This method selects the area of the column header.  The area should span the width of the specified column.

Example
Copy Code
            // Set the column header
            formResult.Tables[0].SetColumnHeader(columnIndex, docPageIndex, boundingBoxForHeader);
FormTable.InsertRow

Rows can be added to the table by using the FormTable.InsertRow method.  This method takes the top and bottom of the row and fills in the data cells defined by the column headers.

Example
Copy Code
            // Add a row to the table
            formResult.Tables[0].InsertRow(docPageIndex, rowTopInPixels, rowBottomInPixels);
FormTable.SetCell

The FormTable.SetCell method is used to change the location and value of a cell. Changing an individual cell is similar to changing the Data value of a form field.


Example - To change the location of where a data cell in a row is located
Copy Code
          // Set a cell value
            formResult.Tables[0].SetCell(columnIndex, rowIndex, docPageIndex, boundingBoxForCell);

          // Override the cell value
            formResult.Tables[0].Rows[rowIndex].Cells[cellIndex].Value = "My Cell Value";
               
Example - Retrieve values from the cell
Copy Code
            // Get the cell value
            string Value = formResult.Tables[0].Rows[rowIndex].Cells[columnIndex].Value;


After all modifications have been made to the table, set the FormTable.UserValidated flag to true. 

Example
Copy Code
            // Set to validated
            formResult.Tables[0].UserValidated = true;