This project is read-only.

About this document

This document intends to be a quick start up guide for using NTemplates. It introduces the most important features and concepts about the product to help you quickly understand them so that you can jump into the examples and start working right away.


NTemplates is a non visual reporting component for .NET written 100% in C#. It allows your end users to define custom report templates (RTF format). This way, your application just needs to specify the placeholders for letting the user build a template, and the required data for building the report. NTemplates will generate the report based on the users’ report template.
The final report is also a RTF document, so it can be edited or used in any other way an RTF document could be used.
NTemplates includes a very simple interpreted programming language. This allows templates complexity vary from very simple placeholder replacement, to much more complex report definitions; including IF and LOOP constructions.

Getting Started.

Atention: Before trying the examples...

The templates defined for the available examples where created using MS Word. Please note than although it'd RTF, not all text editors generate the same RTF code. Please, make sure you generate the templates with the same editor you'll be using to open the final reports.

If you use different editors, it's likely that the reports won't have the expected format.

How to define a template.

A report template is a simple .rtf document that can be written using Microsoft Word or other RTF editors. It must contain at least one placeholder. Placeholders are ‘special words’ that NTemplates will replace with actual data to generate a report.
Placeholders, like programming sentences and functions need to be written enclosed by # simbol. For example, these could be some valid placeholders for data:

• #DayOfWeek#
• #P.FriendName#

The first one represents a memory variable that could store the day of the week, for example. And the second one, represents a DataColumn called ‘FriendName’ inside a DataTable object, which TableName’s property value is ‘P’.

So, imagine a simple RTF document with this content:

Hello Today is #DayOfWeek# , and I’d just wanted to let you know about NTemplates.

If your application provide values for these placeholders, let’s say ‘Monday’ and ‘John’ and then ask NTemplates to generate a report, the result would be as follows:

Hello John. Today is Monday, and I’d just wanted to let you know about NTemplates.
The process preserves the RTF formatting options set for the text.

A simple rule to follow is to format the whole placeholder. Note that in the above example, the enclosing # symbols have the same format (bold) than the enclosed word. If you did something like #DayOfWeek# then the engine would not be able to replace the placeholder and exception could be raised.

Last edited Jun 7, 2012 at 1:50 PM by gmendez, version 2


No comments yet.