print reportDataSum

Sums either a column or row of data by inserting the Excel function =SUM(). This requires the data be contiguous and be numeric. Excel will ignore strings with this function, it is suggested to use the column value to set the column and or row to sum.

This formatter / function can sum both a row and a column. To sum a rows data, set the column to be summed. This should be the column index from the reportData object. This value starts at 1, so the first column is 1, the second 2, third 3 etc. Keep this in mind when using this class.

If the row is set only the specified row will be used. This number should be the row number in the reportData set and NOT the anticipated row in the report itself. The first row is 1, the second 2 etc.

Example usage:

// This examples adds totals as the last row of reportData
// simple test class with other methods ignored
class testReport extends reportBase {

		function _run() {
			// insert other rows above, now add some sums to the columns
		// our reportData contains, col1,2...4 and a total
					'col3' => new reportDataSum(0, 3, $this->getReportData()->sumColumn('col3')), // sum only col3
					'col4' => new reportDataSum(0, 4, $this->getReportData()->sumColumn('col4')), // sum only col4
					'total' => new reportDataSum(0, 5, 0) // sum only col5


public __construct([$inRow = null], [$inColumn = null], [$inStringValue = 0], [$inStringFormat = null], [$inOptions = array()])

Creates a new instance

public reset()

Resets the object to defaults

public render($startRow, $startCol, $endRow, $endCol, [$sheetRowStart = 5])

Returns the sum formula in Excel format

Inherited Methods

<  1  >