Spread Windows Forms 8.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. The hidden rows or columns are not displayed at run time, but during design time, they are still visible.
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.
Use the SetColumnVisible or SetRowVisible method for the sheet.
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 |