Class PasteOptions
Contents
[
Hide
]PasteOptions class
Represents the paste special options.
public class PasteOptions
Constructors
| Name | Description |
|---|---|
| PasteOptions() | The default constructor. |
Properties
| Name | Description |
|---|---|
| IgnoreLinksToOriginalFile { get; set; } | Ingore links to the original file. |
| KeepOldTables { get; set; } | Keeps the tables in the destination range. |
| OnlyVisibleCells { get; set; } | True means only copying visible cells. |
| OperationType { get; set; } | Gets and sets the operation type when pasting range. |
| PasteType { get; set; } | The paste special type. |
| SkipBlanks { get; set; } | Indicates whether skips blank cells. |
| Transpose { get; set; } | True to transpose rows and columns when the range is pasted. The default value is False. |
Examples
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class PasteOptionsDemo
{
public static void PasteOptionsExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
// Add some data to the first worksheet
sheet.Cells["A1"].PutValue("Hello");
sheet.Cells["A2"].PutValue("World");
sheet.Cells["A3"].PutValue(123);
// Create another worksheet
Worksheet sheet2 = workbook.Worksheets.Add("Sheet2");
// Define the source range
Aspose.Cells.Range sourceRange = sheet.Cells.CreateRange("A1:A3");
// Define the destination range
Aspose.Cells.Range destRange = sheet2.Cells.CreateRange("B1:B3");
// Create PasteOptions object
PasteOptions pasteOptions = new PasteOptions
{
PasteType = PasteType.Values,
SkipBlanks = true,
OnlyVisibleCells = false,
Transpose = false,
OperationType = PasteOperationType.None,
IgnoreLinksToOriginalFile = true
};
// Copy the range with the specified paste options
destRange.Copy(sourceRange, pasteOptions);
// Save the workbook
workbook.Save("PasteOptionsExample.xlsx");
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells