Skip to content

07 Printouts - FastReport

SRS integrates with the FastReport (FRX) engine to generate pixel-perfect documents (PDF/HTML) based on structured data returned by SRS commands.

Overview

Templates (.frx files) define the layout, formatting, expressions, and data bindings. At runtime, SRS merges the template and the data and returns a finished document (HTML, PDF, or the populated template).

Template location

Store all FRX templates in the application templates/ directory. Filenames should follow the convention, for example invoice.frx or report-summary.frx.

Quick start

  1. Download the FastReport Community Designer:
  2. Create or edit a template locally and place it in templates/.
  3. In Report > Options, clear Compress report (the report is then saved as XML).
  4. (Optional) Generate a starter template with embedded data:
    GET /api/srs/{id}/_new.frx srs_administrator
  5. Preview your output using the endpoints below.

Preview endpoints

Endpoint Description
/api/srs/{id}/templatename.frx.html Renders the FRX template as HTML.
/api/srs/{id}/templatename.frx.pdf Renders the FRX template as PDF.
/api/srs/{id}/templatename.frx Returns the FRX template merged with data (raw FRX). Role srs_administrator required.

Notes:

  • The templatename must match the .frx file (case sensitive on some filesystems).
  • A corresponding template must exist in templates/, otherwise the request returns Template not found.

Generating a new template with data

Use the special endpoint to scaffold a blank template pre-wired with your SRS data structure:

Text Only
GET /api/srs/{id}/_new.frx

Permissions: Role srs_administrator required.

Data binding model

SRS serializes data for FastReport into a JSON structure accessible inside expressions.

Data Shape Access Pattern
Array (multiple rows) [JSON.item.{srsCommand}.item.{propertyName}]
Single object [JSON.item.{srsCommand}.{propertyName}]

Replace {srsCommand} with the SRS command (item) name and {propertyName} with the column/field.

Examples

Scenario Example
First row field [JSON.item.sales.item.Amount]
Single object field [JSON.item.summary.Total]

Rendering basic HTML in text objects

FastReport supports a limited subset of HTML tags in TextObject components.

Enable HTML rendering:
TextObject > Properties > Behavior > TextRenderType = HtmlTags

Supported (commonly used) tags: <b>, <i>, <u>, <br/>, <font color="#888888" size="8"> ... </font>

Conditional / null checks

Example expression to check if a nested value is not null (and not DBNull):

Text Only
!([JSON.item.srsCommand.item.propertyName] == null || [JSON.item.srsCommand.item.propertyName] is DBNull)

You can wrap this in an IIf for inline conditional formatting:

Text Only
IIf(!([JSON.item.srsCommand.item.Amount] == null), [JSON.item.srsCommand.item.Amount], "-")

Auto-growing (sizable) content

To allow a text block to expand vertically, enable:

CanGrow = True

Example layout concept:

Text Only
1
2
3
4
5
6
DATABAND
  TextObject (CanGrow=True)

DATABAND
  Container
    TextObject (CanGrow=True)