Spread Windows Forms 8.0 Product Documentation
Adding a Sheet

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

The user is allowed to add new sheets by default. They can do this by clicking on the new sheet icon on the tab strip next to the sheet name (provided the tab strip is visible). If the sheet count is greater than 1, the tab strip is displayed by default. You can change this by setting the TabStripPolicy property. You can prevent the user from adding new sheets by setting the TabStripInsertTab property to false (FpSpread1.TabStripInsertTab = False).

To add a sheet to the component, complete the following instructions.

For more information on how the sheet names appear in the sheet tabs, and how to customize the sheet tabs, refer to Customizing the Sheet Name Tabs of the Component.

Using the Properties Window

  1. At design time, in the Properties window, select the Spread component.
  2. Select the Sheets property.
  3. Click the button to display the SheetView Collection Editor.
  4. Click the Add button to add a sheet to the collection.

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

  5. 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.
  6. Click OK to close the editor.

Using a Shortcut

  1. Create a new SheetView object.
  2. If you want to do so, set properties for the sheet, such as its name.
  3. Call the Sheets shortcut object Add method to add the new sheet to the 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.Win.Spread.SheetView newsheet = new FarPoint.Win.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.Win.Spread.SheetView()
newsheet.SheetName = "North"
newsheet.ColumnCount = 10
newsheet.RowCount = 100
' Add the new sheet to the component.
FpSpread1.Sheets.Add(newsheet)

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback