LazReport Documentation/de

From Free Pascal wiki
Revision as of 00:40, 17 December 2009 by Swen (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en) español (es) polski (pl)

Überblick

LazReport ist eine Gruppe von Komponenten, um Anwendungen um die Möglichkeit zur Reporterstellung zu erweitern. Es verwendet einen visuellen Designer, um auf Bändern basierende Berichte zu erstellen. Es beinhaltet eine Report Engine mit Vorschaufunktion sowie einen Interpreter, um Benutzerskripte auszuführen. Der Report-Designer kann auch zur Laufzeit aufgerufen werden.

Lizenz

LazReport basiert auf FreeReport 2.32 (von Fast Reports Inc). Es ist unter einer modifizierten LGPL verfügbar, der selben Lizenz wie auch die Lazarus LCL. Für Details siehe lazreport/license.txt, license-rus.txt und license-lazreport.txt.

Autoren

FreeReport wurde von Fast Reports Inc erstellt. Die erste LazReport Portierung erfolgte durch Olivier Guilbaud. Die Integration in Lazarus sowie zahlreiche Fehlerbehebungen wurden durch Jesus Reyes A. vorgenommen. Zahlreiche weitere Personen haben an LazReport mitgewirkt (siehe lazreport/doc/contributors.txt).

Installation

Um LazReport in die Lazarus IDE zu installieren:

  1. Öffnen sie das LazReport Package. Menü: Package -> Package-Datei (.lpk) öffnen ...
  2. Wählen sie die Datei components/lazreport/source/lazreport.lpk
  3. Klicken sie auf Installieren

Beim nächsten Start von Lazarus sollte es einen Tab LazReport in der Komponentenpalette geben.

Dokumentation

Entwickler- und Benutzerhandbücher für LazReport müssen noch geschrieben werden. In der Zwischenzeit sind die meisten LazReport Features im FreeReport Entwicklerhandbuch (siehe lazreport/doc/fr_eng.sxw) beschrieben. Plattform-spezifische Dinge wie OLE Objekte, die dort beschrieben sind, sind noch nicht in LazReport implementiert. Auch sind einige Beispiele bzw. Referenzen darauf nur für Delphi verfügbar.

Bis eine LazReport Dokumentation ausgearbeitet ist, soll diese Wiki-Seite als Aufbewahrungsort für Informationen dienen. Vielleicht können in der Zukunft fehlende Teile aus dieser Seite erstellt werden. Die Benutzer sind aufgerufen Themen zu ergänzen, zu denen sie eine Dokumentation vermissen.

Exportfilter

Die LazReport Exportfilter werden wie folgt aufgerufen: <Delphi>

 if TheReport.PrepareReport then
   TheReport.ExportTo(TfrHTMExportFilter, 'exportiertedatei.html');

</Delphi> Where TheReport holds an instance of TfrReport component. In this sample a TfrHTMExportFilter is used to generate a file named 'exportedfile.html'. It's not necesary to prepare again the report if it has been prepared previously. In order to use TfrHTMExportFilter the developer has to drag and drop an instance of TfrHTMExportFilter component from the LazReport tab in componente palette to form in Form Desginer. As an alternative the unit lr_e_htm.pas file needs to be added to unit uses clause.

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> Es folgt eine Beschreibung der verfügbaren Exportfilter:

TfrExportFilter

ist die Basisklasse aller Exportfilter. Sie definiert zwei Eigenschaften, die vom Entwickler im OnExportFilterSetup Ereignis angepasst werden können:

  • 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. Mit dieser Eigenschaft läßt sich die Anzeige eines Fortschrittsbalkens aktivieren oder deaktivieren, der den Fortschritt des Exportprozesses zeigt. Per Vorgabe ist die Eigenschaft auf false gesetzt.

TfrTextExportFilter

Vererbung: TfrExportFilter <- TfrTextExportFilter
befindet sich in der Datei: lr_e_txt.pas, welche zum LazReport Package gehört.

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:integer. 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:boolean. 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.

TfrCSVExportFilter

Vererbung: TfrExportFilter <- TfrTextExportFilter <- TfrCSVExportFilter
befindet sich in der Datei: lr_e_csv.pas, welche zum LazReport Package gehört.

This special text export filter produces Comma Separated Value output (actually any character can be used as separator), it differs from it's ancestor in that it doesn't try to create text layout representation of graphical report, instead, for each record output it tries to guess the fields order from the source report, it then produce a list of fields using a separator defined by the user. Beside the properties inherited from its ancestor classes it defines some properties to customize the generated output.

  • QuoteType:TfrQuoteType. This property controls whether the generated field value should be wrapped using specified quote char or not. Possible values are qtNone, qtQuoteChar and qtAutoQuote. With qtNone the field value is never wrapped, qtQuoteChar will use the character specified by property QuoteChar, any instance of QuoteChar already present in field value is duplicated. qtAutoQuote first try to find if any instance of separator or QuoteChar is already present in field value, if affirmative it behaves as if qtQuoteChar has been specified, on the contrary case, the field value is not wrapped just as if qtNone has been specified. QuoteType property is set to qtQuoteChar by default.
  • QuoteChar:TUTF8Char. This holds the character to be used to wrap the field value in case of QuoteType of value qtQuoteChar has been specified or deduced if qtAutoQuote is set. Any instance of this character in the field value will be duplicated. by default QuoteChar is set to the " character.
  • Separator:TUTF8Char. This is the character used to separate the fields in each record, by default is set to the ',' (COMMA) character but any UTF-8 valid character could be used. Some CSV files are actually TAB separated files, to get this, set Separator:=#9;

The CSV exporter do not use the inherited UsedFont property value so any value set will be ignored. With default property values, TfrCSVExportFilter will produce Excel compatible files, the only caveat is that Excel will not recognize the file as UTF-8 encoded. To force Excel to recognize the encoding automatically, set the property UseBOM to true.

TfrHTMExportFilter

Vererbung: TfrExportFilter <- TfrTextExportFilter <- TfrHTMExportFilter.
befindet sich in der Datei: lr_e_htm.pas, welche zum LazReport Package gehört.

Dieser spezielle Text-Exportfilter erzeugt eine gültige "HTML 4.01 Transitional" Ausgabe. Gegenwärtig definiert er nur eine zusätzliche Eigenschaft:

  • UseCSS:boolean. Diese Eigenschaft steuert, ob die erzeugte Ausgabe CSS Informationen enthält oder nicht. Sie ist per Vorgabe auf false gesetzt.

Bug Reports

Bitte melden sie Probleme und Fehler mittels des lazarus/freepascal Bugtrackers. Wählen sie dort unter project: "Lazarus Packages" und als Category "LazReport". Für Patches erstellen sie bitte einen Bug Report und hängen dort den Patch an.