Skip to content

Add page configuration, extra bands, and fluent API improvements to R…#823

Open
ekondur wants to merge 1 commit intoFastReports:masterfrom
ekondur:822
Open

Add page configuration, extra bands, and fluent API improvements to R…#823
ekondur wants to merge 1 commit intoFastReports:masterfrom
ekondur:822

Conversation

@ekondur
Copy link
Copy Markdown

@ekondur ekondur commented Apr 11, 2026

New Features

Page layout configuration — new fluent methods on ReportBuilder<T>:

  • .Landscape() — sets page orientation to landscape (defaults to true, accepts explicit bool)
  • .PaperSize(width, height) — sets paper dimensions in millimeters
  • .Margins(left, top, right, bottom) — sets all four page margins in millimeters

New band types — each accepts a fluent configuration callback with .Text(), .HorzAlign(), .VertAlign(), .TextColor(), .FillColor(), .Font(), .Height(), .Visible():

  • .PageHeader(...) — renders text at the top of every page; supports FastReport expressions
  • .PageFooter(...) — renders text at the bottom of every page; supports pagination expressions like [Page#] / [TotalPages#]
  • .ReportSummary(...) — renders text once after all data rows

Report title Height() supportReportTitleBuilder now inherits from TextBandBuilderBase, making .Height() available to control the title band height. Previously the height was hardcoded to 1 cm and could not be changed through the fluent API.


Bug Fixes

Report title alignment was hardcodedHorzAlign on the report title text object was always set to HorzAlign.Center regardless of what .HorzAlign() was called on the builder. VertAlign was also silently ignored. Both now correctly read from the builder configuration.

Data header cells inherited alignment from report title — Data header column cells were reading VertAlign and HorzAlign from _reportTitle instead of _report. Report-level .HorzAlign() / .VertAlign() now correctly propagates to data header cells.

Zero-width text objects in page bandsPageHeader, PageFooter, and ReportSummary text objects were created with band.Width, which is 0 on a newly constructed band before FastReport lays it out. This made the bands invisible in exported PDFs while all object properties were set correctly, causing tests to pass but output to be blank. Fixed by computing the usable width from page dimensions: (PaperWidth - LeftMargin - RightMargin) / 10 * Units.Centimeters.

Report title text not spanning full page — The title text object was hardcoded to x=5cm, width=10cm, so .HorzAlign(HorzAlign.Center) centered text within that fixed box rather than the full page. Fixed by spanning the text object across the full usable page width using the same formula as above.


New / Refactored Types

Project infrastructure:

  • Migrated FastReport.ReportBuilder.UnitTest.csproj from legacy packages.config format (net471) to SDK-style (net48, <PackageReference>)
  • Deleted packages.config
  • Updated FastReport NuGet references to 2025.2.12
  • Renamed all existing test PDF outputs to unique filenames per test (previously all wrote to Employees.pdf)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants