Spread Windows Forms 14.0
Spread Windows Forms 14.0 Product Documentation / Developer's Guide / Rows and Columns / Setting the Row Height or Column Width / Using Auto Row Height
In This Topic
    Using Auto Row Height
    In This Topic

    Spread for WinForms supports automatic adjustment of row height based on the data present in the row.

    The auto row height feature works only when the following conditions are met:

    When the auto row height feature is disabled, the cell containing text with larger font size will appear clipped as shown in the example screenshot shared below.

    Spreadsheet with auto row height feature disabled

    When the auto row height feature is enabled, the row will automatically adjust its height in accordance to the font size of the text as shown in the example screenshot shared below.

    Spreadsheet with auto row height feature enabled

    Users can enable the auto row height feature in the workbook in order to allow the Spread component to automatically calculate row height. The row height will be calculated automatically whenever the cut, copy, paste, move, drag drop or drag fill operations are executed on the spreadsheet, the value of a cell is changed directly or when the edit mode of the cell is exited.

    In order to enable the auto row height feature, refer to the following code.

    C#
    Copy Code
    // Enable all new behaviors by default including auto row height
    fpSpread1 = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None);
    
    // Enable the AutoRowHeight feature only
    fpSpread1 = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.All & ~FarPoint.Win.Spread.LegacyBehaviors.AutoRowHeight);
    

    VB
    Copy Code
    'Enable all new behaviors by default including auto row height  
     fpSpread1 = New FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None)
    
    'Enable the Auto Row Height feature only
    fpSpread1 = New FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.All & ~FarPoint.Win.Spread.LegacyBehaviors.AutoRowHeight)
    

    In order to disable the auto row height feature, users need to set the LegacyBehaviors property to AutoRowHeight as shown in the code snippet shared below.

    C#
    Copy Code
    // Disable all new behaviors by default including auto row height.
    fpSpread1 = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.All);
    
    // Disable the Auto Row Height feature
    fpSpread1 = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None | FarPoint.Win.Spread.LegacyBehaviors.AutoRowHeight);
    

    VB
    Copy Code
    'Disable all new behaviors by default including auto row height.
    fpSpread1 = New FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.All)
    
    'Disable the Auto Row Height feature
    fpSpread1 = New FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None | FarPoint.Win.Spread.LegacyBehaviors.AutoRowHeight)
    
    See Also