TX Text Control X10 Exclusive use of objects as data sources __ objects

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.