Click here to Skip to main content
15,886,919 members
Articles / Web Development / HTML

Report Generator

Rate me:
Please Sign up or sign in to vote.
4.97/5 (244 votes)
11 Oct 2006Public Domain3 min read 1.7M   69.7K   504   521
A plug-in report generator

Sample Image - ReportCreator.gif

Introduction

Printing is a normal part of most applications, but far too convoluted for many developers. The amount of work necessary to add printing of lists and reports to an application often seems daunting, and there are many pitfalls. Here, I come to the aid, with a package containing a plug-in report generator working with template files, a SDI-demo, a plug-and-play report editor for the template files, as well as a demo of the latter. And documentation! The code is intended either for use as-is in your own applications, or as a CReportEditor as well.

ReportCreator also contains a ruler that can be ripped out and used with other CDiagramEditor-derived works. This is an exercise left to the reader, however.

The documentation contains docs on the package structure.

Using ReportCreator

ReportCreator is an editor for the report generator template files. It's first and foremost a vector editor, letting you draw fields on screen with all the features of CDiagramEditor, such as panning, zoom, multiple selects, and much, much more.

It allows you to work in pixels, centimeters or inches as is befitting for a printer-oriented application. The documentation contains detailed information.

Licenses

If you want to add the package(s) or parts of them into your own code - commercial or not, you are completely free to do so. The code comes with the TISATAAFL-license, There Is Such A Thing As A Free Lunch, and you are free to modify, rewrite, resell or do whatever you feel like with the code. You are explicitly allowed to remove my comments in the source and headers, replacing them with your own. You don't have to acknowledge me, neither in code, nor in documentation or the finished application if you should use the code in a commercial application.

History

6/5/2005

  • Initial version

28/5/2005

First of all, a few bug corrections:

  • Fixed resource leak in CCornerBox::OnPaint in the report creator (alex_br).
  • Fixed silly line-thickness bug in draw object line thickness/brush creation (lordly).

As well as a few others that was removed as a spin-off from other modifications.

There are also quite a few changes:

  • Multi-template reports. A report can be composed from several templates, for example, a title page, several sections and a summary (Carsten Bøgh Poulsen).
  • Dynamic object access. Objects can be accessed at runtime, so attributes can be inspected and modified. Objects can also be added at runtime (Håkan Nilsson).
  • More special markers for fields and cells. [%bold%] and [%italic%] will make the field/cell bold or italic respectively. [%separator%], [%bold-separator%], [%double-separator%] will draw a thin line, a thick line or a double line across a row in a grid instead of data (Carsten Bøgh Poulsen).
  • Images can not only be set from files, but also from HBITMAPs and handles to DIBs (Alex Evans).
  • Templates can not only be added from file, but also with data from a CStringArray, a LPCTSTR, a CFile or even from the application resources (DaberElay, Carsten Bøgh Poulsen).

1/10/2006

This project has been neglected for some time, but now it's time for an update! This time, we have:

  • Returning TRUE from Add when adding data as per documentation
  • Added support for font charset. (Vladimir Svrkota, J Bartkowiak).
  • Added locale-handling (J Bartkowiak).
  • Added [%pagebreak%]-command for grids. This works as the other commands, when putting this text in a cell, the grid will break and continue on the next page. (Charlie Curry, Carsten B Poulsen)
  • Added a function call ReplaceCell to set cell data in a grid. This call replaces the data in a specific cell with new data. (Carsten B Poulsen)

And a big thanks for all the help, feedback and support for this project!

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Software Developer (Senior) Abstrakt Mekanik AB
Sweden Sweden
45 years old, married, three kids.

Started with computers more than 20 years ago on a CBM-64.

Read Theoretical Philosophy at the University of Lund.

Working as a C++ consultant developer.

Science-fiction freak. Enjoy vintage punkrock.

Comments and Discussions

 
GeneralSetHBITMAP Pin
zindines12-Apr-05 9:55
zindines12-Apr-05 9:55 
GeneralRe: SetHBITMAP Pin
Johan Rosengren13-Apr-05 5:42
Johan Rosengren13-Apr-05 5:42 
GeneralNew features that can be added! Pin
cindyonlyone12-Apr-05 3:46
cindyonlyone12-Apr-05 3:46 
GeneralRe: New features that can be added! Pin
Johan Rosengren12-Apr-05 6:17
Johan Rosengren12-Apr-05 6:17 
GeneralRe: New features that can be added! Pin
cindyonlyone13-Apr-05 1:03
cindyonlyone13-Apr-05 1:03 
Generala little improvement Pin
galroy7-Apr-05 6:23
professionalgalroy7-Apr-05 6:23 
GeneralRe: a little improvement Pin
Johan Rosengren7-Apr-05 6:26
Johan Rosengren7-Apr-05 6:26 
GeneralMulti Band Pin
Furno Gianluca6-Apr-05 7:10
Furno Gianluca6-Apr-05 7:10 
Hi Johan!

Great work thank you a lot !

If possiblem, for the future, take in consideration a MULTI-BAND design in the same worksheet
For example
- Header band
- Details band
- Footer band

Thank youSmile | :)
G.Luca

GeneralRe: Multi Band Pin
Johan Rosengren7-Apr-05 6:24
Johan Rosengren7-Apr-05 6:24 
GeneralGreat job! Pin
donew5-Apr-05 17:59
donew5-Apr-05 17:59 
GeneralRe: Great job! Pin
Johan Rosengren6-Apr-05 6:47
Johan Rosengren6-Apr-05 6:47 
GeneralRe: Great job! Pin
donew6-Apr-05 16:53
donew6-Apr-05 16:53 
GeneralRe: Great job! Pin
Johan Rosengren7-Apr-05 6:20
Johan Rosengren7-Apr-05 6:20 
GeneralGreat job! Pin
donew5-Apr-05 17:31
donew5-Apr-05 17:31 
GeneralReport Extension Conflicts with CRW Pin
bevpet1-Apr-05 15:33
bevpet1-Apr-05 15:33 
GeneralRe: Report Extension Conflicts with CRW Pin
Johan Rosengren1-Apr-05 18:47
Johan Rosengren1-Apr-05 18:47 
GeneralA Few suggestions Pin
Brouzouf31-Mar-05 1:14
Brouzouf31-Mar-05 1:14 
GeneralRe: A Few suggestions Pin
Johan Rosengren31-Mar-05 4:12
Johan Rosengren31-Mar-05 4:12 
GeneralGrid Object Pin
CDRom24-Mar-05 8:17
CDRom24-Mar-05 8:17 
GeneralRe: Grid Object Pin
Johan Rosengren24-Mar-05 8:54
Johan Rosengren24-Mar-05 8:54 
Generalfind a small bug Pin
lordly22-Mar-05 16:15
lordly22-Mar-05 16:15 
GeneralRe: find a small bug Pin
Johan Rosengren23-Mar-05 8:24
Johan Rosengren23-Mar-05 8:24 
GeneralUsing PrintPreview without Doc/view Pin
Zoltan20-Mar-05 12:19
Zoltan20-Mar-05 12:19 
GeneralRe: Using PrintPreview without Doc/view Pin
Johan Rosengren21-Mar-05 5:04
Johan Rosengren21-Mar-05 5:04 
GeneralRe: Using PrintPreview without Doc/view Pin
Zoltan17-Apr-05 6:31
Zoltan17-Apr-05 6:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.