Spread for ASP.NET 12 Product Documentation
Removing a Sheet
Spread for ASP.NET 12 Product Documentation > Developer's Guide > Customizing the Appearance > Customizing the Appearance of the Sheet > Removing a Sheet

You can remove a sheet or several sheets from the component. The sheet index is zero-based. In code, you can simply change the number of sheets using the Count property or you can explicitly remove the sheet(s) using the Remove method.

Removing an existing sheet does not change the default sheet names provided to the other sheets. For example, a component with three sheets would by default name them Sheet1, Sheet2, and Sheet3. If you remove the second sheet, the names for the remaining sheets are Sheet1 and Sheet3. The indexes for the sheets are 0 and 1, because the sheet index is zero-based. You can also hide a sheet. For more information, refer to Showing or Hiding a Sheet.

To remove an existing sheet, complete the following instructions.

For information on adding a sheet, refer to Adding a Sheet.

Using the Properties Window

  1. At design time, in the Properties window, select the Sheets property for the FpSpread component.
  2. Click the button to display the SheetView Collection Editor.
  3. In the Members list, select the sheet to remove.
  4. Click the Remove button to remove the sheet from the collection.
  5. Click OK to close the editor.

Using a Shortcut

Use the Remove method with the FpSpread component Sheets shortcut to remove the SheetView object from the collection of sheets (SheetViewCollection).

Example

This example code removes the second sheet from a component that has two or more sheets.

C#
Copy Code
// Remove the second sheet.
FpSpread1.Sheets.Remove(FpSpread1.Sheets[1]); 
VB
Copy Code
' Remove the second sheet.
FpSpread1.Sheets.Remove(FpSpread1.Sheets(1)) 

Using the Spread Designer

  1. Select the Data menu. Select the sheet you wish to delete (click on the sheet name at the bottom of the designer window).
  2. Select the Delete icon.
  3. Click Delete Sheet.
  4. The Spread Designer asks you if you are sure you want to remove the sheet. Click Yes to remove the sheet.
  5. Click Apply and Exit to close the Spread Designer.