Cell Width

Posted by: himaheshh on 8 September 2017, 1:48 pm EST

  • Posted 8 September 2017, 1:48 pm EST

    Hi,


    Is it possible to programatically determine the Width of a cell when the user changes the default width?


    Thank you!


     Regards

  • Replied 8 September 2017, 1:48 pm EST

    Hello Mahesh,

    You may try using the GetPreferredCellSize to get the desired size of the given cell on this sheet.The below snippet will return the width of the Cell(0,0):

    Dim sz As System.Drawing.Size
    FpSpread1.ActiveSheet.SetValue(0, 0, "Expand the cell to fit the text.")
    sz = FpSpread1.ActiveSheet.GetPreferredCellSize(0, 0)
    FpSpread1.ActiveSheet.Columns(0).Width = sz.Width

    MessageBox.Show("The width of the editor is " & sz.Width.ToString())

    Hope this helps. Thanks

  • Replied 8 September 2017, 1:48 pm EST

    You can use the ColumnWidthChanging event and query the Width parameter within that event.
Need extra support?

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

Learn More

Forum Channels