Skip to main content
A newer version of this page is available. .

How to: Hide a Row or Column

The example below demonstrates how to control the visibility of rows and columns in a worksheet using the IXlRow.IsHidden and IXlColumn.IsHidden properties.

Note

You can also hide a row or column in a worksheet by setting the row height (IXlRow.HeightInPixels) or column width (IXlColumn.WidthInCharacters or IXlColumn.WidthInPixels) to 0, respectively (see the How to: Specify Row Height and Column Width document).

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T253492.


// Create a new worksheet.
using (IXlSheet sheet = document.CreateSheet()) 
{
    // Hide the column B in the worksheet.
    using (IXlColumn column = sheet.CreateColumn(1))
    {
        column.IsHidden = true;
    }

    // Hide the third row in the worksheet.
    using (IXlRow row = sheet.CreateRow(2))
    {
        row.IsHidden = true;
    }
}
See Also