Problem with increasing row height with text wrapping

Posted by: banshpatel on 8 September 2017, 3:03 pm EST

  • Posted 8 September 2017, 3:03 pm EST

    Hi All,

    Row height of a spread rows is not working according to longest text of the row. Below is the code snippet I am using.


    FarPoint.Win.Spread.CellType.TextCellType g = new FarPoint.Win.Spread.CellType.TextCellType();
    g.WordWrap = true;
    g.Multiline = true;
    this.fpSpread.ActiveSheet.Columns[10].CellType = g;

    My requirement is to increase row height with text wrapping for the rows having long text. Since I have large amount of data to display, so setting actual row height for each row is not feasible for me.

    Note: Due to client requirement I have fixed the column width. Please view the attached screenshot for better understanding of my problem.

    Please help me to resolve this problem. I am working with FarPoint4.0 windows c#



  • Replied 8 September 2017, 3:03 pm EST

    Hello,

    I would like you to know that setting the Multiline and WordWrap properties to true, would surely display the data in multiple lines by wrapping the same depending on the column width but it would not automatically increase the row height to show the entire data. So, once you are done with the editing you would need to explicitly set the row height to display all the wrapped text. You can use the GetPreferredRowHeight method to get the expected height of the row, as this method returns the row height depending on the tallest text in the row cells. You can call this method in the EditModeOff event which is raised as soon as the user stops editing and set the row height to appropriate height with following line of code:

                     fpSpread1.Sheets[0].Rows[0].Height = fpSpread1.Sheets[0].GetPreferredRowHeight(0);

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels