Kofax DOKuStar Validation User Manual

Page 29

Advertising
background image

DOKuStar Validation Programming Manual

Page

• 25

Dim doc As Document
Dim subdoc As Document
Dim imgDataSource As ImageDataSource
Dim fld As Field

Dim srcInfo As ImageSourceInfo

'*
'*** add a document
'*
Set doc = MyData.Documents.Add("Letter")
doc.Fields("Sender").Value = "Océ Document Technologies"
Set subdoc = doc.Documents.Add("CoveringLetter")

'* add a datasource (image) to the subdoc "CoveringLetter"
Set imgDataSource = MyData.DataSources.Add("dataset::ImageDataSource")
imgDataSource.FileName = App.Path & "\Source_1.tif"
subdoc.DataSources.Add imgDataSource

Set subdoc = doc.Documents.Add("Invoice")
subdoc.Fields("TotalAmount").Value = "100.00"
Set fld = subdoc.Fields("TotalAmount")
fld.Value = "547,47"

'* 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
Set imgDataSource = MyData.DataSources.Add("dataset::ImageDataSource")
imgDataSource.FileName = App.Path & "\Source_3.tif"
subdoc.DataSources.Add imgDataSource

'* add a sourceinfo
Set srcInfo = fld.CreateSourceInfo("dataset::ImageSourceInfo")
srcInfo.DataSource = imgDataSource
srcInfo.Zone.SetValue 1650, 2020, 100, 20

In this code, the first change is just convenience: What was previously in one statement, is now split up in two,
because we need the

fld

variable later on. Also, the field’s value was changed to

547.47

, because this is the

value that is really on the sample image.

The last lines are the really important ones: An

ImageSourceInfo

object is created for the field; its

DataSource

property is set to point to the third image, and its

Zone

property is set to the right zone (Left, Top,

Width, Height) on this image.

Remark: Don’t wonder where those coordinates in the example come from: I just tried out until they pointed to the
right place on the sample image...

This is the result: The zone is displayed in the full image, and the snippet window is filled with its contents.

Advertising