Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

WorksheetCopyOptions.PasteOptions Property

Specifies the part of data to paste from the copied worksheet into the target worksheet.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v20.2.Core.dll

Declaration

public PasteSpecial PasteOptions { get; set; }

Property Value

Type Description
PasteSpecial

One or more Paste Special options.

Example

The following example copies all data from one worksheet to another except for cell comments:

using DevExpress.Spreadsheet;
// ...

using (Workbook sourceWorkbook = new Workbook())
using (Workbook targetWorkbook = new Workbook())
{
    targetWorkbook.LoadDocument(@"Documents\Book1.xlsx");
    sourceWorkbook.LoadDocument(@"Documents\Book2.xlsx");
    // Add a new worksheet to the destination workbook.
    targetWorkbook.Worksheets.Add("Sheet1_Copy");
    // Specify copy options.
    var copyOptions = new WorksheetCopyOptions()
    {
        // Copy all data except for cell comments. 
        PasteOptions = PasteSpecial.All & ~PasteSpecial.Comments
    };
    // Copy data from "Sheet1" in the source workbook
    // to the newly created worksheet in the destination workbook. 
    targetWorkbook.Worksheets["Sheet1_Copy"].CopyFrom(sourceWorkbook.Worksheets["Sheet1"], copyOptions);
    targetWorkbook.SaveDocument("Result.xlsx");
}
See Also