TXlsFile.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
Unit: FlexCel.XlsAdapter
procedure TXlsFile.InsertAndCopyRange(const sourceRange: TXlsCellRange; const destRow: Integer; const destCol: Integer; const destCount: Integer; const insertMode: TFlxInsertMode; const copyMode: TRangeCopyMode; const sourceWorkbook: TExcelFile; const sourceSheet: Integer; const ObjectsInRange: TExcelObjectList); overload; override;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | 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. |
const | destRow | Integer | Destination row where the cells will be copied. |
const | destCol | Integer | Destination column where the cells will be copied. |
const | destCount | Integer | 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) |
const | 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. |
const | 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. |
const | sourceWorkbook | TExcelFile | Workbook from where we are copying the cells. This might be the same workbook, and you would by copying from another sheet. |
const | sourceSheet | Integer | 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. |
const | 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 |