Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IRange Interface > CopyTo Method : CopyTo(IRange,ExcelCopyRangeOptions) Method
Represents the destination Range to copy.
Represents the copy Range options.

CopyTo(IRange,ExcelCopyRangeOptions) Method

Copies the Range to the specified destination Range with copy options.
Syntax
'Declaration
 
Overloads Function CopyTo( _
   ByVal destination As IRange, _
   ByVal options As ExcelCopyRangeOptions _
) As IRange
'Usage
 
Dim instance As IRange
Dim destination As IRange
Dim options As ExcelCopyRangeOptions
Dim value As IRange
 
value = instance.CopyTo(destination, options)

Parameters

destination
Represents the destination Range to copy.
options
Represents the copy Range options.

Return Value

Returns the copied Range.
Example
The following code illustrates how to copy the Range with copy options.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet sheet = workbook.Worksheets[0];
            
// Copying a Range �A1� to �A5�.
IRange source = sheet.Range["A1"];
IRange destination = sheet.Range["A5"];
source.CopyTo(destination, ExcelCopyRangeOptions.All);
workbook.Version = ExcelVersion.Excel2013;
workbook.SaveAs("CopyRange.xlsx");
workbook.Close();
excelEngine.Dispose();
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also