Change Font Size on Runtime build Matrix Cells

edited July 2017 in FastReport .NET
Hi There;

In order to change the font size in matrix component;

I just drop an empty matrix in report band;

As I never know whose rows will be selected to report , I set this "page_start" method;

newTableCell is my best try, but it changes cells matrix style blue to no formatted and withe background cell;

Is there any other best pratice, to change font and format into cells that have no design time configured matrix ?




private void Page_StartPage(object sender, EventArgs e)
    {
      
        System.Drawing.Font newFont =   new System.Drawing.Font( "Arial" , 8) ;

        TableCell newTableCell = new FastReport.Table.TableCell();
   
        newTableCell.Font = newFont;

        MatrixObject newMatrixObject =  (MatrixObject)Report.FindObject("Matrix1");     // just a droped empty matrix


        HeaderDescriptionRow =new MatrixHeaderDescriptor();
        HeaderDescriptionRow.Expression = "[QryPrincipal.NOME_NV01]";
        HeaderDescriptionRow.TemplateCell = newTableCell;

      .........

        HeaderDescriptionRow =new MatrixHeaderDescriptor();
        HeaderDescriptionRow.Expression = "[QryPrincipal.NOME_NV02]";

 
   ........

    
           newMatrixObject.BuildTemplate();

.....

Leave a Comment