AutoFit Row Height

Posted by: srvjith on 8 September 2017, 12:27 pm EST

  • Posted 8 September 2017, 12:27 pm EST


    I want to set the height of Row like MS Excel does - AutoFit Row Height.

    The height of the row should change according to the contents of Row on Double clicking the border of row header. 

    How does FarPoint support this?




  • Replied 8 September 2017, 12:27 pm EST

    We support this for columns but at this time not for rows.  You can double-click in a row header and use the CellDoubleClick event and check to see if you are clicking in the header and if so use the
    GetPrefferedRowHeight method to set the height for the row.
  • Replied 8 September 2017, 12:27 pm EST

    Sar -

    There is no event that will return when you click on the border.
  • Replied 8 September 2017, 12:27 pm EST

    I also have a requirement, where I need to show the width of column or height of row, while the user is expanding the column width or row heigh on the sheet.

    Do you expose any events to track the width or height increasing?


    If not is it possible to add this as a future capability?


  • Replied 8 September 2017, 12:27 pm EST

    There is the ColumnWidthChanged and RowHeightChanged events but they only fire when the resizing is finished.
  • Replied 8 September 2017, 12:27 pm EST

    I have used those events and they have been usefull.  But I also want events while the width or height is changing.  Can this be provided in the future version?

  • Replied 8 September 2017, 12:27 pm EST

    Hi Sar,

    Code example of how to do this: <pre class="coloredcode"> <span class="kwd">Private Sub</span> FpSpread1_CellDoubleClick(<span class="kwd">ByVal</span> sender <span class="kwd">As Object</span>, <span class="kwd">ByVal</span> e <span class="kwd">As</span> FarPoint.Win.Spread.CellClickEventArgs) <span class="kwd">Handles</span> FpSpread1.CellDoubleClick
    <span class="kwd">If</span> e.RowHeader = <span class="kwd">True Then
    Dim</span> size <span class="kwd">As Single</span>
    size = FpSpread1.Sheets(0).Rows(e.Row).GetPreferredHeight()
    FpSpread1.Sheets(0).Rows(e.Row).Height = size
    <span class="kwd">End If
    End Sub</span></pre> 
  • Replied 8 September 2017, 12:27 pm EST

    Yes. This works.  But what I have to do is to click on the border (where the cursor changes to to Cross) and not in the cell.  When I double click at the Border, I am not getting any event.


    I want to achieve the same functioanlity as with column sizing.   Which event should I subscribe to listen to changes on the border of header cells?


  • Replied 8 September 2017, 12:27 pm EST

    I will add these as enhancements for a future version.
Need extra support?

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

Learn More

Forum Channels