TRColumn
Fuente: source/classes/rcolumn.prg
Standalone class
TRColumn represents a single column within a TReport. It defines how data is retrieved, formatted, and displayed for each column in a printed report. Columns support totals, cumulative totals, memo fields, images, progress bars, and inline charts.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
oReport | Object | Parent TReport object this column belongs to |
aData | Array | Array of codeblocks retrieving field values for each line |
aTitle | Array | Column heading lines |
aPicture | Array | Picture clauses for formatting column data |
nWidth | Numeric | Column width in report units |
nTotal | Numeric | Running total accumulator |
lTotal | Logical | Enable column total display |
lMemo | Logical | Treat column as multi-line memo text |
lImage | Logical | Treat column as image display |
lProgBar | Logical | Render column as a progress bar |
lCumTotal | Logical | Enable cumulative running total |
nAlignTitle | Numeric | Title text alignment |
bDataFont | Codeblock | Data font selector (returns font index) |
bColor | Codeblock | Conditional color codeblock |
cChartStyle | Character | Inline chart style ("BAR", "PIE", etc.) |
Methods
| Method | Description |
|---|---|
New( aTitle, nCol, aData, nSize, aPicture, bFont, lTotal, bTotalExpr, cFmt, lShadow, lGrid, nPen, oReport, lCumTotal ) | Create a new TRColumn instance |
SayTitle( nRow, nCol, nLine ) | Render column title at the specified position |
SayData( nRow, nCol, nLine ) | Render data value at the specified position |
SayTotal( nRow, nCol ) | Render total value at the specified position |
Stabilize( nOrder ) | Calculate column dimensions and prepare for rendering |
LineCount() | Return the number of lines this column occupies |
DrawChart( oRect ) | Draw an inline chart (bar/pie) within the column area |
DrawProgBar( oRect ) | Draw a progress bar within the column area |
Separator( nRow, lForced ) | Draw a separator line at the given row |
Example: Column with Total
#include "FiveWin.ch"
#include "report.ch"
function BuildReport()
local oReport, oCol
REPORT oReport TITLE "Sales Report" PREVIEW
COLUMN oCol TITLE "Product" DATA { || oSale:Product }
COLUMN oCol TITLE "Amount" ;
DATA { || oSale:Amount } ;
PICTURE "999,999.99" ;
TOTAL
END REPORT
ACTIVATE REPORT oReport
return nil
Notes
- TRColumn is created implicitly when using the
COLUMNcommand inside aREPORTblock. - Set
lTotal := .T.to enable automatic totaling for numeric columns. - The
lCumTotalflag accumulates totals across groups rather than resetting per group. - Memo columns (
lMemo := .T.) support multi-line text wrapping within the column width. - Image columns (
lImage := .T.) display bitmaps retrieved by the data codeblock. - Columns support inline bar charts via
cChartStyleandchartdatadata members.