Word wrap in cells

Posted by: john-shugart on 8 September 2017, 2:26 pm EST

  • Posted 8 September 2017, 2:26 pm EST

    I'm using Spread for windows, 2.5.2009.2005, and I want to be able to wrap my words in a cell, to have a cr/lf, how can I accomplish this task?


    Thanks in advance,


    John

  • Replied 8 September 2017, 2:26 pm EST

    maybe you can use System.Environment.NewLine  ?

    http://www.clubfarpoint.com/Forums/forums/thread/91728.aspx

      

  • Replied 8 September 2017, 2:26 pm EST

    That doesn't work in cells, but the text will wrap in a columnheader. What would the solution be?
  • Replied 8 September 2017, 2:26 pm EST

    Hello John,

    You can use the TextCellType with WordWrap and Multiline property set to true in order to wrap text in Spread cells along with setting the height of the Row using GetPreferredHeight method.

    Here is the code to achieve the same:-

                FarPoint.Win.Spread.CellType.TextCellType txt = new FarPoint.Win.Spread.CellType.TextCellType();

                txt.WordWrap = true;

                txt.Multiline = true;

                fpSpread1.ActiveSheet.Columns[0].CellType = txt;

                fpSpread1.ActiveSheet.Cells[0, 0].Text = "Longggggggggg texttt withhh neww lineeees..";

                fpSpread1.ActiveSheet.Rows[fpSpread1.ActiveSheet.ActiveRowIndex].Height = fpSpread1.ActiveSheet.Rows[fpSpread1.ActiveSheet.ActiveRowIndex].GetPreferredHeight();

    Hope this will help you. Thanks.

Need extra support?

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

Learn More

Forum Channels