How to Expand cell height according to Text !

Posted by: kamlesh on 8 September 2017, 1:58 pm EST

  • Posted 8 September 2017, 1:58 pm EST

    Hi ,

        My cell text length is let suppose 200 and cell width contains 30 characters.

        My requirement is while typing 31st character the cell height should automatically increased.

     if i type 61 st character its height should again  increased.

    I had tried with  cell.<FONT size=2>

    .WordWrap = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>;Multiline = true.</FONT>

    I had tried in KeyUp Event.It is not working in keypress and keyup event




    <FONT size=2> 



  • Replied 8 September 2017, 1:58 pm EST

    Hello Kamlesh,

    Once setting .WordWrap =true , .<FONT size=2>Multiline = true using  .<FONT size=2>GetPreferredHeight()  you should be able to adjust the text in cell to the maximum height.</FONT></FONT>



    Thanks,<FONT size=2><FONT size=2>

  • Replied 8 September 2017, 1:58 pm EST


    There is not a way to do this while you are editing in the cell. The Keyxxx events are not firing because the keystrokes are being caught by the editor control in the cell and not by the Spread control. You can get the key events of the editor by getting the control (FpSpread1.EditingControl) which is a FarPoint.Win.Spread.CellType.GeneralEditor control and then catch that controls KeyUp event. To increase the height, you would need to use code like Suresh, but first set the Spread out of editmode (EditMode = False) and then putting it back into editmode after increasing the height.

Need extra support?

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

Learn More

Forum Channels