Copy GridWeb Rows and Columns

Copying Rows & Columns

If you are not already acquainted with Aspose.Cells.GridWeb component, we strongly suggest you to check the Introduction to Aspose.Cells.GridWeb and detailed article on How to add Aspose.Cells.GridWeb component in a WebForms application.

Copying Single Row

In order to keep the example simple, the article uses an existing spreadsheet with one row and a simple formula that sums all the values in the row. Here is how the spreadsheet is displayed in the Aspose.Cells.GridWeb interface before copying the row.

todo:image_alt_text

The code snippet is simple as demonstrated below. It accesses GridCells object of active worksheet order to make a copy of the first row to the subsequent row.

Here is how the Aspose.Cells.GridWeb looks after copy row operation.

todo:image_alt_text

Copying Single Column

The following example uses an existing spreadsheet with one column and a simple formula that sums all the values in the column. Here is how the spreadsheet is displayed in the Aspose.Cells.GridWeb interface before copying the column.

todo:image_alt_text

Similar to the above example, the following code snippet accesses the GridCells object of active worksheet order to make a copy of the first column to the subsequent column.

Here is how the Aspose.Cells.GridWeb looks after copy column operation.

todo:image_alt_text

Copying Multiple Rows

It is also possible to copy multiple rows to a new destination while using the GridCells.CopyRows method, which takes an additional parameter of type integer to specify the number of source rows to be copied.

Here is how Aspose.Cells.GridWeb look before & after copy rows operation.

todo:image_alt_text

todo:image_alt_text

Copying Multiple Columns

The GridCells class also provide the CopyColumns method, which takes an additional parameter of type integer to specify the number of source columns to be copied.

Here is how Aspose.Cells.GridWeb look before & after copy rows operation.

todo:image_alt_text

todo:image_alt_text