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
- Download the FastReport Community Designer:
- Create or edit a template locally and place it in
templates/. - In Report > Options, clear Compress report (the report is then saved as XML).
- (Optional) Generate a starter template with embedded data:
GET /api/srs/{id}/_new.frxsrs_administrator - 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
templatenamemust match the.frxfile (case sensitive on some filesystems). - A corresponding template must exist in
templates/, otherwise the request returnsTemplate 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 | |
|---|---|
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 | |
|---|---|
You can wrap this in an IIf for inline conditional formatting:
| Text Only | |
|---|---|
Auto-growing (sizable) content
To allow a text block to expand vertically, enable:
CanGrow = True
Example layout concept: