Open-source Go reporting library

go-fastreport: FastReport .NET, ported to pure Go

go-fastreport is a free, open-source Go library that ports the core functionality of FastReport .NET Open Source to Go. It gives Go programs a band-based report engine, JSON/XML/CSV/SQL data source binding, an expression evaluator, FRX template loading, and export to HTML, PDF, and PNG — all pure Go, no CGo.

Published

go-fastreport is an independent Go implementation inspired by FastReport Open Source. It is not affiliated with or endorsed by Fast Reports Inc.

What is go-fastreport?

go-fastreport ports FastReport .NET Open Source's reporting model to Go: bands, objects, an expression language, and FRX serialization, plus data binding and export. The usual workflow is to design a report visually in FastReport .NET, save it as an .frx file, then load and run that same template from a Go program — no .NET runtime required at run time.

It is pure Go with no CGo dependencies, so it cross-compiles and runs anywhere Go does. The engine has been smoke tested against 50+ real FastReport .frx sample files.

  • Open source
  • MIT licensed
  • Pure Go
  • No CGo
  • Go 1.23+
  • Free

Features

Band-based layout engine

ReportTitle, PageHeader, PageFooter, DataBand, GroupHeader, GroupFooter, ChildBand, OverlayBand, and more — 13 band types in total.

Four data sources

JSON, XML, CSV, and SQL via database/sql, plus custom in-memory adapters that satisfy the same interface.

Expression evaluator

Bracket-expression syntax [DataSource.Field] with built-in functions like IIF and Format.

FRX serialization

Read and write FastReport XML (.frx) report definitions, including real FastReport sample files.

HTML, PDF, PNG export

Every exporter supports page-range selection, so you can export a subset of a prepared report.

CrossView, barcodes, and more

A pivot-table object (crossview), and barcode rendering for QR, Code128, Code39, EAN, DataMatrix, Aztec, and PDF417.

Quick start

Requires Go 1.23+.

go get github.com/andrewloable/go-fastreport

The common workflow: design a report in FastReport .NET, save it as an .frx file, then load it at runtime and bind a JSON data source.

r := reportpkg.NewReport()
r.Load("report.frx")

// Register parameters and a JSON data source keyed by alias.
// The engine resolves DataBand.DataSource="employees" to this
// source automatically, matching how FastReport .NET wires data.
ds := jsondata.New("employees")
ds.SetJSON(employeeJSON)
ds.Init()

dict := r.Dictionary()
dict.AddParameter(&data.Parameter{Name: "ReportTitle", Value: "Employee Directory"})
dict.AddDataSource(ds)

e := engine.New(r)
e.Run(engine.DefaultRunOptions())

exp := html.NewExporter()
exp.Title = r.Info.Name
exp.Export(e.PreparedPages(), os.Stdout)

A complete, runnable version lives in examples/frx_json. Other examples cover building a report entirely in code and using each data source standalone.

View go-fastreport on GitHub

Data sources

All four data source types embed data.BaseDataSource and satisfy band.DataSource directly — no adapter wrapper needed. Register one in the report Dictionary for FRX workflows, or assign it straight to a DataBand when building a report in code.

JSON

ds := jsondata.New("customers")
ds.SetJSON(`[{"Name":"Alice","Age":30},{"Name":"Bob","Age":25}]`)
ds.Init()

XML

ds := xmldata.New("orders")
ds.SetXML(`<Orders><Item Product="Apple" Qty="5"/></Orders>`)
ds.Init()

CSV

ds := csvdata.New("sales")
ds.SetFilePath("sales.csv")
ds.HasHeader = true
ds.Init()

SQL

db, _ := sql.Open("postgres", "...")
ds := sqlds.New("employees", db,
    "SELECT id, name FROM employees WHERE active = $1", true)
ds.Init()

Export

HTML, PDF, and PNG exporters share the same shape — construct, set options, call Export with the prepared pages and a writer.

// HTML
exp := html.NewExporter()
exp.Title = "My Report"
exp.EmbedCSS = true
exp.Export(preparedPages, &buf)

// PDF (structural)
exp := pdf.NewExporter()
exp.Export(preparedPages, outputWriter)

// PNG, 2x scale for high-DPI
exp := image.NewExporter()
exp.Scale = 2.0
exp.Export(preparedPages, outputWriter)

// Page range on any exporter
exp.PageRange = export.PageRangeCustom
exp.PageNumbers = "1,3-5"

Package overview

PackagePurpose
reportpkgReport, ReportPage — the top-level report definition
bandAll 13 band types: DataBand, GroupHeaderBand, PageHeaderBand, etc.
objectTextObject, SubreportObject, PictureObject, etc.
engineReport execution engine (ReportEngine.Run)
exprExpression parser and evaluator for [bracket] expressions
data / json / xml / csv / sqlDataSource interface, BaseDataSource, and the four adapters
export/html, pdf, imageHTML, PDF (structural), and PNG image export
crossviewPivot table (CrossView) object
barcodeBarcode rendering — QR, Code128, EAN, and more
serialFRX XML serialization (Writer / Reader)
previewPreparedPages — rendered page output
styleBorder, Fill, Style, font helpers
unitsUnit conversion (mm, cm, inches ↔ pixels)
formatNumber and date formatting
functionsBuilt-in expression functions (IIF, Format, etc.)

Band types

BandWhen printed
ReportTitleBandOnce at report start
ReportSummaryBandOnce at report end
PageHeaderBandTop of each page
PageFooterBandBottom of each page
ColumnHeaderBandTop of each column (multi-column layout)
ColumnFooterBandBottom of each column
DataHeaderBandBefore first data row
DataBandOnce per data source row
DataFooterBandAfter last data row
GroupHeaderBandAt group value change
GroupFooterBandAt group end
ChildBandAfter its parent band
OverlayBandOn top of page content

Status & roadmap

This is an active port of FastReport .NET Open Source. Functional today:

  • Core engine: data iteration, band rendering, page breaks, multi-column layouts, groups
  • Data binding: JSON, XML, CSV, SQL, and custom in-memory data sources
  • Dictionary-based DataSource resolution, matching the FastReport .NET model
  • FRX serialization: read and write .frx files, including real FastReport sample files
  • Export: HTML, PDF (structural), PNG image
  • Aggregate totals: Sum, Count, Average, Min, Max with per-group reset
  • CanGrow / CanShrink dynamic band height, and [bracket] expression evaluation
  • Conditional formatting: HighlightCondition evaluation (Fill, TextColor, Font, Visible), first-match-wins
  • Master-detail relation traversal at engine runtime, filtering child data sources per parent row
  • FRX gzip compression: transparent read and write of compressed .frx files
  • HTML export of images and vector shapes (Shape, Line, PolyLine, Polygon, CheckBox)

See porting-plan.md for the detailed, dated roadmap of what's landed.

Frequently asked questions

What is go-fastreport?

A free, open-source, pure Go reporting library that ports the core functionality of FastReport .NET Open Source to Go: a band-based report engine, data source adapters for JSON, XML, CSV, and SQL, and export to HTML, PDF, and PNG.

Does it require CGo or a commercial license?

No. It is pure Go with no CGo dependencies, so it cross-compiles and runs on any platform Go supports. It is MIT licensed and free to use.

Can it load existing FastReport .NET .frx files?

Yes. go-fastreport reads and writes the FastReport FRX XML format and has been smoke tested against 50+ real FastReport sample files. Design in FastReport .NET, save as .frx, then load and run it from Go.

What data sources and export formats are supported?

JSON, XML, CSV, SQL (via database/sql), and custom in-memory adapters for data; HTML, PDF (structural), and PNG for export, each with page-range selection.

Is it production ready?

The core engine, all four data sources, FRX serialization, HTML/PDF/PNG export, conditional formatting, master-detail relation traversal, FRX gzip compression, and HTML export of images and vector shapes are all functional and tested.