Spread Windows Forms 17
Spread Windows Forms 17.0 Product Documentation / Developer's Guide / Rows and Columns / Showing or Hiding a Row or Column
In This Topic
    Showing or Hiding a Row or Column
    In This Topic

    You can choose to show or hide rows and columns in a sheet by following one of the methods below:

    You can also hide row headers and column headers. For more information, refer to Showing or Hiding Headers.

    The following code sample demonstrates the use of SheetView methods as well as Rows and Columns properties to hide the first row and the second column.

    C#
    Copy Code
    //Using SheetView methods to set visibility
    fpSpread1.Sheets[0].SetColumnVisible(1,false);
    fpSpread1.Sheets[0].SetRowVisible(0,false);
    //Another option - use the Visible property.
    fpSpread1.Sheets[0].Columns[1].Visible = false;
    fpSpread1.Sheets[0].Rows[0].Visible = false;
    //Another option - set row height or column width to zero.
    GrapeCity.Spreadsheet.IWorksheet sheet1 = fpSpread1.AsWorkbook().ActiveSheet
    sheet1.Columns[1].ColumnWidth = 0;
    sheet1.Rows[0].RowHeight = 0;
    
    VB
    Copy Code
    'Using SheetView methods to set visibility
    fpSpread1.Sheets(0).SetColumnVisible(1, False)
    fpSpread1.Sheets(0).SetRowVisible(0, False)
    'Another option - use the Visible property.
    fpSpread1.Sheets(0).Columns(1).Visible = False
    fpSpread1.Sheets(0).Rows(0).Visible = False
    'Another option - set row height or column width to zero.
    GrapeCity.Spreadsheet.IWorksheet sheet1 = fpSpread1.AsWorkbook().ActiveSheet
    sheet1.Columns(1).ColumnWidth = 0
    sheet1.Rows(0).RowHeight = 0
    
    Note: To know more about showing or hiding rows and columns by setting row height and column width, refer to Setting the Row Height or Column Width.

    By default, the width and height of hidden columns and rows are displayed by about 1 pixel when set to hidden. To eliminate this display, you need to set ResizeZeroIndicator to Default.

    When you hide a row or column, the size of the row or column is remembered by the Spread component. If you re-display the row or column, it is displayed at the size it was before it was hidden.

    Conversely, you can also prevent the user to re-display the hidden rows or columns by setting the Row.Resizable or Column.Resizable properties to false.

    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 FpSpread class methods. For more information refer to Customizing Viewports.

    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 on a row or column to select it and then select an option from the drop-down combo list for the Visible property.

    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.
    See Also