You can remove one or more columns or rows from a sheet. You can use the methods in the SheetView class or the methods in the DefaultSheetDataModel class.
For more details refer to the SheetView.RemoveRows method or SheetView.RemoveColumns method.
If you simply want to hide the row or column from the end user, but not remove it from the sheet, refer to Showing or Hiding a Row or Column.
Return to Working with the Rows and Columns.
Using a Shortcut
- Call the RemoveRows or RemoveColumns method for the Sheets shortcut object.
- Set the row or column parameter to specify the row or column before which to remove the rows or columns.
- Set the count parameter to specify the number of rows or columns to remove.
Example
This example code removes two columns before column 6.
C# | Copy Code |
---|---|
fpSpread1.Sheets[0].RemoveColumns(6,2); |
VB | Copy Code |
---|---|
FpSpread1.Sheets(0).RemoveColumns(6,2) |
Using Code
- Call the RemoveRows or RemoveColumns method for a SheetView object.
- Set the row or column parameter to specify the row or column before which to remove the rows or columns.
- Set the count parameter to specify the number of rows or columns to remove.
Example
This example code removes two columns before column 6.
C# | Copy Code |
---|---|
FarPoint.Win.Spread.SheetView Sheet0; Sheet0 = fpSpread1.Sheets[0]; Sheet0.RemoveColumns(6,2); |
VB | Copy Code |
---|---|
Dim Sheet0 As FarPoint.Win.Spread.SheetView Sheet0 = FpSpread1.Sheets(0) Sheet0.RemoveColumns(6, 2) |
Using the Spread Designer
- Select the sheet tab for the sheet for which you want to remove a row or column.
- Select the row(s) or column(s) to remove by selecting the header(s).
- Right-click on the row or column and choose Delete.
- From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.