by IDEAL Software Support » Tue Jan 24, 2006 4:26 pm
Each time you dump a template into a VPE document, the template is appended to the end of the document.
So you can load the template once, and set the field values each time to the new data. Afterwards you dump the template into the document.
The schematic sequence of function calls is:
// Open a VPE document
VPE.OpenDoc()
// Load the dycodoc template
tpl = VPE.LoadTemplate("xyz.tpl")
while (data available)
{
// Set all fields to appropriate values
tpl.SetFieldAsString("table xyz", "field xyz", "some value")
etc. etc.
VPE.DumpTemplate(tpl)
// Except for the last data record, add a new blank page
if (data available)
VPE.PageBreak()
}
// The document is complete, now do something with the document,
// for example print it, send it by e-mail, write it as PDF, etc.
VPE.WriteDoc("xyz.pdf")
// Now close the document
VPE.CloseDoc()
This way all letters end up in a single document. If you require to have each letter in a separate document, you must open and close the document for each letter separately:
while (data available)
{
// Open a VPE document
VPE.OpenDoc()
// Load the dycodoc template
tpl = VPE.LoadTemplate("xyz.tpl")
// Set all fields to appropriate values
tpl.SetFieldAsString("table xyz", "field xyz", "some value")
etc. etc.
VPE.DumpTemplate(tpl)
// do something with the document, for example print it,
// send it by e-mail, write it as PDF, etc.
VPE.WriteDoc("xyz.pdf")
// Now close the document
VPE.CloseDoc()
}