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.


    .WordWrap = true;Multiline = true.


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


     


    regards


    kamlesh


     


     

  • Replied 8 September 2017, 1:58 pm EST

    Hello Kamlesh,


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


     


     


    Thanks,

  • Replied 8 September 2017, 1:58 pm EST

    kamlesh,


    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