Copy GridWeb Rows and Columns

Copying Rows & Columns

If you are not already acquainted with Aspose.Cells.GridWeb component, we strongly suggest that you check the Introduction to Aspose.Cells.GridWeb and the 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 the GridCells object of the active worksheet in order to copy the first row to the subsequent row.

Here is how the Aspose.Cells.GridWeb looks after the 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 the active worksheet in order to copy the first column to the subsequent column.

Here is how the Aspose.Cells.GridWeb looks after the 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 looks before & after the copy‑rows operation.

todo:image_alt_text

todo:image_alt_text

Copying Multiple Columns

The GridCells class also provides 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 looks before & after the copy‑columns operation.

todo:image_alt_text

todo:image_alt_text