Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Use the Excel Export API 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).

View Example: Excel Export API

// 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