FPReport

From Free Pascal wiki
Revision as of 16:52, 11 June 2017 by Michael (talk | contribs) (→‎units)
Jump to navigationJump to search

Architecture

FPReport is a banded reporting tool.

It was designed from zero, to be able to run on a headless webserver, with minimal dependencies. An important use-case was a Linux server running in a container without X libraries installed. Creating a report is just placing squares with contents on a page, usually based on a data loop. This can be done entirely in-memory, and does not need a display or GUI.

Reports can be created entirely in code, or they can be read from a definition file. The default shipped file uses JSON as the format to store the report definition. The reports can also be designed visually, using a designer. A stand-alone designer exists, as well as the possibility to design a report within the Lazarus IDE.

Once the report is created, it can be saved to disk, or rendered. Rendering is the act of creating visual output.

Various renderers have been implemented:

  • To PDF. The PDF renderer is the renderer of choice
  • To a series of images. The FPImage renderer creates a bitmap per page, and the bitmaps can be saved in a directory in any of the supported FPImage formats.
  • To HTML: each page is rendered as a HTML page using appropriate CSS markup.
Parts that cannot be rendered as HTML and CSS will be rendered as an image and placed in the HTML page.
  • To the LCL (a canvas).
This is in fact the basis of the preview, the designer and the printing support.
  • To an AggPas canvas. AggPas is a powerful graphics library, and this renderer is similar in scope to the FPImage renderer
  • To fpGUI - this can be used to preview the report in a FPGUI report

units

fpreport
To create a report in code, this unit is all that is necessary.
It contains the basic report, page, bands and elements.
fpreportstreamer
This unit contains the streamer, which reads/writes a report definition from/to file.
fpjsonreport
This unit contains a report class that can be dropped on a Lazarus form/Datamodule:
the report definition will be written to the form file.
fpreportdb
This unit contains the data loop component TFPReportDatasetData , which bases the loop on data from a dataset.
fpreportpdfexport
This unit contains the PDF exporter TFPReportExportPDF.
An instance of this class can be used to export a report to PDF.
fpreporthtmlexport
This unit contains the HTML exporter TFPReportExportHTML.
An instance of this class can be used to export a report to HTML pages.
fpreportfpimageexport
This unit contains the image exporter TFPReportExportfpImage.
An instance of this class can be used to export a report to any supported image format.