Wrap String in MatrixCellDescriptor

Dear Board,

I need to wrap long text in MatrixCellDescriptor into two or more lines. I enabled already the WordWrap true property:

tableCell = (FastReport.Table.TableCell)matrix.Rows[j][i];

tableCell.WordWrap = true;

tableCell.Wysiwyg = true;


But text is cropped after the defined cell width.

I already tried to use "Environment.Newline" or "\n" in the string, but nothing worked for me.

So please I need some hint to get the long string wrapped to two or more lines.


Thank you!

Sophie

Comments

  • Ok Guys,

    you can use Environment.NewLine for force the linebreak, but you need to adjust the height of the rows:

               foreach (TableRow row in matrix.Rows)

               {

                   row.AutoSize = true; // or the different height properties as you like or need

               }

  • Hello!

    To ensure that line breaks within MatrixObject headers/cells (where WordWrap = true) increase the row height, and the text is not truncated to the original height of the template cell, you need to enable automatic row sizing for the matrix:

    Set cell.WordWrap = true on the cell.

    On the matrix template row (matrix.Rows[j]), set AutoSize = true:

    matrix.Rows[j].AutoSize = true;
    var cell = matrix.Rows[j][i];
    cell.WordWrap = true;
    cell.CanGrow = true;
    

    Without setting `AutoSize = true` on the matrix row itself, the cell will wrap text, but the row height in the table remains fixed and the row will be truncated.

This discussion has been closed.