Spread for ASP.NET 12 Product Documentation
Adding a Row or Column
Spread for ASP.NET 12 Product Documentation > Developer's Guide > Customizing the Appearance > Customizing the Appearance of Rows and Columns > Adding a Row or Column

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

  1. Use the AddRows method or AddColumns method for the Sheets shortcut.
  2. Set the row or column parameter to specify the row or column before which to add the rows or columns.
  3. 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

  1. Use the AddRows method or AddColumns method for a SheetView object.
  2. Set the row or column parameter to specify the row or column before which to add the rows or columns.
  3. 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

  1. Select the Data menu.
  2. At the bottom, select the sheet for which you want to add rows or columns.
  3. Select an existing row or column (the new row or column is inserted before this row or column).
  4. Click the Insert icon and then select Insert Row or Insert Column.
  5. Click OK.
  6. Click Apply and Exit to close the Spread Designer.