Reports for WinForms | ComponentOne
Working with C1PrintDocument / Data Binding
In This Topic
    Data Binding
    In This Topic

    In addition to creating a C1PrintDocument fully (including data) in code, a C1PrintDocument may be data bound. In that case, the actual document is produced when the document is filled with data from the database during generation.

    The main property facilitating data binding is the DataBinding property on RenderObject , of the type C1DataBinding, which allows to specify the data source for data shown by the render object. Additionally, the data binding can indicate that the render object must be repeated for all records in the data source, in which case the render object becomes similar to a "band" from a banded report generator. This is similar to the RDL definition from Microsoft.

    Thus for data bound documents, document generation involves two stages:

    The document can contain the database schema (represented by the class C1DataSchema, and including the data base connection info, SQL queries, and so on) inside. The C1DataBinding objects within the document can reference properties of that schema. If all data bound objects in a document reference only the properties of the C1DataSchema of the document itself, the document becomes "data reflowable" - that is, the document can be regenerated independently of the program used to create it, with data completely updated from the database.

    Also, the C1DataBinding may reference existing data sources (DataTable and so on) which were created on the form or elsewhere in the program that created that C1PrintDocument. In this case, of course, the document can only be regenerated with updating the data only in the context of that program, and saving and later loading that document (as a C1D or C1DX file) will break any connection with the data.

    See Also