Creating Matrix Dynamically & Programatically

edited 10:36AM 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 10:36AM
    Currently we can only work with pre-designed reports ...
  • edited 10:36AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.