Document processing Controls TX Text Control, the upcoming release of the X10 version, will be upgraded with a focus on streaming layout report design and generation with its comparative advantage. Hui all obtained from its developer Text Control GmbH Company's firsthand information, can't wait for everyone to bring also in the test phase of the TX Text control X10 Exclusive.
Creating a merge template directly using an enumeration business object as a data source is one of the most common requirements for TX Text control. The upcoming TX Text Control X10 uses a new method to implement this requirement, even with the new Documentserver.mailmerge method and IEnumerable object.
public void Mergeobjects (System.Collections.IEnumerable mergedata);
Mail merge requires that the public properties of all objects in the collection be used as table columns and child tables for normal processing. IEnumerable properties are automatically instantiated as relationships and are used to merge blocks and nested merge blocks.
For example, the class structure of the data source:
The following code is the UML class design on the diagram:
public class Invoice
{public
list<product> products
{get
;
Set;
}
Public Customer customer
{get
;
Set;
}
}
public class product
{public
product (string Name, Decimal price)
{this
. name = name;
This. Price = Price;
}
public string Name
{get
;
Set;
}
Public Decimal price
{get
;
Set;
}
}
Now you need a report template, you need to merge the block products, and the merge fields are name and price in the block. The mode of operation is as follows.
You can use the following code to implement the Create data source object and use Mergeobjects to start the merge.
Invoice Invoice = new Invoice ();
Invoice. Products = new list<product> ();
Invoice. Products.add (New Product ("Apple", 3.55m));
Invoice. Products.add (New Product ("Banana", 2.4m));
Invoice. Products.add (New Product ("Pineapple", 2.99m));
var invoices = new list<invoice> ();
Invoices. ADD (invoice);
Mailmerge1.mergeobjects (invoices);
TX Text Control Latest version of the official recommended download address