Kofax DOKuStar Validation User Manual
Page 31

DOKuStar Validation Programming Manual
Page
• 27
'* add two datasources (images) to the subdoc "Invoice"
Set imgDataSource = MyData.DataSources.Add("dataset::ImageDataSource")
imgDataSource.FileName = App.Path & "\Source_2.tif"
subdoc.DataSources.Add imgDataSource
'* add a row
Set tableFld = subdoc.Fields("Details")
Set row = tableFld.Rows.Add("Row1")
'* add sourceinfo to a cell of the row
Set cell = row("Quantity")
cell.Value = "6"
Set srcInfo = cell.CreateSourceInfo("dataset::ImageSourceInfo")
srcInfo.DataSource = imgDataSource
srcInfo.Zone.SetValue 1220, 1640, 100, 20
'* add sourceinfo to another cells of the row
Set cell = row("SinglePrice")
cell.Value = "3,12"
Set srcInfo = cell.CreateSourceInfo("dataset::ImageSourceInfo")
srcInfo.DataSource = imgDataSource
srcInfo.Zone.SetValue 1550, 1640, 100, 20
Set cell = row("TotalPrice")
cell.Value = "18,72"
Set srcInfo = cell.CreateSourceInfo("dataset::ImageSourceInfo")
srcInfo.DataSource = imgDataSource
srcInfo.Zone.SetValue 1760, 1640, 100, 20
'* add another row and according sourceinfo
Set row = tableFld.Rows.Add("Row2")
Set cell = row("Quantity")
cell.Value = "1"
Set srcInfo = cell.CreateSourceInfo("dataset::ImageSourceInfo")
srcInfo.DataSource = imgDataSource
srcInfo.Zone.SetValue 1220, 1720, 100, 20
Set cell = row("SinglePrice")
cell.Value = "3,80"
Set srcInfo = cell.CreateSourceInfo("dataset::ImageSourceInfo")
srcInfo.DataSource = imgDataSource
srcInfo.Zone.SetValue 1550, 1720, 100, 20
Set cell = row("TotalPrice")
cell.Value = "3,80"
Set srcInfo = cell.CreateSourceInfo("dataset::ImageSourceInfo")
srcInfo.DataSource = imgDataSource
srcInfo.Zone.SetValue 1760, 1720, 100, 20
Set imgDataSource = MyData.DataSources.Add("dataset::ImageDataSource")
imgDataSource.FileName = App.Path & "\Source_3.tif"
subdoc.DataSources.Add imgDataSource
' rest of code as before
Some remarks:
When we get the table field from the
Document
object, it is assigned to a variable of type
TableField
:
Dim tableFld As TableField
Set tableFld = subdoc.Fields("Details")
To add a row, use the
Add
method of the table field‘s
Row
collection, assigning it a unique name. It is up to you,
which name you take for the new row, there is no equivalence to it in the
Schema
:
Set row = tableFld.Rows.Add("Row1")
To access a single cell, index the row with the column name as defined in the schema:
Set cell = row("Quantity")
What you get is a
Field
object; there is no special object for cells. As with any
Field
object, you can assign a
Value
to it and a
SourceInfo
object: