Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V26.2
  • Hide and Display Rows and Columns

    Use Row.Visible and Column.Visible properties to hide or display rows and columns.

    The following code snippet hides row 5 and column 3:

    Worksheet worksheet = workbook.Worksheets[0];
    
    worksheet.Rows[5].Visible = false;
    worksheet.Columns[3].Visible = false;
    

    Use RowRange.Visible and ColumnRange.Visible properties to hide or display multiple adjacent rows or columns. The following code snippet hides rows 10:20 and columns D:F:

    var worksheet = workbook.Worksheets[0];
    
    worksheet.Rows.GetRange("10:20").Visible = false;
    worksheet.Columns.GetRange("D:F").Visible = false;
    

    You can also hide a row or column by setting its Height or Width property to 0. Set the property to a positive value to display the row or column.

    Note

    The Row.Height property accepts values from 0 to 1706.25 document units (409.5 points).

    The Column.Width property cannot be negative.

    See Also