Class MatrixData
Contains a set of properties and methods to hold and manipulate the matrix descriptors.
Inheritance
Inherited Members
Namespace: FastReport.Matrix
Assembly: FastReport.OpenSource.dll
Syntax
public class MatrixData
Remarks
This class contains three collections of descriptors such as Columns, Rows and Cells. Use collections' methods to add/remove descriptors. When you are done, call the BuildTemplate() method to refresh the matrix.
To fill a matrix in code, use the AddValue method.
Properties
Cells
Gets a collection of data cell descriptors.
Declaration
public MatrixCells Cells { get; }
Property Value
Type | Description |
---|---|
MatrixCells |
Remarks
Note: after you change something in this collection, call the BuildTemplate() method to refresh the matrix.
Columns
Gets a collection of column descriptors.
Declaration
public MatrixHeader Columns { get; }
Property Value
Type | Description |
---|---|
MatrixHeader |
Remarks
Note: after you change something in this collection, call the BuildTemplate() method to refresh the matrix.
Rows
Gets a collection of row descriptors.
Declaration
public MatrixHeader Rows { get; }
Property Value
Type | Description |
---|---|
MatrixHeader |
Remarks
Note: after you change something in this collection, call the BuildTemplate() method to refresh the matrix.
Methods
AddValue(Object[], Object[], Object[])
Adds a value in the matrix.
Declaration
public void AddValue(object[] columnValues, object[] rowValues, object[] cellValues)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | columnValues | Array of column values. |
System.Object[] | rowValues | Array of row values. |
System.Object[] | cellValues | Array of data values. |
Remarks
The number of elements in an array passed to this method must be the same as a number of descriptors in the appropriate collection. That is, if your matrix has one column, two row and one cell descriptors (in Columns, Rows and Cells collections respectively), you have to pass one-element array for the columnValues param, two-element array for the rowValues and one-element array for the cellValues.
Examples
This example demonstrates how to fill a simple matrix that contains one column, row and cell.
MatrixObject matrix;
matrix.Data.AddValue(
new object[] { 1996 },
new object[] { "Andrew Fuller" },
new object[] { 123.45f });
// this will produce the following result:
// | 1996 |
// --------------+----------+
// Andrew Fuller | 123.45|
// --------------+----------+
AddValue(Object[], Object[], Object[], Int32)
Adds a value in the matrix.
Declaration
public void AddValue(object[] columnValues, object[] rowValues, object[] cellValues, int dataRowNo)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | columnValues | Array of column values. |
System.Object[] | rowValues | Array of row values. |
System.Object[] | cellValues | Array of data values. |
System.Int32 | dataRowNo | Datasource row index. |
Remarks
See the AddValue(Object[], Object[], Object[]) method for more details.
Clear()
Clears all descriptors.
Declaration
public void Clear()
GetValue(Int32, Int32, Int32)
Gets a value with specified column, row and cell indicies.
Declaration
public object GetValue(int columnIndex, int rowIndex, int cellIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | columnIndex | Index of a column. |
System.Int32 | rowIndex | Index of a row. |
System.Int32 | cellIndex | Index of a cell. |
Returns
Type | Description |
---|---|
System.Object | The value of a cell. |
SetValue(Int32, Int32, Object)
Sets the cell's value.
Declaration
public void SetValue(int columnIndex, int rowIndex, object cellValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | columnIndex | Index of a column. |
System.Int32 | rowIndex | Index of a row. |
System.Object | cellValue | The new value. |