Spread for ASP.NET 9.0 Product Documentation
Adding a Sheet

You can add a sheet or add several sheets to the component. By default, the component has one sheet, named Sheet 1 and referenced as sheet index 0. The sheet index is zero-based. If you are using custom sheet names be sure to specify the name of the sheet.

In code, you can simply change the number of sheets by changing the Count property or you can explicitly add the sheet(s) by defining new sheets or by using the Add method. The following instructions describe how to add a sheet.

For information on removing a sheet, refer to Removing 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. Click the Add button to add a sheet to the collection.

    A new sheet named Sheetn (where n is an integer) is added to the component.

  4. If you want to change the name of the new sheet, click the SheetName property in the property list, and then type the new name for the sheet.
  5. Click OK to close the editor.

Using Code

  1. Create a new SheetView object.
  2. If you want to do so, set properties for the sheet, such as its name.
  3. Use the Add method with the FpSpread component Sheets shortcut to add the new SheetView object to the collection of sheets (SheetViewCollection) for the component.

Example

This example code adds a new sheet to the component, then names the sheet "North" and sets it to have 10 columns and 100 rows.

C#
Copy Code
// Create a new sheet.
FarPoint.Web.Spread.SheetView newsheet = new FarPoint.Web.Spread.SheetView();
newsheet.SheetName = "North";
newsheet.ColumnCount = 10;
newsheet.RowCount = 100;

// Add the new sheet to the component.
FpSpread1.Sheets.Add(newsheet);
VB
Copy Code
' Create a new sheet.
Dim newsheet As New FarPoint.Web.Spread.SheetView()
newsheet.SheetName = "North"
newsheet.ColumnCount = 10
newsheet.RowCount = 100
' Add the new sheet to the component.
FpSpread1.Sheets.Add(newsheet)

Using the Spread Designer

  1. Select the Data menu. Click on the Insert icon.
  2. Click the Insert Sheet option.

    A new sheet named Sheetn (where n is an integer) is added to the component.

  3. If you want to change the name of the new sheet, click the new sheet in the Properties for Sheetn list, and change the SheetName property in the property list.
  4. Click Apply and Exit to close the Spread Designer.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback