Cells

Enumerations

Enumerations cells modül bir koleksiyon sağlar Cell tablo hücrelerini temsil eden nesneler, hem A1-style dize anahtarlarını hem de (row, col) tamsayı indekslemeyi destekler. Şu aracılığıyla erişilir Worksheet.cells ve … ile bütünleşir Workbook dosya G/Ç ve çalışma sayfası yönetimi için kök nesne.

import aspose.cells_foss

wb = aspose.cells_foss.Workbook()
ws = wb.worksheets[0]
ws.cells["A1"].value = "Revenue"
ws.cells[1, 1].value = 42

Enumerations

Enumerations Cells sınıf bir koleksiyon sağlar Cell hem A1-style hem de (row, col)-style erişime sahip nesneler. … olarak ortaya çıkar cells özelliği Worksheet örneklerinde ve “A1” gibi dize anahtarları ya da (0, 0) gibi tamsayı demetleriyle indekslemeyi destekler.

from aspose.cells_foss import Workbook

workbook = Workbook()
worksheet = workbook.worksheets[0]
cells = worksheet.cells
SignatureDescription
__init__(worksheet)Initializes a new instance of the Cells class.
cell(row, column)Accesses a cell by row and column (1-based).
column_index_from_string(column)Converts a column letter to a 1-based index.
column_letter_from_index(column_index)Converts a 1-based column index to a letter.
coordinate_from_string(coord)Converts an A1 coordinate string to (row, column) tuple (1-based).
coordinate_to_string(row, column)Converts row and column (1-based) to an A1 coordinate string.
iter_rows(min_row, max_row, min_col, max_col, values_only)Iterates over rows in the worksheet.
iter_cols(min_row, max_row, min_col, max_col, values_only)Iterates over columns in the worksheet.
count()Gets the number of cells in the collection.
clear()Clears all cells in the collection.
get_cell_by_name(cell_name)Gets a cell by its name (reference).
set_cell_by_name(cell_name, value)Sets a cell value by its name (reference).
get_cell(row, column)Gets a cell by row and column (1-based).
set_cell(row, column, value)Sets a cell value by row and column (1-based).
set_row_height(row, height)Sets the height of the specified row in points.
get_row_height(row)Gets the height of the specified row in points.
hide_row(row)Hides the specified row.
unhide_row(row)Unhides the specified row.
is_row_hidden(row)Checks if the specified row is hidden.
set_column_width(column, width)Sets the width of the specified column in character units.
get_column_width(column)Gets the width of the specified column in character units.
hide_column(column)Hides the specified column.
unhide_column(column)Unhides the specified column.
is_column_hidden(column)Checks if the specified column is hidden.
SetRowHeight(row, height)Sets the height of the given row in points (capitalized alias)
GetRowHeight(row)
SetColumnWidth(column, width)Sets the width of the given column in character units (capitalized alias)
GetColumnWidth(column)
SetRowHidden(row, is_hidden)Sets the hidden state of the specified row
IsRowHidden(row)Returns whether the specified row is hidden (capitalized alias)
SetColumnHidden(column, is_hidden)Sets the hidden state of the specified column
IsColumnHidden(column)
merge(first_row, first_column, total_rows, total_columns)Merges a rectangular range of cells.
unmerge(first_row, first_column, total_rows, total_columns)Unmerges a previously merged rectangular range of cells.
merge_range(range_ref)Merges a range specified in A1 notation.
unmerge_range(range_ref)Unmerges a range specified in A1 notation.
get_merged_cells()Gets all merged cell ranges in A1 notation.
Merge(first_row, first_column, total_rows, total_columns)
UnMerge(first_row, first_column, total_rows, total_columns)
set_horizontal_page_break(row)Adds a manual horizontal page break at the specified 0-based row index.
remove_horizontal_page_break(row)Removes a manual horizontal page break at the specified 0-based row index.
clear_horizontal_page_breaks()Clears all manual horizontal page breaks.
get_horizontal_page_breaks()Gets all manual horizontal page breaks.
set_vertical_page_break(column)Adds a manual vertical page break at the specified 0-based column index.
remove_vertical_page_break(column)Removes a manual vertical page break at the specified 0-based column index.
clear_vertical_page_breaks()Clears all manual vertical page breaks.
get_vertical_page_breaks()Gets all manual vertical page breaks.
SetHorizontalPageBreak(row)
RemoveHorizontalPageBreak(row)
ClearHorizontalPageBreaks()
SetVerticalPageBreak(column)
RemoveVerticalPageBreak(column)
ClearVerticalPageBreaks()
get_range(start_row, start_column, end_row, end_column)Gets a range of cells as a list of lists.
set_range(start_row, start_column, end_row, end_column, values)Sets values for a range of cells.
has_cell(cell_name)Checks if a cell exists in the collection.
delete_cell(cell_name)Deletes a cell from the collection.
get_all_cells()Gets all cells in the collection.

Enumerations

Enumerations cells koleksiyon bireysel … erişim sağlar Cell nesneler A1-style anahtarları veya (row, col) indeksleriyle. Her Cell stil ve diğer yalnızca okunabilir öznitelikleri aracılığıyla biçimlendirme ve içerik özelliklerini ortaya koyar.

EnumerationsEnumerationsEnumerations
valuestrHücre değeri (doğrudan atayın: ws.cells["A1"].value = x)
formulastrHücre formülü (doğrudan atama: ws.cells["A2"].formula = "=SUM(A1:A5)")
styleStyleHücre biçimlendirme: yazı tipi, dolgu, kenarlıklar, sayı biçimi, hizalama
commentstrHücre yorumu
data_typestrHücre veri türü

AutoFilter Özellikleri

Enumerations AutoFilter nesne şu şekilde erişilir worksheet.auto_filter. Çalışma sayfası aralığında filtreleme davranışını incelemek ve yapılandırmak için özellikler sağlar.

EnumerationsEnumerationsEnumerations
rangestrOtomatik filtrenin uygulandığı hücre aralığı (ör. “A1:D10”).
filter_columnslistSütun filtre ayarlarının listesi.
sort_statedictMevcut sıralama durumu yapılandırması.

Enumerations

Aşağıdaki örnek, Aspose.Cells FOSS kullanarak temel hücre manipülasyonu ve şekil oluşturmayı gösterir. Hücre değerlerini ayarlar, yazı tipi stilini uygular ve metin ve dolgu biçimlendirmeli yuvarlatılmış bir dikdörtgen şekil ekler. Bu, şunları kapsar Cell hücre temsili sınıfı ve Shape çizim nesneleri sınıfı.

from aspose.cells_foss import Workbook, MsoDrawingType

# Create a new workbook and access the first worksheet
workbook = Workbook()
worksheet = workbook.worksheets[0]

# Set and style a cell
worksheet.cells["A1"].value = "Styled Cell"
style = worksheet.cells["A1"].get_style()
style.font.bold = True
style.font.color = "#FF0000"
worksheet.cells["A1"].apply_style(style)

# Add a rounded rectangle shape with text and fill
shape = worksheet.shapes.add(MsoDrawingType.ROUNDED_RECTANGLE, 1, 1, 5, 5)
shape.text = "Hello Shape"
shape.fill.fore_color = "90EE90"

# Save the workbook
workbook.save("example.xlsx")

Ayrıca Bakınız

Enumerations Cells sınıf, bir çalışma sayfasındaki hücre koleksiyonunu temsil eder ve hem A1 stilinde hem de (satır, sütun) stilinde erişimi destekler. İlgili sınıflar şunları içerir Cell bireysel hücre işlemleri için ve SparklineGroup sparkline görsel stillerini yönetmek için.

 Türkçe