KD Reports generates printable and exportable reports from code and from XML descriptions. Reports may contain text paragraphs, tables, headlines, charts, headers and footers, and more.
Creating Reports out of Qt Applications Reporting is a very common task in almost all applications. From the visualization of database contents in printouts to the creation of invoices or ID cards, it is all about formatting information for printing.
KD Reports is the solution for creating all kinds of reports from within Qt applications. It is a developer tool used in source code, but it allows using templates that are created by design staff. This way, updating reports does not necessarily require code changes. KD Reports is able to retrieve data for reports from databases. Also, it interfaces to Qt’s Model-View technology to access existing application model data.
A report often spans multiple pages, or elements of it need to be placed at specific locations to be printed in forms. KD Reports provides page-breaking and endless paper support. It also supports exact measurements for the placement of elements in form cells. Tables that span multiple pages can have repeating header rows assigned. Those rows will be printed on top of every page the tables spans.
Watermarks can be used to add company logos or classification marks to documents. They appear behind the report contents on every page. Headers and footers can contain images or other elements.
The created reports can be shown in a preview dialog that is part of KD Reports. They can be saved to PDF files or sent directly to a printer.
Creating a Report
Creating a report always starts with creating a KDReports::Report object. Then, there are two basic modes of operation:
- Elements like text blocks and images are created programmatically. The created elements form sequences that are either inlined or stacked as block (similar to HTML formatting rules).
- The report is initialized from an XML template. Then, the programmer fills in parts like table cell contents. In this mode, the programmer is less concerned with the actual formatting. External designers or marketing and sales staff can be tasked with creating the report structure.
Elements of a Report
Reports may contain any number of supported elements. Developers can also add their own custom element types. Element types that are shipped with KD Reports include:
- Images: Images can be loaded from external sources or created using Qt’s painting classes. All image formats supported by Qt or external image format plug-ins can be used.
- Text Paragraphs: Text can be inlined or block formatted. Text paragraphs support all usual style options that developers expect (left, right, justified, or centered formatting) and all possible font style attributes. Text blocks can be nested to allow a part of a paragraph to have highlighted formatting, for example.
- Tables: Tables can be created from multiple sources of data (programmatically, from Model-View models, and from SQL databases). Table cells can be individually formatted. Cells can contain other elements, such as images.
- Charts: Charts are integrated if KDAB’s KD Chart package is available. If integrated, charts can be used anywhere images could be. Since KD Chart uses Model-View as well, creating chart elements that visualize table contents is easy.
- Preview Dialog: KD Reports ships with a preview dialog that can be used to give end users options on how to store or print the created reports.
KD Reports comes with a manual that provides tutorials and references. Also, examples are part of the source code that can be customized and used.
KD Reports licenses include:
- The full source code.
- A Reference Manual.
- A Programmer’s Manual with step-by-step tutorials.
- A 12-month support subscription which contains:
- Access to our email-based support (run by KD Reports developers).
- All new releases of the product, including minor releases and all major releases within the subscription period.