Cells

ImageRenderOptions

ImageRenderOptions cells modul poskytuje kolekciu Cell objektov predstavujúcich bunky tabuľky, podporujúcich kľúče reťazcové v štýle A1 aj celočíselné indexovanie (riadok, stĺpec). Pristupuje sa k nemu cez Worksheet.cells a integruje sa s Workbook koreňovým objektom pre vstup/výstup súborov a správu pracovných hárkov.

import aspose.cells_foss

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

ImageRenderOptions

ImageRenderOptions Cells trieda poskytuje kolekciu Cell objektov s prístupom v štýle A1 aj (riadok, stĺpec). Je vystavená ako cells vlastnosť na Worksheet inštanciách a podporuje indexovanie pomocou reťazcových kľúčov ako “A1” alebo celočíselných n-tíc ako (0, 0).

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.

ImageRenderOptions

ImageRenderOptions cells kolekcia poskytuje prístup k jednotlivým Cell objektom prostredníctvom kľúčov v štýle A1 alebo indexov (riadok, stĺpec). Každý Cell zverejňuje vlastnosti formátovania a obsahu prostredníctvom svojho štýlu a ďalších len na čítanie atribútov.

ImageRenderOptionsImageRenderOptionsImageRenderOptions
valuestrHodnota bunky (priradiť priamo: ws.cells["A1"].value = x)
formulastrVzorec bunky (priradiť priamo: ws.cells["A2"].formula = "=SUM(A1:A5)")
styleStyleFormátovanie bunky: písmo, výplň, okraje, formát čísla, zarovnanie
commentstrKomentár bunky
data_typestrTyp údajov bunky

Vlastnosti AutoFilter

ImageRenderOptions AutoFilter objekt je prístupný cez worksheet.auto_filter. Poskytuje vlastnosti na kontrolu a konfiguráciu správania filtrovania v rozsahu hárka.

ImageRenderOptionsImageRenderOptionsImageRenderOptions
rangestrRozsah buniek, na ktorý sa aplikuje automatický filter (napr. “A1:D10”).
filter_columnslistZoznam nastavení filtra stĺpca.
sort_statedictAktuálna konfigurácia stavu zoradenia.

ImageRenderOptions

Nasledujúci príklad demonštruje základnú manipuláciu s bunkami a tvorbu tvarov pomocou Aspose.Cells FOSS. Nastavuje hodnoty buniek, aplikuje štýl písma a pridáva zaoblený obdĺžnikový tvar s textom a výplňovým formátovaním. Toto pokrýva Cell triedu pre reprezentáciu bunky a Shape triedu pre kreslenie objektov.

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")

Pozri tiež

ImageRenderOptions Cells trieda predstavuje kolekciu buniek v hárku a podporuje prístup v štýle A1 aj (riadok, stĺpec). Súvisiace triedy zahŕňajú Cell pre operácie s jednotlivými bunkami a SparklineGroup pre správu vizuálnych štýlov sparkline.

 Slovenčina