إدراج المجالات
Contents
[
Hide
]
مقدمة
في Excel ، يمكنك تحديد مجال ، ثم إدراج مجال ونقل البيانات الأخرى يمينًا أو لأسفل.
قم بإدراج النطاقات باستخدام مكتبة أسبوز.سيلز لبايثون للإكسل
توفر أسبوز.سيلز لبايثون via .NET طريقة إدراج_نطاق لإدراج نطاق.
كيفية إدراج نطاقات ونقل الخلايا لليمين
إدراج مجموعة ونقل الخلايا إلى اليمين مثلما في الشفرات التالية مع 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
from aspose.cells import CellArea, ShiftType, Workbook | |
# Instantiate a new Workbook. | |
workbook = Workbook() | |
# Get all the worksheets in the book. | |
worksheets = workbook.worksheets | |
# Get the first worksheet in the worksheets collection. | |
worksheet = workbook.worksheets[0] | |
cells = worksheet.cells | |
# Create a range of cells. | |
sourceRange = cells.create_range("A1", "A2") | |
startRow = sourceRange.first_row | |
startCol = sourceRange.first_column | |
# Input some data with some formattings into | |
# A few cells in the range. | |
cells.get(startRow, startCol).put_value("Test") | |
cells.get(startRow + 1, startCol).put_value("123") | |
ca = CellArea.create_cell_area("A1", "A2") | |
worksheet.cells.insert_range(ca, ShiftType.RIGHT) | |
print(worksheet.cells.get("B1").string_value == "Test") |
كيفية إدراج نطاقات ونقل الخلايا للأسفل
إدراج مجموعة ونقل الخلايا للأسفل كما في الشفرات التالية مع 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
from aspose.cells import CellArea, ShiftType, Workbook | |
# Instantiate a new Workbook. | |
workbook = Workbook() | |
# Get all the worksheets in the book. | |
worksheets = workbook.worksheets | |
# Get the first worksheet in the worksheets collection. | |
worksheet = workbook.worksheets[0] | |
cells = worksheet.cells | |
# Create a range of cells. | |
sourceRange = cells.create_range("A1", "A2") | |
startRow = sourceRange.first_row | |
startCol = sourceRange.first_column | |
# Input some data with some formattings into | |
# A few cells in the range. | |
cells.get(startRow, startCol).put_value("Test") | |
cells.get(startRow + 1, startCol).put_value("123") | |
ca = CellArea.create_cell_area("A1", "A2") | |
worksheet.cells.insert_range(ca, ShiftType.DOWN) | |
print(worksheet.cells.get("A3").string_value == "Test") |