Creating Matrix Dynamically & Programatically

edited 3:41PM in FastReport .NET
Hi,

Can any one share C# code to create Fast Report - Matrix - Dynamically and bind it with Data.... Currently we can only work with pre-designed reports ...

Thanks.
devoas.

Comments

  • edited 3:41PM
    Currently we can only work with pre-designed reports ...
  • edited 3:41PM
    annaya wrote: »
    Currently we can only work with pre-designed reports ...


    In C# with FastReport assembly :

    //Column 1
    MatrixObject newMatrixObject = new MatrixObject();
    MatrixHeaderDescriptor HeaderDescriptionColumn =new MatrixHeaderDescriptor();
    HeaderDescriptionColumn.Expression = "ColumnTest"
    newMatrixObject.Data.Columns.Add(HeaderDescriptionColumn);


    //Row 1
    MatrixHeaderDescriptor HeaderDescriptionRow =new MatrixHeaderDescriptor();
    HeaderDescriptionRow.Expression = "rowTest
    newMatrixObject.Data.Rows.Add(HeaderDescriptionRow);

    //Cell
    MatrixCellDescriptor CellDescriptor = new MatrixCellDescriptor();
    CellDescriptor.Expression = "cellTest"
    newMatrixObject.Data.Cells.Add(CellDescriptor);

    // After call this
    newMatrixObject.BuildTemplate();

    // If you want, you add directly datasource
    // newMatrixObject.DataSource = (DataSourceBase)myOleDbDataConnection.FindObject(crossViewFr3.DataSetName);

    // Add Matrix object to DataBand
    ((FastReport.DataBand)myBand).AddChild(newMatrixObject);

Leave a Comment