[]
        
(Showing Draft Content)

Hide Rows and Columns

You can choose whether to hide or show rows and columns in a worksheet by using the Hidden property of the IRange interface.

Refer to the following example code in order to hide specific rows and columns in a worksheet.

worksheet.Range["E1"].Value = 1;

//Hide row 2:6 using the Hidden property

worksheet.Range["2:6"].Hidden = true;

//Hide column A:D using the Hidden property
worksheet.Range["A:D"].Hidden = true;

Note: The range must either be entire rows or entire columns. The Hidden property doesn't work on a range of cells.