Aralıkları Sil
Contents
[
Hide
]
Giriş
Excel’de bir aralık seçebilir, ardından onu silip diğer verileri sola veya yukarı kaydırabilirsiniz.
Aspose.Cells Kullanarak Aralıkları Sil
Aspose.Cells, Cells.delete_range yöntemini bir aralığı silmek için sağlar.
Aralıkları Sil ve Hücreleri Sola Kaydır
Aşağıdaki kodlarla Aspose.Cells ile bir aralığı silin ve hücreleri sola kaydırın:
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] | |
# Gets cells. | |
cells = worksheet.cells | |
# Input some data with some formattings into | |
# A few cells in the range. | |
cells.get("C2").put_value("C2") | |
cells.get("C3").put_value("C3") | |
ca = CellArea.create_cell_area("B2", "B3") | |
cells.delete_range(ca.start_row, ca.start_column, ca.end_row, ca.end_column, ShiftType.LEFT) | |
print(worksheet.cells.get("B2").string_value == "C2") |
Aralıkları Sil ve Hücreleri Yukarı Kaydır
Aşağıdaki kodlarla Aspose.Cells ile bir aralığı silin ve hücreleri yukarı kaydırın:
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] | |
# Gets cells. | |
cells = worksheet.cells | |
# Input some data with some formattings into | |
# A few cells in the range. | |
cells.get("B4").put_value("B4") | |
cells.get("B5").put_value("B5") | |
ca = CellArea.create_cell_area("B2", "B3") | |
cells.delete_range(ca.start_row, ca.start_column, ca.end_row, ca.end_column, ShiftType.UP) | |
print(worksheet.cells.get("B2").string_value == "B4") |