إدراج المجالات

مقدمة

في Excel ، يمكنك تحديد مجال ، ثم إدراج مجال ونقل البيانات الأخرى يمينًا أو لأسفل.

خيارات النقل

إدراج المجالات باستخدام Aspose.Cells

توفر Aspose.Cells الأسلوب Cells.InsertRange لإدراج مجموعة.

إدراج مجموعات ونقل الخلايا إلى اليمين

إدراج مجموعة ونقل الخلايا إلى اليمين مثلما في الشفرات التالية مع Aspose.Cells:

// Instantiate a new Workbook.
Workbook workbook = new Workbook();
// Get all the worksheets in the book.
WorksheetCollection worksheets = workbook.Worksheets;
// Get the first worksheet in the worksheets collection.
Worksheet worksheet = workbook.Worksheets[0];
// Create a range of cells.
Range sourceRange = worksheet.Cells.CreateRange("A1", "A2");
// Input some data with some formattings into
// A few cells in the range.
sourceRange[0, 0].PutValue("Test");
sourceRange[1, 0].PutValue("123");
CellArea ca = CellArea.CreateCellArea("A1", "A2");
worksheet.Cells.InsertRange(ca, ShiftType.Right);
Console.WriteLine(worksheet.Cells["B1"].StringValue == "Test");

إدراج مجموعات ونقل الخلايا للأسفل

إدراج مجموعة ونقل الخلايا للأسفل كما في الشفرات التالية مع Aspose.Cells:

// Instantiate a new Workbook.
Workbook workbook = new Workbook();
// Get all the worksheets in the book.
WorksheetCollection worksheets = workbook.Worksheets;
// Get the first worksheet in the worksheets collection.
Worksheet worksheet = workbook.Worksheets[0];
// Create a range of cells.
Range sourceRange = worksheet.Cells.CreateRange("A1", "A2");
// Input some data with some formattings into
// A few cells in the range.
sourceRange[0, 0].PutValue("Test");
sourceRange[1, 0].PutValue("123");
CellArea ca = CellArea.CreateCellArea("A1", "A2");
worksheet.Cells.InsertRange(ca, ShiftType.Down);
Console.WriteLine(worksheet.Cells["A3"].StringValue == "Test");