Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Whether creating a new worksheet from scratch or working on an existing worksheet, we may need to add extra rows or columns to accommodate more data. Inversely, we may also need to delete rows or columns from specified positions in the worksheet.
To fulfill these requirements, Aspose.Cells provides a very simplest set of classes and methods, discussed below.
Aspose.Cells provides a Workbook class that represents a Microsoft Excel file. The Workbook class contains a WorksheetCollection that allows access to each worksheet in an Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a Cells collection that represents all cells in the worksheet.
The Cells collection provides several methods for managing rows and columns in a worksheet. Some of these are discussed below.
Insert a row into at any location by calling the insertRows method of the Cells collection. The insertRows method takes the index of the row where the new row will be inserted as the first argument, and the number of rows to be inserted as the second argument.
To insert multiple rows into the worksheet, call the insertRows method of the Cells collection. The insertRows method takes two parameters:
To insert a row with formatting options, use the insertRows overload that takes InsertOptions as a parameter. Set the CopyFormatType property of InsertOptions class with CopyFormatType Enumeration. The CopyFormatType Enumeration has three members as listed below.
To delete a row at any location, call the deleteRows method of the Cells collection. The deleteRows method takes two parameters:
To delete multiple rows from a worksheet, call the deleteRows method of the Cells collection. The deleteRows method takes two parameters:
Developers can also insert a column into the worksheet at any location by calling the insertColumns method of the Cells collection. The insertColumns method takes two parameters:
To delete a column from the worksheet at any location, call the deleteColumns method of the Cells collection. The deleteColumns method takes the following parameters:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.