Spread.Services provides users with the ability to cut or copy a cell or a range of cells from a specific area and paste it into another area within the same worksheet. To cut or copy data across multiple sheets, refer to Cut or Copy Across Sheets.
Spread.Services allows you to copy a cell or a range of cells in the worksheets by calling Copy method of IRange. To copy a single cell or a range of cells, specify the cell range to be copied, for example B3:D12.
Spread.Services provides the following different ways to use the Copy method.
Example | Description |
---|---|
Copy(sheet.Range["E5"]) | This method copies data from cell range B3:D12 and pastes the data to cell E5 onwards. |
Copy(sheet.Range["E5:G14"]) | This method copies data from cell range B3:D12 and pastes the data in cell range E5:G14. In case the range of cells copied does not fit into the destination cell range, the data is lost. |
Refer to the following example code to copy the cell range in a workbook.
C# |
Copy Code |
---|---|
// Copy the data of the range of cells worksheet.Range["B3:D12"].Copy(worksheet.Range["E5"]); //Or worksheet.Range["B3:D12"].Copy(worksheet.Range["E5:G14"]); |
Spread.Services allows you to cut a cell or range of cells in a worksheet by calling the Cut method of IRange. To cut the a cell or the range of cells, specify the cell range to be moved, for example B3:D12.
Spread.Services provide the following different ways to use Cut method.
Example | Description |
---|---|
Cut(sheet.Range["E5"]) | This method cuts the data from cell range B3:D12 and pastes the data to cell E5 onwards. |
Cut(sheet.Range["E5:G14"]) | This method cuts the data from cell range B3:D12 and pastes the data in cell range E5:G14. In case the range of cells cut does not fit into the destination cell range, the data is lost. |
Refer to the following example code to cut a range of cells in the workbook.
C# |
Copy Code |
---|---|
// Cut the data of the range of cell worksheet.Range["B3:D12"].Cut(worksheet.Range["E5"]); // Or worksheet.Range["B3:D12"].Cut(worksheet.Range["E5:G14"]); |