Click here to Skip to main content
15,867,771 members
Articles / Programming Languages / C#
Article

Report Builder

Rate me:
Please Sign up or sign in to vote.
2.60/5 (11 votes)
26 Feb 2008CPOL1 min read 148.8K   5.7K   47   18
Tool Report Builder

Introduction

This article presents a tool for generation of reports that was developed in the last five months. The tool has been created in C# and works in .NET Framework 2.0. For a long time, I used the ReportBuilder with Delphi. Then, I migrated to Visual Studio and C# as I felt a certain difficulty working with the tools for generation of reports. At that time, I decided to build my own tool. The result of my work is shown in this article. The creator supports several types of data - DataSet, ArrayList, and DataTable. I could still add new types, but this seems to be enough to implement the IDataReport interface.

Using the Code

  1. Drawing of the layout of the Document Principal modules, which is also the module that absorbed the most development time, was the module for drawing the report layout. In the Designer's module, it is possible to create title pages, titles, to shape the layout and size of the page, as well as do groupings. All this can be observed in the following three figures.

Gerador_v02_small.jpg

Figure 1 - Title, Header, Summary

Gerador_v03_small.jpg

Figure 2 - Visualization of the Report. First page

Gerador2_small.jpg

Figure 3 - Visualization of the Report. Next page
  1. Code to load the Module of Drawing of the report is as follows:

    C#
    using KReport;
    
    public static void Main () {
          DataSet dsDados = new DataSet ();
          ds.ReadXML (' Teste.xml ');
    
          KReport.Engine.Report rpt = new KReport.Engine.Report();
              
          rpt.FileName = 'C:\Report.xml '; // defines the archive where the layout is
          rpt.Load (); // Loads the layout
          rpt.AddSource (dsdados); // adds the fountain of data
          rpt.ShowDesigner (); // Visualizes layout of the report
    }
  2. Code to load the form of visualization of the report is as follows:

    C#
    using KReport;
    
    public static void Main () {
          DataSet dsDados = new DataSet ();
          ds.ReadXML (" Teste.xml ");
    
          KReport.Engine.Report rpt = new KReport.Engine.Report();
              
          rpt.FileName = " Report.xml "; // defines the archive where the layout is
          rpt.Load (); // Loads the layout
          rpt.AddSource (dsdados); // adds the fountain of data
          rpt.Show (); // Visualizes report in the form of preview
    }
  3. Code to load and print the report is as follows:

    C#
    public static void Main () {
          DataSet dsDados = new DataSet ();
          ds.ReadXML (" Teste.xml ");
    
          KReport.Engine.Report rpt = new KReport.Engine.Report();
              
          rpt.FileName = " Report.xml "; // defines the archive where the layout is
          rpt.Load (); // Loads the layout
          rpt.AddSource (dsdados); // adds the fountain of data
          rpt.Print (); // Printed report 
    }
  4. Code using a list of objects is as follows:

    C#
    public static void Main () {
          ArrayList source;
          Persistencia.StartSession ();
          source = Persistencia.GetListObject (typeof (Credito), " status = 0 ");
          Persistencia.EndSession ();
    
          KReport.Engine.Report rpt = new KReport.Engine.Report();
              
          rpt.FileName = " Report.xml "; // defines the archive where the layout is
          rpt.Load (); // Loads the layout
          rpt.AddSource (source); // adds the fountain of data
          rpt.Print (); // Printed report 
    }

History

  • 22nd February, 2008 -- Original version posted
  • 26th February, 2008 -- Download added

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Ceape Maranhâo
Brazil Brazil
Specialist in Development of Systems of Information for the University Estatual de Feira de Santana (UEFS). Bachelor in Science of the Computation for the University Estadual do Piauí (UESPI). Now works like Analyst of System of the CEAPE/MA. It acts like investigator and programmer in the area of analysis of systems and like teacher of the next disciplines: Database, Planning in Nets, Programming language and Concepts of Programming language.
Email for contact - fgborges@hotmail.com

Comments and Discussions

 
QuestionIs fernando email working? Pin
Kinpro Computers31-Jul-19 22:48
Kinpro Computers31-Jul-19 22:48 
QuestionDownload Report Builder Pin
Mauro Magalhães12-Sep-18 4:14
Mauro Magalhães12-Sep-18 4:14 
AnswerRe: Download Report Builder Pin
Fernando Gregorio22-Feb-19 8:25
Fernando Gregorio22-Feb-19 8:25 
QuestionNo Source dll (MakeReport) Pin
Orlando Torrico Fernandez6-Aug-15 9:15
Orlando Torrico Fernandez6-Aug-15 9:15 
QuestionNo source Pin
i0021-May-15 21:15
i0021-May-15 21:15 
QuestionReference MakeSoft.KReport Pin
Member 1094555614-Jul-14 6:01
Member 1094555614-Jul-14 6:01 
Can you send me the library MakeSoft.KReport to download?

Thanks a lot
QuestionThank you Pin
Орест Мервнський14-Feb-14 12:19
Орест Мервнський14-Feb-14 12:19 
QuestionSource Code Pin
Laines7218-Dec-12 23:36
Laines7218-Dec-12 23:36 
QuestionKREPORT source code Pin
amcaminos116-Nov-12 12:44
amcaminos116-Nov-12 12:44 
GeneralExport Option Not working Pin
Anubhava Dimri3-Mar-10 19:10
Anubhava Dimri3-Mar-10 19:10 
GeneralReferencia MakeSoft.KReport Pin
BenneDSant12-Sep-08 4:56
BenneDSant12-Sep-08 4:56 
GeneralTell me more Pin
WillemM26-Feb-08 19:52
WillemM26-Feb-08 19:52 
GeneralGood work Pin
Guilherme Labigalini26-Feb-08 13:30
Guilherme Labigalini26-Feb-08 13:30 
GeneralNice, but there is no code to download ! Pin
pita200022-Feb-08 19:18
pita200022-Feb-08 19:18 
Questiondonwload Pin
Marcel J. Kloubert22-Feb-08 12:02
Marcel J. Kloubert22-Feb-08 12:02 
GeneralRe: donwload Pin
Member 467890422-Feb-08 16:05
Member 467890422-Feb-08 16:05 
GeneralInfelizmente... Pin
thompsons22-Feb-08 10:32
thompsons22-Feb-08 10:32 
GeneralParabens!!! Pin
Member 247788122-Feb-08 6:22
Member 247788122-Feb-08 6:22 

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.