XlsFile.InsertAndCopyRange Method
Inserts and/or copies a range of cells from one place to another.
This method is one of the most important on FlexCel API, and it allows you to copy ranges of cells from one place to another, adapting the formulas, images and everything as Excel would do it.
Remarks
This overload is useful for copying from another file. It is not as fast or complete as the other overloaded versions because it has to do a lot of transforms on the data. But it is very useful anyway.
Syntax
Namespace: FlexCel.XlsAdapter
public override void InsertAndCopyRange(TXlsCellRange sourceRange, Int32 destRow, Int32 destCol, Int32 destCount, TFlxInsertMode insertMode, TRangeCopyMode copyMode, ExcelFile sourceWorkbook, Int32 sourceSheet, TExcelObjectList ObjectsInRange)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
sourceRange | TXlsCellRange | The range of cells you want to copy. If you specify full rows, they will be copied with Row format information and size. If you copy just a part of a row, Row format will not be copied. The same applies to columns. The only way to copy all row and columns, is to specify the full (A:IV) range. |
|
destRow | Int32 | Destination row where the cells will be copied. | |
destCol | Int32 | Destination column where the cells will be copied. | |
destCount | Int32 | Number of times the sourceRange will be copied at (desRow, destCol). If you make for example destCount=2, sourceRange will be copied 2 times at (destRow, destCol) |
|
insertMode | TFlxInsertMode | How the cells on destination will be inserted. They can shift down or left. Specifying Row or Col as mode is equivalent to specify a sourceRange including full rows or columns respectively. |
|
copyMode | TRangeCopyMode | Which cells on sourceRange will be copied. If you intend to replace values on the copied cells, you might specify OnlyFormulas. If you just want to insert cells and not copy, specify None. | |
sourceWorkbook | ExcelFile | Workbook from where we are copying the cells. This might be the same workbook, and you would by copying from another sheet. | |
sourceSheet | Int32 | Sheet index on the source workbook. If sourceWorkbook is the same instance as this, and sourceSheet is the active sheet on the instance, this method is equivalent to the simpler overloaded version. | |
ObjectsInRange | TExcelObjectList | Returns the objects that are in the range to be copied. This is an optimization so you don't have to find those objects again. Set it to null to not return any objects |