feedback button

Set up a reporting solution in just a few simple steps

Check the steps below and learn how easily you can add document generation or reporting capabilities to your .NET application. You will notice that the task of template design is so technically unchallenging that it can be done even by nontechnical users. And if you are a .NET developer, you will love the toolkit’s concepts which are highly logical and allow great flexibility.

1

Integrate Docentric Toolkit Report Engine into your .NET application.

  1. Download and install Docentric Toolkit. More »

  2. Reference the required .NET libraries (DLLs) in your .NET project. More »


2

Prepare your data sources.

Your data sources can be in various forms. More »


.NET Objects XML
Write .NET classes representing your data or use existing ones e.g. DTOs, EF Entities and Typed Data Sets/Tables. Prepare your sample XML or XSD based on the data you want to populate a report/document with.

3

Create the template

  1. Create a new blank MS Word document and mark it as a template. More »

    Create a new document in MS Word. Mark the document to be a template. Two new panels open. One is for managing data sources and the other one is for managing tagging elements.
  2. Import the schema for the data sources from your .NET data classes, sample XML or XSD file. More »

    Importing a schema for a data source is an optional step but doing so makes template design much easier. In this example our default data source represents a list of products so we need to locate the .NET assembly containing the type 'Product' which will be used as the schema. After the schema has been successfully imported for the dafault data source it becomes visible in the 'Data Sources' pane. Schemas are always saved as part of a document/template which means this is a one time step for each new template. Afterwards, you can always check what data (tagging element) is available for placing onto a template. Now we are ready to insert tagging elements and data-bind them against the members declared by the imported schema.
  3. Design the template. More »

    Our goal in this example is to populate this template with a list of products and not with just an info of a single product. This is controlled by '.Net Type Usage'. In our example we will render the product collection in the form of a table but we could also render collection items in the form of bullets, paragraphs, each product on a new page or any other form that can be created by using MS Word. The LIST tagging element has been used here to designate the second table row to be repeated/copied for each product in the collection. The LIST element has been data-bound here to the default data source directly. While the LIST element only causes its wrapped content to be repeated for each collction item, we now need to place the FIELD elements inside the LIST element in order to tell the template which data we want to write for each collection item. We insterted two FIELD elements, one for 'Name' and the other one for 'Description'. Binding Control is used for data binding by simply navigating the schema tree of available members and selecting the one we want to data-bind to. The IMAGE element is also a placeholder but is used to show images instead of text which means it can only be bound to a schema member representing image data. The last data we want to display for each product is 'Price'. Again, the FIELD element is used but since this data is numeric, the format is also specified in which want the price to be displayed.
  4. Save the template.

    Design mode is used to show and highlight all tagging elements at once.

4

Generate the document/report from your .NET project.



// Load products from the database.
IEnumerable<Product> products = DataAccess.GetProducts();

// Create report engine and provide 'products' as the value for the default data source.
DocumentGenerator dg = new DocumentGenerator(products);

// Execute document generation by specifying the template and the output document.
DocumentGenerationResult result = dg.GenerateDocument("Template.docx", "GeneratedDocument.docx");
if (result.HasErrors)
{
    foreach (Error error in result.Errors) Console.WriteLine(error);
}

More »


Document Generation Result