How To…Store Information With My Report Template

Question

“How do I store descriptive information with my report template?”

Solution

If you are storing the templates to a database, then you can use the Report.Template.OnSaveEnd and OnLoadEnd events to store and load the custom information to appropriate data fields for the record. (This is the technique used by the ReportExplorer.)

If you are storing templates to .rtm files, then you will need to store the custom information in an Offset area of the template file. The Report.Template object enables you do this by utilizing the Template.Offset property and the Template.OnLoadStart and OnLoadEnd events. Below is a detailed example.

Example:

  1. Create a new application.
  2. Add to the main form one TButton, one TppReport and one TppDesigner.
  3. Set the Designer’s Report property to ppReport1.
  4. Add ppTypes to the uses clause.