PasteSpecial

PasteSpecial([sPasteType], [sPasteSpecialOperation], bSkipBlanks, bTranspose)

Pastes the Range object to the specified range using the special paste options.

Parameters:

Name Type Default Description
sPasteType PasteType "xlPasteAll"

Paste option.

sPasteSpecialOperation PasteSpecialOperation "xlPasteSpecialOperationNone"

The mathematical operation which will be applied to the copied data.

bSkipBlanks boolean

[bSkipBlanks=false] - Specifies whether to avoid replacing values in the paste area when blank cells occur in the copy area.

bTranspose boolean

[bTranspose=false] - Specifies whether the pasted data will be transposed from rows to columns.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oRange = oWorksheet.GetRange("A1");
var oDestRange = oWorksheet.GetRange("A2");
oRange.SetValue(1);
oDestRange.SetValue(2);
oRange.Copy();
oDestRange.PasteSpecial("xlPasteValues", "xlPasteSpecialOperationAdd", false, false);
builder.SaveFile("xlsx", "PasteSpecial.xlsx");
builder.CloseFile();

Resulting document