ColaReport - Documentation
 Home
 FAQ
 Examples
 Documentation
 Download
 Purchase
 Feedback
 Support
  Documentation

The public properties and methods of the objects that make up ColaReport appear below. Please also see the Examples section for code samples.

ColaReport

The ColaReport component facilitates the creation of HTML reports. It is intended to be used by developers who dislike the cumbersome process of report writing, but at the same time prefer to have a finer control of output at the HTML level.

Three types of objects exist in the component.

CellColumn Each column of the report needs to have a CellColumn object defined for it and associated to the report via Report.CreateCellColumn(). The CellColumn corresponds to a DataColumn in a DataSet.
Group Groups can be defined for subtotals. Like CellColumn, the name used must correspond to a DataColumn name in the DataSet used. If more than one Group is defined, the outer most ones should be defined first.
Report The actual Report object. In addition to defining CellColumns and Groups for the report, the developer can specify other formatting options by setting the Report's properties.



ColaReport.CellColumn

The CellColumn class inherits from System.Web.UI.WebControls.TableCell, allowing the developer to set properties of the cell to determine how it will be rendered in the table with data values.

Note that the preferred method of instantiation is to use the CreateCellColumn method of the Report object.

Public Constructors

CellColumn () Instantiates CellColumn
CellColumn (
string ColumnName,
string HeaderText)
Instantiates CellColumn, specifying the DataColumn name to use, and the column header to display in the reportColumnName- The DataColumn name to associate the report with. In this case, it is ok to leave blank because or RunningTotalExpression.HeaderText - The text for the column header in the report.
CellColumn (
string ColumnName,
string HeaderText,
string StringFormat,
bool SumColumn)
Instantiates CellColumn, specifying the DataColumn name to use, and the column header to display in the report, the string format, and whether or not to the column is to be summed.ColumnName- The DataColumn name to associate the report with. In this case, it is ok to leave blank because or RunningTotalExpression.HeaderText - The text for the column header in the report.StringFormat - Determines the format of the displayed data, eg. {0:d} for formatting a date.SumColumn - Indicates whether or not the column should be summed for totals and subtotals.

Public Properties

string ColumnName The DataColumn name that appears in the DataSet or DataView. It defines which data element to use in this column of the report.
TableCell HeaderCell This cell is used for the corresponding column header at the top of the table. In addition to including text for a header label, other attributes can be set such as background color.
string HeaderText The column header to display in the report. It is a property that gets its value from HeaderCell.Text, and has been created for convenience.
bool RunningTotal Indicates that this column is a running total. Current value specified in RunningTotalExpression will be added to previous values. This is useful in accounting applications to show how transactions affect the balance.The preferred method of using a running total column is when creating a CellColumn through Report.CreateRunningTotalColumn()
double RunningTotalAmount The initial value to use in the running total column. This is useful in cases where you have a balance forward you would like to use.
bool RunningTotalDisplayedAtEnd Indicates that the running total should be displayed on any total or subtotal lines with other columns that are summed.
string RunningTotalExpression The expression to use when calculating the running total. Here, you can refer to other DataColumn names in your DataSet. Examples include "Transaction", "Debit + Credit", and "IIF(Payment <> 0, Payment, 0)". Using SetAsRunningTotal() is the preferred way to set this.
string StringFormat Determines the string format of the value to be displayed. It uses .NET string formats. Examples include {0:c} for currency formatting, or {0:d} for dates.
bool SumColumn Determines whether or not the column is to be summed, which causes it to appear in Groups and totals.
bool SuppressRepeatedValue Suppresses displaying the value for the current row if the previous row's value was the same. This is useful for using the same column in a group, and avoiding having the same value display on every line.

Public Methods

void DefineFormat
(string StringFormat,
params object[] list)
This method can be used when special formatting is required, such as displaying an image in the report or creating a drill-down report that references another report. There can be an arbitrary number of values to pass into the parameter list, which is referenced in StringFormat.
Example: oCol.DefineFormat ("< a href='RptDetail.aspx?AccountNo={0:g}'>{1:g}< /a >", "AccountNo", "AccountName");
{0:g} is replaced by AccountNo in the DataSet, and {1:g} is replaced by AccountName.

Public Constants

const string csBoxAndBoldStart Defined as: < table border=1 cellpadding=6 cellspacing=0 height='100%' width='100%' valign='bottom' > < tr > < td > < b > < center >. Convenient to set HeaderPreFormat to, to box in column headings
const string csBoxAndBoldEnd Defined as: < /center > < /b > < /td > < /tr > < /table > < /pre > Convenient to set HeaderPreFormat to, to box in column headings


ColaReport.Group

Public Constructors

Group (
Report oReport)
Instantiates Group. This class inherits from TableRow, allowing the developer to specify formatting like the background color, or put the entire row in bold.oReport - the Report to add the Group to.
Group (
Report oReport,
string ColumnName,
bool BlankLineAfterGroup)
Instantiates Group, adding to the specified Report. oReport - the Report to add the Group to.ColumnName- The DataColumn name to associate the report with. In this case, it is ok to leave blank because or RunningTotalExpression.BlankLineAfterGroup - determines whether or not a blank line is displayed after the group

Public Properties

bool BlankLineBeforeGroup Specifies whether or not to output a blank line before beginning a group.
bool BlankLineAfterGroup Specifies whether or not to output a blank line after ending a group.
GroupColumnCollection Cells Collection of GroupColumns that make up the group.
string ColumnName The DataColumn name that appears in the DataSet or DataView. It defines which data element to use for grouping. Note that it assumes that the data is sorted by ColumnName in the DataSet or DataView.
bool DividerBeforeGroup Specifies whether or not to output a divider line before a group
bool DividerAfterGroup Specifies whether or not to output a divider line after ending a group
bool PageBreakAfterGroup Specifies whether or not to "page break" and start a new TABLE after ending a group
bool PreGroupLabel Specifies whether or not to output a line containing a label for the group when beginning a new group
PreGroupTableRow PreGroupRow If PreGroupLabel is set to true, this will be used to render a row at the beginning of the Group.

Group.GroupCellColumn
This is used to format the cells in the row that makes up the Group. It inherits from the TableCell class. Typically, the Text property will be set for a plain label. There is also an additional StringFormat column for formatting the contents of a cell.

Public Constructors

GroupCellColumn () Instantiates GroupCellColumn. This will automatically be done, creating one for each CellColumn in the Report when the Group is instantiated. It is used for rendering labels and totals in the cells that appear on the Group line in the report.

Public Properties

string StringFormat Determines the string format of the value to be displayed. It uses .NET string formats. Examples include {0:c} for currency formatting, or {0:d} for dates.When the GroupCellColumn is created, the StringFormat is automatically copied from the corresponding Report.CellColumn.
string ColumnID Identifies the GroupCellColumn. It is initially assigned the same value as the corresponding ColumnName value in Report.CellColumn when the Group is created

ColaReport.Group.PreGroupTableRow

This is used to format the cells in the row that is displayed at the beginning of a new Group, if so chosen. It inherits from the TableRow class, and its Cells come from the type GroupCellColumnCollection.

Public Constructors

PreGroupTableRow () Instantiates PreGroupTableRow, which is inherited from TableRow.

Public Properties

GroupCellColumnCollection Cells A collection of objects of type GroupCellColumn that describe what should be displayed in each cell on the pre-group row.
ColaReport.Group.GroupCellColumnCollection This collection inherits from System.Collections.CollectionBase and is used for keeping a collection of GroupCellColumn objects. It is used within ColaReport.Group for both Cells and PreGroupRow

Public Constructors

GroupCellCellColumnCollection () Instantiates GroupCellColumnCollection, which is inherited from System.Collections.CollectionBase, and contains a collection of GroupCellColumn objects.

Public Methods

void Add
(GroupCellColumn oGroupCellColumn)
Adds a GroupCellColumn to the collection.
void Remove
(int index)
Removes the GroupCellColumn at the specified index.
GroupCellColumn this [int index] Accessor for GroupCellColumn at the specified numeric index.
GroupCellColumn this [string index] Accessor for GroupCellColumn at the specified index indicated by its column name.
void ApplyAttributeToAll
(string Attribute,
string AttributeValue)
Applies the specified attribute to all GroupCellColumns in the collection. This is useful for setting all columns to bold, for example.


ColaReport.Report

Public Constructors

Report () Instantiates Report
Report
(int iLinesPerPage)
Instantiates Report, specifying number of lines per page to use.

Public Properties

bool AutoGenerateColumns If this is set to true and the user has not added any Columns to the report, a report will automatically be generated, taking the column names from the DataSet or DataView.
CellColumnCollection CellColumns Collection of the CellColumns that define the columns of the report. It is recommended that this is populated via the CreateCellColumn method.
bool DividerAfterHeader Specifies whether or not to output a divider line after the header in the report (and before the data rows)
bool EmptyRowAfterHeader Specifies whether or not to output an empty row after the header in the report (and before the data rows)
bool EmptyRowBeforeTotal Specifies whether or not to output a blank line before outputting total line.
string FirstPageHeader Specifies an HTML string to display at the beginning of the report, on the first page. If not assigned, the value in PageHeader will be used. This allows the Report to have a first page with a different header than the other pages of the report.
GroupCollection Groups Collection of Groups defined for grouping the data on the report.
int LinesFirstPage Specifies how many rows to output on the first page before "page-breaking" and beginning a new TABLE. This is different from LinesPerPage, in case you want to output additional header information on the first page.
int LinesPerPage Specifies how many rows to output before "page-breaking" and beginning a new TABLE.
bool PadCellColumns Specifies whether or not values appearing in cells should be surrounded by a space, so that the columns appear spaced out. Default is true.
Note that when sending to Excel, this should be set to false, otherwise the spaces cause Excel to treat the numeric data as text.
string PageHeader Specifies an HTML string to display at the top of each page, before the table.
string RowAttr Inherits from TableRow. It is used for rendering the < TR > tag. Note that the individual RowAttr.Cells are not rendered here, just the < TR > tag portion.
string RowAttrAlternate If specified, specifies alternate TableRow < TR > attributes to those specified in RowAttr. This is useful in creating reports with a different background color for alternate rows to improve readability.
bool ShowGrandTotal Specifies whether or not to include totals on the report.
bool Transpose Determines if the report should display the data rows as columns, and display the column headers on the left side of the report vertically. This is a convenient way of pivoting the output of the report. Default is false.
int TransposedRowsPerPage Used when Transpose equals true, this is used to specify how many data rows to show per page before "page-breaking".

Public Methods

void Bind
(DataSet dsData)
Binds a DataSet to the report, the source of the data to use.
void Bind
(DataView dvDataView)
Binds a DataView to the report, the source of the data to use.
string Execute () Executes the report, using the data source determined by an earlier Bind() call, and returns a string containing the output of the report.
CellColumn CreateCellColumn
(string ColumnName,
string HeaderText)
Creates a new CellColumn, associates it with the report, and returns it.ColumnName- The DataColumn name to associate the report with. In this case, it is ok to leave blank because or RunningTotalExpression.HeaderText - The header to display for the column in the report.
CellColumn CreateRunningTotalColumn(string ColumnName, string HeaderText,string RunningTotalExpression, double InitialAmount) Creates a new CellColumn that is to contain a running total, associates it with the report, and returns it.ColumnName- The DataColumn name to associate the report with. In this case, it is ok to leave blank because or RunningTotalExpression.HeaderText - The header to display for the column in the report.RunningTotalExpression - The expression to use for the running total. This can be simply the DataColumn name, or an expression like "Debit + Credit"InitialAmount - This specifies a starting value for the running total.
Group CreateGroup
(string ColumnName,
bool BlankLineAfterGroup)
Creates a new Group, associates it with the report, and returns it.ColumnName- The DataColumn name to associate the report with. In this case, it is ok to leave blank because or RunningTotalExpression.BlankLineAfterGroup - determines whether or not a blank line is displayed after the group
Group CreateTotalGroup
(bool BlankLineAfterGroup)
Creates a "Group" that is used for summing column totals for the entire report. It is like a regular Group, but it is not associated with a particular DataColumn name; it is for the entire report. Since Groups must be specified in the outermost to innermost order, this must be created before any other Groups if totals are desired. BlankLineAfterGroup - determines whether or not a blank line is displayed after the group.
Copyright © 2003