You can add one or more rows or columns to a sheet, and specify where the row or column is added. You can use the methods in the SheetView class or the methods in the DefaultSheetDataModel class.
For adding an unbound row to a sheet in a component that is bound to a data source, refer to Adding an Unbound Row.
Using a Shortcut
- Use the AddRows method or AddColumns method for the Sheets shortcut.
- Set the row or column parameter to specify the row or column before which to add the rows or columns.
- Set the count parameter to specify the number of rows or columns to add.
Example
This example code adds two columns before column 6.
C# | Copy Code |
---|---|
FpSpread1.Sheets[0].AddColumns(6,2); |
VB | Copy Code |
---|---|
FpSpread1.Sheets(0).AddColumns(6,2) |
Using Code
- Use the AddRows method or AddColumns method for a SheetView object.
- Set the row or column parameter to specify the row or column before which to add the rows or columns.
- Set the count parameter to specify the number of rows or columns to add.
Example
This example code adds two columns before column 6.
C# | Copy Code |
---|---|
FarPoint.Web.Spread.SheetView Sheet0; Sheet0 = FpSpread1.Sheets[0]; Sheet0.AddColumns(6,2); |
VB | Copy Code |
---|---|
Dim Sheet0 As FarPoint.Web.Spread.SheetView Sheet0 = FpSpread1.Sheets(0) Sheet0.AddColumns(6, 2) |
Using the Spread Designer
- Select the Data menu.
- At the bottom, select the sheet for which you want to add rows or columns.
- Select an existing row or column (the new row or column is inserted before this row or column).
- Click the Insert icon and then select Insert Row or Insert Column.
- Click OK.
- Click Apply and Exit to close the Spread Designer.