Lets say you need to create a combined PDF document that contains a letter, multiple reports and a graph all created from different database files
VPE for Visual DataFlex contains a feature to help a developer with this.
By default each VPE Report or document creates its own VPE document object that can be printed, previewed, saved, etc.
There is a feature in VPE for VDF that allows the developer to instruct VPE for VDF to instead of creating a new document append the new document or report to an existing document
Say we have a report called oLetterToClient and a report called oCustomerOpenInvoices as well as a chart called oCustomerSalesChart.
We could use the following code to create a combined document
// run the first report // this will create a new VPE document Send StartReport to oLetterToClient // advance to the next page Send DoVpePageBreak to oLetterToClient // tell the next report not to create a document // but to simply use the one we created earlier Set pbCreateDocument of oCustomerOpenInvoices to false Set pbShareDocumentFromDisplay of oCustomerOpenInvoices to true Set phoDocumentDisplay of oCustomerOpenInvoices to oLetterToClient Send StartReport to oCustomerOpenInvoices // advance to the next page Send DoVpePageBreak to oLetterToClient // and the same with the next report Set pbCreateDocument of oCustomerSalesChart to false Set pbShareDocumentFromDisplay of oCustomerSalesChart to true Set phoDocumentDisplay of oCustomerSalesChart to oLetterToClient Send StartReport to oCustomerSalesChart // now we have a combined document in oLetterToClient Send DoVpePreviewDoc to oLetterToClient VPE_SHOW_NORMAL
if you just want to call the same report or document multiple times and append them together into a single document that is even easier
the first time you run the report or document set the pbCreateDocument property to true and then for any subsequent runs set it to false. This will create a new document the first time. Make sure to call DoVpePageBreak to advance the page
// run report the first time Set pbCreateDocument of oMyReport to true Send PreviewReport TO (oVpeDocument(Self)) VPE_SHOW_NORMAL .. change selections, etc // advance page Send DoVpePageBreak to oMyReport // run report again but into same document Set pbCreateDocument of oMyReport to false Send PreviewReport TO (oVpeDocument(Self)) VPE_SHOW_NORMAL