剪切和粘贴范围
Contents
[
Hide
]
剪切和粘贴 Cells
Aspose.Cells 使您能够使用插入剪切单元格的方法Cells收藏。这插入剪切单元格接受以下参数。
以下示例显示如何在工作表中剪切和粘贴单元格。
示例代码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
//Source directory | |
string outDir = RunExamples.Get_OutputDirectory(); | |
Workbook workbook = new Workbook(); | |
Worksheet worksheet = workbook.Worksheets[0]; | |
worksheet.Cells[0, 2].Value = 1; | |
worksheet.Cells[1, 2].Value = 2; | |
worksheet.Cells[2, 2].Value = 3; | |
worksheet.Cells[2, 3].Value = 4; | |
worksheet.Cells.CreateRange(0, 2, 3, 1).Name = "NamedRange"; | |
Range cut = worksheet.Cells.CreateRange("C:C"); | |
worksheet.Cells.InsertCutCells(cut, 0, 1, ShiftType.Right); | |
workbook.Save(outDir + "CutAndPasteCells.xlsx"); |