Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells provides you with the ability to cut and paste cells within a worksheet by using the InsertCutCells method of the Cells collection. The InsertCutCells method accepts the following parameters:
The following example shows how to cut and paste cells within a worksheet.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
Workbook workbook;
Worksheet worksheet = workbook.GetWorksheets().Get(0);
worksheet.GetCells().Get(0, 2).SetValue(1);
worksheet.GetCells().Get(1, 2).SetValue(2);
worksheet.GetCells().Get(2, 2).SetValue(3);
worksheet.GetCells().Get(2, 3).SetValue(4);
Range namedRange = worksheet.GetCells().CreateRange(0, 2, 3, 1);
namedRange.SetName(u"NamedRange");
Range cut = worksheet.GetCells().CreateRange(u"C:C");
worksheet.GetCells().InsertCutCells(cut, 0, 1, ShiftType::Right);
workbook.Save(outDir + u"CutAndPasteCells.xlsx");
std::cout << "Cells cut and pasted successfully!" << std::endl;
Aspose::Cells::Cleanup();
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.