Spread for ASP.NET 8.0 Product Documentation > Developer's Guide > Customizing the Appearance > Customizing the Appearance of the Sheet > 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.
A new sheet named Sheetn (where n is an integer) is added to the component.
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) |
A new sheet named Sheetn (where n is an integer) is added to the component.