Report Items
Report items are the elements you can place in the report sections. Your report content is built from these elements. The following item types are available:
-
Simple Static Text (label)
-
HTML (Rich) Text
-
Data Field
-
Line
-
Rectangle
-
Ellipse / Circle
-
Image
-
Barcode
-
Custom Graphical Content (Graph)
-
Table View / Model based Table
-
Cross Table
-
Graphics View Content
-
Chart (optional, HighCharts integration)
The report item buttons in the Designer’s toolbar:
Static Text Item
The static text item (or label) represents simple text with uniform formatting. It cannot be dynamic; its text is saved statically in the report definition. You can use this item for labels, prefixes, suffixes, or any other static content that does not change. Static text can be a single line or a wrapped multi-line text block. The text format (font, color, and alignment) can be set.
To change the text font format and attributes in the Designer, select one or more static text items and use the text formatting toolbars to change the settings.
HTML (Rich) Text
HTML text items are complex text objects with HTML markup, implemented using the QTextDocument class. They display rich text specified using a subset of HTML 4 markup. The text can be either static or dynamic, so it is possible to load rich text from a data source, a file, or a parameter at runtime.
Data Field
The field is the most important report element. It can represent one or more pieces of data from a data source, a parameter, a variable, a system variable, or an expression, depending on its field source type. Field values can be formatted according to their data type (text, numeric, date, or boolean).
Line
A graphical line defined by a start point and an end point. The line characteristics are configurable: you can change the line style, width, and color. Lines are static objects.
Rectangle
A graphical rectangle specified by its position, width, and height. The rectangle characteristics are configurable: you can change the line style, width, and color. Rectangles can be transparent or filled. Rectangles are basically static objects, but with the Dynamic Position feature their height and width can be controlled dynamically by a data expression.
Ellipse
A graphical ellipse or circle specified by its position, width, and height. The ellipse characteristics are configurable: you can change the line style, width, and color. Ellipses can be transparent or filled. Ellipses are basically static objects, but with the Dynamic Position feature their height and width can be controlled dynamically by a data expression.
Image
An image loaded from a file or embedded in the report. The supported formats include PNG, JPEG, BMP, and SVG. You can assign a direct link to a file or use a static image stored in the report. The image is specified by its width and height, and many characteristics are configurable, such as alignment, aspect ratio, and transformation mode. Reports can contain both static and dynamic images (for example, images loaded from a data source column or from a file name stored in the data), so the image element is very flexible.
Barcode
NCReport provides barcode rendering for more than 50 barcode symbologies (for example, EAN, UPC, Code 128, Code 39, QR Code, Data Matrix, and PDF417), thanks to the integrated Zint back-end library. The barcode item can render a barcode from a static value or from a dynamic source, such as a data source column. See Barcodes for details.
Table View / Model
The Table View item is intended for rendering QTableView tables with WYSIWYG print support. It prints tables the same way as they appear in the QTableView screen widget, following the formats of the original widget. The cells get their display appearance information from the table’s item model. Some basic table settings, such as the header background, line style, and line color, are currently fixed. The table item can also render a QAbstractItemModel without a QTableView.
Cross Table
The cross table is also known as a pivot table, a cross-tab report, or rotated data within a table. In cross tables, the data source records are represented as horizontal columns, and the data source columns are printed as the rows of the table. Such tables often include horizontal and/or vertical totals as well.
Custom Graphics Content
The Graph/Custom item is a special member of the NCReport items. It enables you to render QPainter-drawn content in reports using your own C++/Qt code. The typical use of this feature is rendering graphs or similar user-defined content.
Graphics View Content
The Graphics View item renders the content of a QGraphicsView widget, for example a Qt Charts chart view, into the report.
The application registers the QGraphicsView object in the report definition using the NCReportDef::addGraphicsView(id, view) method,
and the item refers to the view by its class ID. In the Designer, the item is displayed as a placeholder showing the class ID,
because the actual content is available only at runtime.
Chart
The Chart item renders charts using the HighCharts JavaScript charting library. The chart is defined by an HTML/JavaScript template file
and is filled with report data at runtime. The item is available only if NCReport is built with the optional highcharts extension
(see src/config.pri), which requires the Qt WebEngine module. This integration is provided without official support. See Charts and Graphics for the available charting options.