How to Increase Row Number column Width...................

Posted by: ankur-jain on 8 September 2017, 2:59 pm EST

  • Posted 8 September 2017, 2:59 pm EST

    In my spread sheet Row number upto 999 Row number column is ok but the row number digit in 4 digit like (1000) so sheet show this number in  separate way (100 in one line and 0 in different line).

    so i want to re-size  or customize  (Increase) Row number column width. so 4 or more than 4 digit come in one line.........

    Thanks in advance 

  • Replied 8 September 2017, 2:59 pm EST

    Hello,

    You would need to set the WordWrap property of the RowHeader to false, so that it does not displays the labels in two lines and later set the width of the column in the RowHeader using the GetPreferredWidth method. This method returns the width i.e. necessary to accomodate the label in the RowHeader. Here is the code for the same:

    private void button1_Click(object sender, EventArgs e)
    {
       FarPoint.Win.Spread.CellType.EnhancedRowHeaderRenderer rhr = new FarPoint.Win.Spread.CellType.EnhancedRowHeaderRenderer();
       rhr.WordWrap = false;
       fpSpread1.Sheets[0].RowHeader.DefaultStyle.Renderer = rhr;
       fpSpread1.Sheets[0].RowHeader.Columns[0].Width = fpSpread1.Sheets[0].RowHeader.Columns[0].GetPreferredWidth();
    }

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur

  • Replied 8 September 2017, 2:59 pm EST

    Hello,

    you just use for loop which is starts from your usage(its maybe 1000 or 10000)

  • Replied 8 September 2017, 2:59 pm EST

    Hello,

    You need not use any loops as the code suggested above would work for any number of digits in row header.

    Thanks,

    Manpreet Kaur

Need extra support?

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

Learn More

Forum Channels