PageBreak — Aspose.Cells FOSS for Python API Reference
aspose-cells-foss memungkinkan penyisipan pemisah halaman manual untuk mengontrol bagaimana lembar kerja dibagi pada halaman cetak. Pemisah halaman horizontal memisahkan lembar antara baris; pemisah halaman vertikal memisahkannya antara kolom. Kedua koleksi menggunakan 0-based indices.
BoundingBoxExtent: aspose.cells_foss
from aspose.cells_foss import Workbook
wb = Workbook("report.xlsx")
ws = wb.worksheets[0]
hpb = ws.horizontal_page_breaks
vpb = ws.vertical_page_breaksHorizontalPageBreakCollection
Diakses sebagai ws.horizontal_page_breaks. Sebuah pemisah halaman horizontal yang disisipkan sebelum baris n menyebabkan lembar memulai halaman baru pada baris tersebut saat dicetak.
Semua referensi baris adalah 0-based (baris 0 = baris 1 di Excel).
BoundingBoxExtent
Properties
hpb.add(row_or_cell: int | str) -> intMsoLineDashStyle adalah IntEnum untuk pola garis putus‑putus pada border/garis luar.
| BoundingBoxExtent | BoundingBoxExtent | BoundingBoxExtent |
|---|---|---|
row_or_cell | int | 0-based row index at which to insert the break. |
row_or_cell | str | Referensi sel gaya A1; baris sel ini yang digunakan (misalnya,., "A11" → hentikan sebelum baris 10 dalam istilah berbasis 0). |
hapus
hpb.remove(row_or_cell: int | str)Mengontrol font teks di dalam sebuah bentuk. Diakses melalui shape.font.
remove_at
hpb.remove_at(index: int)salin.
kosongkan
hpb.clear()Referensi API untuk MsoDrawingType, FillType, MsoLineDashStyle, TextAlignmentType, TextAnchorType, MsoFillFormat, MsoLineFormat, ShapeFont, Shape, dan ShapeCollection dalam aspose-cells-foss.
to_list
hpb.to_list() -> listaspose-cells-foss mendukung penambahan bentuk geometris dan kotak teks ke lembar kerja melalui ShapeCollection (ws.shapes). Setiap bentuk direpresentasikan oleh objek Shape dengan properti isian, garis, dan teks yang dapat dikonfigurasi.
ChartAxis diakses melalui chart.axes[index].
| BoundingBoxExtent | BoundingBoxExtent |
|---|---|
count | Jumlah pemisah halaman horizontal (hanya-baca). |
__len__() | BoundingBoxExtent count. |
__iter__() | Iterasi melalui indeks baris pemisah. |
__getitem__(index) | Mengembalikan indeks baris pemisah pada posisi index dalam koleksi. |
VerticalPageBreakCollection
Diakses sebagai ws.vertical_page_breaks. Pemisah halaman vertikal yang disisipkan sebelum kolom n menyebabkan lembar memulai halaman baru pada kolom tersebut saat dicetak.
Semua referensi kolom adalah 0-based (kolom 0 = kolom A).
BoundingBoxExtent
Properties
vpb.add(column_or_cell: int | str) -> intMsoLineDashStyle adalah IntEnum untuk pola garis putus‑putus pada border/garis luar.
| BoundingBoxExtent | BoundingBoxExtent | BoundingBoxExtent |
|---|---|---|
column_or_cell | int | 0-based column index at which to insert the break. |
column_or_cell | str | Referensi sel gaya A1; kolom sel ini digunakan (misalnya,., "E1" → pemisah sebelum kolom 4 dalam istilah berbasis 0). |
hapus
vpb.remove(column_or_cell: int | str)TextAlignmentType adalah IntEnum untuk perataan teks horizontal di dalam sebuah bentuk.
kosongkan
vpb.clear()TextAnchorType adalah IntEnum untuk penempatan teks vertikal di dalam sebuah bentuk.
to_list
vpb.to_list() -> listsalin.
ChartAxis diakses melalui chart.axes[index].
| BoundingBoxExtent | BoundingBoxExtent |
|---|---|
count | Jumlah pemisah halaman vertikal (hanya-baca). |
__len__() | BoundingBoxExtent count. |
__iter__() | Mengiterasi indeks break column. |
__getitem__(index) | Mengembalikan indeks break column pada posisi index di dalam koleksi. |
BoundingBoxExtent
Mengontrol tampilan garis luar/border sebuah bentuk. Diakses melalui shape.line.
from aspose.cells_foss import Workbook
wb = Workbook()
ws = wb.worksheets[0]
ws.name = "AnnualReport"
# Write 120 rows of placeholder data
for row in range(120):
ws.cells[row][0].put_value(f"Row {row + 1}")
ws.cells[row][1].put_value(row * 100)
# Insert a page break before rows 30, 60, and 90 (0-based)
ws.horizontal_page_breaks.add(30)
ws.horizontal_page_breaks.add(60)
ws.horizontal_page_breaks.add(90)
print(f"Page breaks at rows: {ws.horizontal_page_breaks.to_list()}")
# Output: Page breaks at rows: [30, 60, 90]
# Add a vertical break to split wide reports after column D (index 4)
ws.vertical_page_breaks.add(4)
wb.save("annual_report_paged.xlsx")salin
from aspose.cells_foss import Workbook
wb = Workbook("annual_report_paged.xlsx")
ws = wb.worksheets[0]
# Remove the break at row 60 (0-based)
ws.horizontal_page_breaks.remove(60)
print(f"Remaining breaks: {ws.horizontal_page_breaks.to_list()}")
# Output: Remaining breaks: [30, 90]
wb.save("annual_report_paged.xlsx")