Back to Devexpress

How to: Show or Hide a Row or Column

wpf-16328-controls-and-libraries-spreadsheet-examples-rows-and-columns-how-to-show-or-hide-a-row-or-column.md

latest1.4 KB
Original Source

How to: Show or Hide a Row or Column

  • Jun 07, 2019

This example demonstrates how to control the visibility of rows and columns in a worksheet using the Row.Visible and Column.Visible properties.

Note

You can also hide a row or column in a worksheet by setting the row height (Row.Height) or column width (Column.Width, Column.WidthInCharacters or Column.WidthInPixels) to 0, respectively.

View Example

csharp
Worksheet worksheet = workbook.Worksheets[0];

// Hide the 8th row of the worksheet.
worksheet.Rows[7].Visible = false;

// Hide the 4th column of the worksheet.
worksheet.Columns[3].Visible = false;
vb
Dim worksheet As Worksheet = workbook.Worksheets(0)

' Hide the 8th row of the worksheet.
worksheet.Rows(7).Visible = False

' Hide the 4th column of the worksheet.
worksheet.Columns(3).Visible = False