TRLine
Source: source/classes/rline.prg
Standalone class
TRLine manages a single line of text within a TReport. It supports multiple text fragments per line, each with its own font and alignment. Lines are composed of codeblocks that are evaluated at print time to produce the final text, enabling dynamic content such as page numbers, dates, and data-driven labels.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
oReport | Object | Parent TReport object |
aLine | Array | Array of codeblocks that return text fragments |
aFont | Array | Array of font index codeblocks (default all 1) |
aWidth | Array | Array of calculated text widths per fragment |
aPad | Array | Array of padding alignment per fragment (RPT_LEFT, etc.) |
nHeight | Numeric | Total line height in pixels |
nWidth | Numeric | Maximum width across all fragments |
nCol | Numeric | Starting column position |
Methods
| Method | Description |
|---|---|
New( aLine, oReport, nPad ) | Create a new TRLine. nPad defaults to RPT_LEFT. |
Stabilize( nFirstRow, nFirstCol ) | Calculate fragment positions and dimensions |
Say( nStartRow ) | Render all line fragments starting at the specified row |
Add( bLine, bFont, nPad ) | Append a new text fragment codeblock at the end |
Ins( nLine, bLine, bFont, nPad ) | Insert a new fragment at position nLine |
Del( nLinIni, nLinFin ) | Remove fragment(s) from nLinIni to nLinFin |
Example: Line with Left and Right Fragments
#include "FiveWin.ch"
#include "report.ch"
function AddReportLines( oReport )
local oLine
LINE oLine OF oReport
TEXT FRAGMENT oLine ;
TEXT { || "Page " + Str( oReport:nPage ) } ;
FONT { || 1 }
TEXT FRAGMENT oLine ;
TEXT { || Dtoc( Date() ) } ;
FONT { || 1 } ;
RIGHT
return nil
Notes
- TRLine is created via the
LINEcommand within aREPORTblock or programmatically. - Each fragment can use a different font by returning the font index from its font codeblock.
- The
aPadarray controls alignment per fragment: RPT_LEFT (default), RPT_CENTER, or RPT_RIGHT. Stabilize()must be called beforeSay()to calculate layout dimensions.- Empty lines (first fragment evaluates to
"") are skipped with zero height.