TColumnFrame is a specialised frame used to manage output in newspaper style columns. You can fit the output of this frame to any area on a page, and then continue output elsewhere on the same page, or across multiple pages as required.

Start by defining columns with the methods AddColumn or AddColumnWidth (to add sequential columns one at a time) or AddColumns (to add a number of equal width columns). Column boundaries are relative to the left side of the column frame, which can be placed anywhere on the page.

Execute the column frame by calling TColumnFrame.Execute(ReportWriter). Once executed, you cannot add further columns or alter existing column definitions, but you can move the column frame with method PlaceColumnFrame which sets the top left position of the frame. By default, the frame is placed to fill the remaining space in the active band from BandLeft and the current YPos. However, you can resize the output area with methods SetColumnFrameBottom or SetColumnFrameHeight.

The "code loop" in a TColumnFrame is controlled in your OnColumn code by calls to NextColumn which you should use in favour of NewPage to start the next column. When called in the last column, NewColumn will return to the first column and notify you in OnColumnFrameRestart. Call NewPage in this event handler if appropriate, and/or reposition the column frame (with PlaceColumnFrame) to continue output.

Column headers can be printed or line tabs set in OnColumnBefore.

Columns have metric properties very similar to bands, and you should use these properties rather than the equivalent band properties (although the band properties are still valid). For example, column boundaries are defined by funtions ColumnLeft and ColumnRight, and the width is given by ColumnWidth. For space requirements, check ColumnHeightLeft and ColumnLinesLeft, or functions EnoughColumnHeight and EnoughColumnLines.

Control Flow for a TColumnFrame

When executed, a TColumnFrame cycles through a column output event, OnColumn, for each column defined. Calls to NextColumn trigger another cycle.

Column Frame

Printing Text Blocks to Columns

You can use a TTextBlock to automatically output blocks of text to columns. Configure and open a TTextBlock with the desired text, then pass it to the method PrintColumnText:

procedure PrintColumnText(ATextBlock: TTextBlock; AColumnTextMode: TColumnTextMode);


You can fill sequential columns completely, or fill each column evenly by specifying mode ctmFillColumns or ctmEvenColumns respectively.