5,778,647 members and growing! (17,769 online)
Email Password   helpLost your password?
Desktop Development » Printing » General     Intermediate License: A Public Domain dedication

Report Generator

By Johan Rosengren

A plug-in report generator
VC6, C++, WindowsVS6, Visual Studio, Dev

Posted: 6 Mar 2005
Updated: 11 Oct 2006
Views: 264,563
Bookmarked: 351 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
Prize winner in Competition "MFC/C++ Feb 2005"
220 votes for this Article.
Popularity: 11.40 Rating: 4.86 out of 5
9 votes, 4.1%
1
2 votes, 0.9%
2
1 vote, 0.5%
3
5 votes, 2.3%
4
202 votes, 92.2%
5

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

About the Author

Johan Rosengren


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.
Occupation: Software Developer (Senior)
Company: Abstrakt Mekanik AB
Location: Sweden Sweden

Other popular Printing articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 484 (Total in Forum: 484) (Refresh)FirstPrevNext
GeneralAttributes for a cell of a gridmemberNyarlatotep1:55 16 Dec '08  
GeneralRe: Attributes for a cell of a gridmemberJohan Rosengren5:11 20 Dec '08  
GeneralAbout eport GeneratormemberMember 273191417:55 3 Oct '08  
GeneralRe: About eport GeneratormemberJohan Rosengren8:30 5 Oct '08  
QuestionAbout CReportEntityGridmembermonrad8:24 13 Sep '08  
AnswerRe: About CReportEntityGridmemberJohan Rosengren21:31 13 Sep '08  
GeneralCan you help me?memberXiaoming Huang12:35 11 Sep '08  
GeneralRe: Can you help me?memberJohan Rosengren3:43 13 Sep '08  
GeneralGrid Problem With Release Mode of VS-2008 SP1memberScott Moss5:36 10 Sep '08  
GeneralRe: Grid Problem With Release Mode of VS-2008 SP1memberJohan Rosengren3:47 13 Sep '08  
GeneralRe: Grid Problem With Release Mode of VS-2008 SP1memberScott Moss17:44 14 Sep '08  
GeneralRe: Grid Problem With Release Mode of VS-2008 SP1memberScott Moss2:57 20 Oct '08  
GeneralRe: Grid Problem With Release Mode of VS-2008 SP1memberJohan Rosengren8:02 21 Oct '08  
QuestionAdding menu items?memberXiaoming Huang12:23 7 Sep '08  
GeneralBugfix: loading from resources in unicode buildmemberroel_7:16 3 Aug '08  
GeneralRe: Bugfix: loading from resources in unicode buildmemberJohan Rosengren21:37 9 Aug '08  
GeneralDo do people deal with different paper sizes?memberroel_12:38 2 Aug '08  
GeneralRe: Do do people deal with different paper sizes?memberJohan Rosengren21:15 2 Aug '08  
GeneralRe: Do do people deal with different paper sizes?memberroel_3:17 3 Aug '08  
GeneralRe: Do do people deal with different paper sizes?memberdonghaitad7:26 8 Aug '08  
GeneralRe: Do do people deal with different paper sizes?memberJohan Rosengren21:42 9 Aug '08  
GeneralRe: Do do people deal with different paper sizes?memberJohan Rosengren21:36 9 Aug '08  
GeneralGreat workmemberdonghaitad9:03 13 Jul '08  
QuestionRe: Great workmemberdonghaitad23:31 13 Jul '08  
AnswerRe: Great workmemberJohan Rosengren7:45 14 Jul '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 11 Oct 2006
Editor: Smitha Vijayan
Copyright 2005 by Johan Rosengren
Everything else Copyright © CodeProject, 1999-2009
Web09 | Advertise on the Code Project