Creating a simple reporting component in c#

  • Thread starter Thread starter Ray Porter
  • Start date Start date
R

Ray Porter

Guest
Hi,

I've finished converting my old Delphi Windows application to C# but I have a request for guidance. The old application uses a tool called Rave Reports to generate a reports entirely in code, based on the contents of the custom, in-memory object that drives the application. Key data for that class is saved to a DB but many of the properties are code based an data is only generated at when needed. I've managed to reproduce the Rave Reports functionality in the C# version using the System.Drawing.Printing.PrintDocument and the System.Drawing.Printing.PrintPreviewDialog components (instantiated in code).

I'm quite pleased with the results I've achieved but now I'd like to extract that functionality to a reporting component that can be used in other applications that require simple, text reporting without having to recreate all the necessary logic each time. Ideally, I'd like to be able to drop a component on a Windows form or instantiate a report in code then call an report method that gives me complete control over the reporting process by setting public properties and calling public methods that allow me to supply data to be printed, position text (both preview and actual printing) and keep up with things like page numbers, etc. As I said, I've got all this working just fine in my current application but the use of the PrintDocument.PrintPage event seems very constricting when trying to use it in a reporting component that I can easily reuse in other applications.

Do I need to abandon the provided printing components and create a new component that has its own Graphics object? Are there any examples out there that try to do the same thing? I'm mostly retired these days so this is exclusively for my own use and a learning exercise as much as anything else.

Thanks,

Ray

Continue reading...
 
Back
Top