LazReport Documentation

From Free Pascal wiki
Jump to navigationJump to search

OVERVIEW

LazReport is a group of components to add reporting capabilities to applications, it uses a visual designer to create banded reports and includes a report engine with previewer and includes a interpreter to run user scripts. Report designer can be invoked at runtime.

LICENSE

LazReport is based on FreeReport 2.32 and thanks to Fast Reports Inc. it's available under modified LGPL, the same license as the Lazarus LCL. see files lazreport/ license.txt, license-rus.txt and license-lazreport.txt for details.

AUTHORS

FreeReport was created for Fast Reports Inc. LazReport initial port was made by Olivier Guilbaud. Lazarus integration and fixes by Jesus Reyes A. Many contributors, see lazreport/doc/contributors.txt file

INSTALL

To install LazReport under lazarus IDE:

1. Open LazReport Package. Menu: Components->Open package file (.lpk)... 2. Open file components/lazreport/source/lazreport.lpk 3. Compile 4. Install

Next time lazarus is started, it should show a LazReport tab in component palette.

DOCUMENTATION

Developer's manual and User Guides specific for LazReport are yet to be written, in the mean time, most of LazReport features are described in FreeReport Developer's Manual (see lazreport/doc/fr_eng.sxw), platform specific things described there like OLE objects are not implemented in LazReport, also some examples or pictures make reference to samples available only on Delphi.

Until LazReport documentation is elaborated, this wiki page will be used as a documentation container, maybe in the future the missing documentation could be generated from here. Users are welcomed to add topics that they feel need to be documented.

Export Filters

Since LazReport 0.9.6, the export filters support has been enhanced, now export filters can take parameters which users can customize either by changing values directly or by presenting the end user some UI. In order to make changes in parameters, the developer can create an event handler for TfrReport.OnExportFilterSetup event, available by selecting the TfrReport component and selecting the Events tab in Object Inspector.

The OnExportFilterSetup (of type TExportFilterSetup) event handler takes an argument sender of type TfrExportFilter, in order to use this types, lr_class.pas unit must be added to unit uses clause. All ExportFilter clases share this event and developer has to type-cast the sender argument to the desired export filter class for example: <Delphi> if sender is TfrHTMExportFilter then begin

 TfrHTMExportFilter(sender).UseCSS := false;

end; </Delphi> below a description of available export filters.

TfrExportFilter

is the base class of all export filters, and defines two properties that can be modified by developer in the OnExportFilterSetup event:

  • BandTypes: TfrBandTypes. this is a set of band types, only bands included in this set are actually exported, the rest of bands present on report will be ignored. Using this property a developer could for example export only the master band content, leaving titles, headers and footers out of exported output by doing:

<Delphi> sender.BandTypes := [btMasterData]; </Delphi> by default, all bands are processed but TfrCSVExportFilter changes this property to process only master header, column header and master data bands.

  • UseProgressbar: boolean. This property enable or disable showing the progress bar while processing the export filter. This property is false by default.

TfrTextExportFilter

is the base class of text based export filters. This export filter tries to make a text representation of a graphical report by fitting the original graphical coordinates into a more coarse grid where each unit is of "UsedFont" pixels, depending on the value of UsedFont value, the exported output may more or less represent the layout of objects in graphical report. Beside the properties inherited from TfrExportFilter class, TfrTextExportFilter define two more properties.

  • UsedFont: this property define the pixel dimensions on the output grid, objects on report are fitted into this grid by reclaculating each x and y position. The default value is 10, if user changes this value to 0 o less, LazReport will show automatically a dialog asking for the UsedFont value, if user enter a invalid value, a 10 value will be used. The 10 value is used because is the value that better fits the usual reports which are made with fonts 10-13 points.
  • UseBOM: This property enable the inclusion of UTF-8 Byte Order Mark character at the start of text output (see BOM) needed by some editors/viewers, by default no BOM is used in exported output.

BUG REPORTS

Please report problems using the lazarus/freepascal bugtracker, project: "Lazarus Packages", Category "LazReport", for patches please submit a bug report and attach the patch to it.