أدخل النطاقات
Contents
[
Hide
]
مقدمة
في Excel ، يمكنك تحديد نطاق ، ثم إدراج نطاق وتحويل البيانات الأخرى إلى اليمين أو الأسفل.
! [خيارات التحول] (InsertRange.png)
أدخل النطاقات باستخدام Aspose.Cells
يوفر Aspose.CellsCells.InsertRange طريقة لإدراج نطاق.
أدخل النطاقات وقم بإزاحة Cells لليمين
أدخل راناج وخلايا التحول بشكل صحيح كما هو الحال مع الرموز التالية مع Aspose.Cells:
This file contains 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
// Instantiate a new Workbook. | |
Workbook workbook = new Workbook(); | |
// Get all the worksheets in the book. | |
WorksheetCollection worksheets = workbook.getWorksheets(); | |
// Get the first worksheet in the worksheets collection. | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Create a range of cells. | |
Range sourceRange = worksheet.getCells().createRange("A1", "A2"); | |
// Set a few cells in the range. | |
sourceRange.get(0, 0).putValue("Test"); | |
sourceRange.get(1, 0).putValue("123"); | |
CellArea ca = CellArea.createCellArea("A1", "A2"); | |
worksheet.getCells().insertRange(ca, ShiftType.RIGHT); | |
String b1Value = worksheet.getCells().get("B1").getStringValue();// "Test" | |
أدخل النطاقات وقم بإزاحة Cells لأسفل
أدخل راناج وتحول الخلايا لأسفل على النحو التالي مع الرموز التالية مع Aspose.Cells:
This file contains 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
// Instantiate a new Workbook. | |
Workbook workbook = new Workbook(); | |
// Get all the worksheets in the book. | |
WorksheetCollection worksheets = workbook.getWorksheets(); | |
// Get the first worksheet in the worksheets collection. | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Create a range of cells. | |
Range sourceRange = worksheet.getCells().createRange("A1", "A2"); | |
// Set a few cells in the range. | |
sourceRange.get(0, 0).putValue("Test"); | |
sourceRange.get(1, 0).putValue("123"); | |
CellArea ca = CellArea.createCellArea("A1", "A2"); | |
worksheet.getCells().insertRange(ca, ShiftType.DOWN); | |
String a3Value = worksheet.getCells().get("A3").getStringValue();// "Test" | |