Spread Windows Forms 12.0 Product Documentation
Showing or Hiding a Row or Column
Spread Windows Forms 12.0 Product Documentation > Developer's Guide > Understanding the Spreadsheet Objects > Working with Rows and Columns > Showing or Hiding a Row or Column

By default, rows and columns are visible on a sheet. You can hide rows or columns in a sheet so that they are not displayed. You can also hide row headers and column headers. You hide a row or column by setting the Row.Visible property or Column.Visible property to false.

When you hide a row or column, the size of the row or column is remembered by the Spread component. If you redisplay the row or column, it is displayed at the size it was before it was hidden. For example, if the width of a column is 100 pixels and you hide the column, when you redisplay it, the width is 100.

If you want to determine if a row or column is presently visible to the user, that is, whether it appears in the viewport that is currently being displayed, you can use the methods of the sheet. For example, to find out if a column appears, use the GetViewportLeftColumn and GetViewportRightColumn methods to determine the left-most and right-most columns in the viewport and then determine if the column falls within those indexes.

For information on hiding rows or columns in headers, refer to Showing or Hiding Headers.

For more information on hiding rows or columns using the Spread Designer, refer to the Spread Designer Guide.

Using the Properties Window

  1. At design time, in the Properties window, select the Spread component.
  2. Select the Sheet collection.
  3. Select the Row or Column collection.
  4. Click or a row or column to select it and then select an option from the drop-down combo list for the Visible property.

Using Code

Use the SetColumnVisible or SetRowVisible method for the sheet.

Example

C#
Copy Code
fpSpread1.Sheets[0].SetColumnVisible(0,true);
fpSpread1.Sheets[0].SetRowVisible(0,false);
//Another option is to use the Visible property.
fpSpread1.Sheets[0].Columns[1].Visible = false;
fpSpread1.Sheets[0].Rows[1].Visible = true;
VB
Copy Code
fpSpread1.Sheets(0).SetColumnVisible(0, False)
fpSpread1.Sheets(0).SetRowVisible(0, True)
'Another option is to use the Visible property.
fpSpread1.Sheets(0).Columns(1).Visible = True
fpSpread1.Sheets(0).Rows(1).Visible = False

Using the Spread Designer

  1. Select the row or column by clicking on the header.
  2. Select an option from the Visible drop-down combo list.
  3. From the File menu, select Save and Exit to save the changes.