![]() ![]() It can contain multiple related GeneralFields and TableFields. GroupField is assistant mail-merge-field too. Data of field InvoiceSubtotal and InvoiceTotal in Invoice total information is from table Total (virtual table) Data of field ProductName is from table Product. And then our fields in Customer information block looks like:ĭuring the merge process, data in column CompanyName of table Customer will be filled in the field CompanyName, Customer.Address to field Address, Customer.City to field City and so on.ĭata of fields in column Salesperson in Order information table is from table Employeeĭata of fields in column Ship Via in Order information table is from table Shipperĭata of fields in Order details table is from table Detail, except field ProductName. Insert a mail-merge-field with field name TableStart:Customer immediately before the first CompanyName field and insert another mail-merge-field with field name TableEnd:Customer immediately after the field Country. For example, fields in Customer information block will be filled with data from data table Customer, so we need to put them in TableField Customer. During merge process, the data of related GeneralFields contained by one same TableField will be from one same data table. TableStart: TableName and TableEnd: TableName. It is composed of two special mail-merge-fields: So it is not data placeholder and no data will be filled in. TableField is assistant mail-merge-field and used as a container of multiple related GeneralFields and other TableFields. After inserting GeneralFields, our template will looks like: We need to insert a GeneralField to every red-block and name these fields with the corresponding data name. It is real data field and our data will be filled in it during merge process. GeneralField is a general Word mail-merge-field. There are three types of mail-merge-field which will be used in this example: Insert mail-merge-field as placeholder into the red-block. We can create the template in MS Word or by other program. ![]() Note: in this section, all tables mean DataTable instance, not physical table in database. We could modify it to change our report without any modification of code. Create mail merge templateĪ template is a reusable document. We need to finish the following 3 steps to generate our report.Įvery step includes several sub-steps and in #2 and #3 we need to write some code. The following picture shows the relationship between the 6 tables. We will export data from table Orders, Shippers, Customers, Employees, and Products to generate our report. The following pictures show the appearance of invoice:Ĭontent details in each invoice are shown as following:Īll data in this example is from Northwind database, which is a sample database provided by Microsoft Access 2003. Order, shipment, customer, order details and total price make up a completed invoice. Invoice logo and supplier information will present in the header of every page. This report includes multiple invoices, and each invoice starts in a new page. In this article, I will show one way to generate mail merged reports via Spire.Doc. And the merged documents can be sent by E-mail. Mail merge is often used to print reports in bulk, such as financial statement, payroll or transcript.
0 Comments
Leave a Reply. |