User:Piggz/KexiHandbook

From KDE UserBase Wiki
Revision as of 21:43, 10 April 2012 by Piggz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

Window Types

Tables

Queries

Forms

Reports

Introduction

The Kexi Report plugin allows for the creation of dynamic page-based business reports from data held within the database.

Data can be ordered independently to how it is stored, and the reports can be structured with groups, headers and footers.

Concepts

Many of the concepts are similar to those in similar applications such as Microsoft Access, Oracle Reports and the LibreOffice Report Builder.

Report
A report is an object made from one or more sections. This top level object contains properties that are applicable to the entire report, such as Name and Paper Size.
Sections
A report contains at least one section, the detail section. This section is repeated for every row in the data set that makes the report. Additional sections can be added to increase the structure of the report, such as group-header, group-footer, report-header, report-footer, and many types of page-header/footer.
Items
Fields in the data set can be represented by Items in the report. An item is added to one of the report sections. Some items do not need to be associated with a data field, such as the Label item, which shows static text.
Scripting
Although many report formats can be created using just the report gui designer, fully dynamic and advanced layouts can be created using code snippets that run on an event based system when the report is rendered.
Extensibility
Although the report system in Kexi is a plugin to the main Kexi application, it itself has a plugin system that allows for the addition of new Item types. Some of the default items are built-in, and some are plugins, such as the Barcode and Chart items.

Report Design

Report

The top-level report object contains properties that relate to the entire report. These properties are accessible by clicking on the rectangular region at the top-left of the report between the horizontal and vertical rulers.

Properties
Name Type Description
Title String The title that is displayed in the
Page Size Fixed List of Values Sets the paper size for the report. Several standard paper sizes are catered for. The report design area will automatically adjust to the appropriate dimensions. The default is 'A4'
Page Orientation Fixed List of Values Sets the page orientation to Portrait or Landscape. The report design area will automatically adjust to the appropriate dimensions. The default is 'portrait'
Page Units Fixed List of Values Sets the measurement units used for all sizes and positions in the report. The default is 'cm'.
Grid Snap Boolean Determines whether items added to the report sections will 'snap' into place. The snap location depends on how many grid divisions are selected. The default is 'yes'.
Show Grid Boolean Determines whether or not the grid is displayed in the report sections in the design view. The default is 'yes'.
Grid Divisions Numeric Sets the number of divisions between each major grid point. The default is '4'.
Left Margin Numeric Sets the width of the left margin. The value is in the units specified for the Page Units. The default is '1cm'
Right Margin Numeric Sets the width of the right margin. The value is in the units specified for the Page Units. The default is '1cm'
Top Margin Numeric Sets the height of the top margin. The value is in the units specified for the Page Units. The default is '1cm'
Bottom Margin Numeric Sets the height of the bottom margin. The value is in the units specified for the Page Units. The default is '1cm'
Script Interpreter Fixed List of Values Sets the language used for scripting the report. This is only required if adding advanced functionality via the scripting framework is desired. The default value is 'javascript'.
Object Script Fixed List of Values Sets the script to be associated with this report. The list of values is limited to scripts in the database that are defined as 'object' scripts, and which match the language set for the Script Interpreter. There is no default value.
Sections

The following is the list of all possible section types:

  • detail
  • group-header
  • group-footer
  • report-header
  • report-footer
  • page-header-any
  • page-header-even
  • page-header-odd
  • page-header-even
  • page-header-first
  • page-header-last
  • page-footer-any
  • page-footer-even
  • page-footer-odd
  • page-footer-even
  • page-footer-first
  • page-footer-last

Sections are added and removed using the Edit Sections button available on the window toolbar. The section editor also allows for sorting of data within the report by any of the available fields in either ascending or descending order. When fields are added as a Group Section, the following can be set:

Column
The field associated with the group
Sort Order
Either ascending or descending
Group Header
Set if a header is to be displayed for this group
Group Footer
Set if a footer is to be displayed for this group
Insert Page Break after Footer
Set if the report is to start a new page after this group

The order of precedence for page headers/footer is:

  • First/Last
  • Odd/Even
  • Any

The report-header appears at the start of the report, but after any page-header, and the report-footer appears at the end of the report, but before any page-footer.

Properties
Name Type Description
Height Numeric Sets the height of the section manually. The height can also be set by dragging the bottom of the section up or down. The default value is 2.5cm.
Background Color Color Sets the background color of the section. The default value is '#ffffff' or White.
Items

The following is the list of all built-in item types

  • Label
  • Field
  • Text
  • Image
  • Check
  • Line

The following is the list of all shipped item plugins

  • Chart
  • Barcode
  • Web
  • Map
Label

A label provides a method of displaying static text on a report, such as a title or field name.

Properties
Name Type Description
Name String Every item on a report has a name that allows it to be used from within scripts. The default name for a Label is 'label'followed by a number.
Position Numeric X-Y Coordinate Pair The position of the item relative to the top left corner of the section it belongs to. There is no default value.
Size Numeric Width-Height Pair The size of the item in the units specified as the report units. The default value for a label is 0.87cm x 0.37cm.
Caption String The text displayed in the label. The default value is 'Label'.
Horizontal Alignment Fixed List of Values Sets the horizontal alignment of text within the label. Options are Left, Right, Center. The default value is Left.
Vertical Alignment Fixed List of Values Sets the vertical alignment of text within the label. Options are Top, Bottom, Center. The default value is Center.
Font Font Sets the Font, Font Style and Size of text within the label. The default value is taken from the default Qt font settings.
Background Color Color Sets the background-color of the label. The background-color fills the entire size of the item. The default value is '#ffffff' or white.
Foreground Color Color Sets the foreground-color of the label. The foreground-color is the text of the lable. The default value is '#000000' or black.
Opacity Numeric Sets the opacity of the background. An opacity of 0 is completely transparent, an opacity of 100 is completely opaque. The defaut value is 1.
Line Weight Numeric Sets the line-weight (width) of the label. The line-weight is the border around the edge of the label. The default value is 1.
Line Color Color Sets the line-color of the label border. The default value is '#000000' or black.
Line Style Fixed List of Styles Sets the line-style of the label border. Several dot/dash style combinations are available. The default style is 'none' meaning the border is not displayed.
Scripting
Extensibility

Report View

Overview
Output Formats
Screen
Screen View Description
Printer
Description
Spreadsheet (ODS)
Description
Document
Description
HTML (Table)
Description
HTML (CSS)
Description