Resize only 'used' columns

2 posts, 0 answers
  1. Evelyn
    Evelyn avatar
    18 posts
    Member since:
    Mar 2015

    Posted 10 Feb 2016 Link to this post

    I am using the RadSpreadsheet component and I am filling it with data from code behind. I would like to resize only the 'used' columns to a width that fits the content from each column. Something like the AutoFitWidth(). 

    I tried to use this method (AutoFitWidth()) in a ColumnSelection, however I could only use in all columns, not just the ones I used and I took more than 2 minutes to open my window... I don't want this... As I fill my spreadsheet from code behind, I don't know how many columns I am using... It depends on the settings the user chose before the window opens...

    Is there any solution for this?
  2. Deyan
    Deyan avatar
    158 posts

    Posted 15 Feb 2016 Link to this post

    Hello Evelyn,

    Thank you for contacting us.

    You may use the UsedCellRange property in order to select only the columns in the used range. The following code snippet shows how to autofit the columns in the used range of some Worksheet instance:

    I hope this is helpful. If you have any other questions or concerns please do not hesitate to contact us again.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top