{Home} {Impressum}

wxRepWrt

ReportWriter for wxWidgets

Hi wxWidgets users!

This page is a 'quick and dirty' effort to release our report writer to the community since every now and then people are asking for such a tool. So, please don't flame me because the page isn't looking as good as you would like it ;-)

On this page you can find the sources for our report writer tool for wxWidgets. With it, it's easy to create table based reports for all kinds of data. The report writer stores all created reports in a configurable directory for later previewing and/or printing. Each report can be annotated with information about when and by whom it was created (see dialog below). All reports are saved in a compact binary format.

Within a report you can start a sub-report at any time; and within a sub-report you can have another sub-report... This hierarchy is unlimited.

Page breaks are handled automatically, but the user can insert additional page breaks where he/she needs them. Report writer was created to have absolute control over the positioning (and increments) of the objects used on a page. All position information is in Millimeters with a resolution of 0.01mm

One can preview or print ramdomly selected pages. For this you can navigate to selected pages in the preview dialog very easily. ReportWriter is optimized for speed to find the selected page very quickly even in a 1000+ pages report.

Since I'm very busy these days I've not been able to write documentation for this piece of software. If you're able to understand the code of the demo application, please feel free to use the ReportWriter for your projects. Otherwise you should still wait for documentation.

Licence

This software is released under the same conditions as wxWidgets; free for non-commercial and commercial applications.

Pictures

Here are some pictures of possible dialogs and outputs:


Selecting a report...


A footer...


A sub-report within a report...

Download

You can download the source-code of the demo application here: (Windows, VC++) or (SuSE Linux 9.0). (The above pictures were taken from the Windows version.)

The source-codes of the ReportWriter are here: (Windows, VC++) or (SuSE Linux 9.0).

Usage under Windows

Since I don't have write access to the wxWidgets CVS, I've put the source-files from the archive into my local wxWidgets source tree (.../src/common/repwrt.cpp and .../include/wx/repwrt.h) and added repwrt.cpp to my local wxWidgets.dsp Visual C++ project. After that, wxWidgets library needs to be re-compiled.

Usage under Linux

Please read README-wxRepWrt.txt which you'll find in your WXWIDGETS directory after you have un-tarred the source-codes.

Hints for preview and/or printing

wxRepWrt contains a class called  wxReportSelector  which lets you interactively select a stored report for preview and/or printing. Since the  wxReportWriter  has to open the report-file on disk, there is a risk that the file stays open after preview or printing if you use the sequence of functions in the wrong order. Here is some code which should be used in an application:


void MyFrame::OnSelectAReport( wxCommandEvent &event )
{
  wxReportSelector dlg( this,
                        wxT("Existing Reports"),   // title
                        wxT(".") );                // path to reports

  if ( wxID_OK == dlg.ShowModal() )
  {
    wxReportWriter *pReport;

    switch ( dlg.GetSelected() )
    {
      default:
        break;

      case REPSEL_PRINT:
      case REPSEL_PREVIEW:
        pReport = new wxReportWriter(    // This opens the report-file
                        this,
                        dlg.GetFilename(),
                        wxPoint(10,10),
                        wxSize( 100, 100 ) );
        pReport->SetupReport( dlg.GetFilename() );

        if ( dlg.GetSelected() == REPSEL_PRINT )
        {
          pReport->Print();
          pReport->FinishReport();       // closing the report-file
        }
        else
          pReport->PrintPreview();       // this function will close
                                         // the report-file auto-
                                         // matically in its
                                         // OnCloseWindow() function
        break;

    } // switch

  } // if wxID_OK...

} // end of OnSelectAReport()


June 2004 ---
Juergen D. Geltinger
jgelti(at)ifd.de

Last change: 14-Jun-2004
© Copyright 2002-2004, IFD Altdorf, Germany
All rights reserved