Cells
Overview
Cells is a class in Aspose.Cells FOSS for Python.
Represents a collection of cells in a worksheet.
This class declares 68 methods for Cells objects in Python programs.
Available methods include: AutoFitRow, AutoFitRows, ClearHorizontalPageBreaks, ClearVerticalPageBreaks, GetColumnWidth, GetRowHeight, IsColumnHidden, IsRowHidden, Merge, RemoveHorizontalPageBreak, RemoveVerticalPageBreak, SetColumnHidden, and 56 additional methods.
Public members are accessible to any Python application after installing the Aspose.Cells FOSS for Python package.
Methods
| Signature | Description |
|---|---|
__init__(worksheet) | Initializes a new instance of the Cells class. |
__getitem__(key) | Gets a cell by its reference (e.g., ‘A1’). |
__setitem__(key, value) | Sets a cell value by its reference (e.g., ‘A1’). |
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. |
auto_fit_row(row) | Auto-fit one 0-based row from its current display text and styles. |
auto_fit_rows(start_row, end_row) | Auto-fit an inclusive range of 0-based rows and return their heights. |
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) | Calls SetRowHeight(row, height) on this Cells instance. |
GetRowHeight(row) | Calls GetRowHeight(row) on this Cells instance. |
AutoFitRow(row) | Calls AutoFitRow(row) on this Cells instance. |
AutoFitRows(start_row, end_row) | Calls AutoFitRows(start_row, end_row) on this Cells instance. |
SetColumnWidth(column, width) | Calls SetColumnWidth(column, width) on this Cells instance. |
GetColumnWidth(column) | Calls GetColumnWidth(column) on this Cells instance. |
SetRowHidden(row, is_hidden) | Calls SetRowHidden(row, is_hidden) on this Cells instance. |
IsRowHidden(row) | Calls IsRowHidden(row) on this Cells instance. |
SetColumnHidden(column, is_hidden) | Calls SetColumnHidden(column, is_hidden) on this Cells instance. |
IsColumnHidden(column) | Calls IsColumnHidden(column) on this Cells instance. |
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) | Calls Merge(first_row, first_column, total_rows, total_columns) on this Cells instance. |
UnMerge(first_row, first_column, total_rows, total_columns) | Calls UnMerge(first_row, first_column, total_rows, total_columns) on this Cells instance. |
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) | Calls SetHorizontalPageBreak(row) on this Cells instance. |
RemoveHorizontalPageBreak(row) | Calls RemoveHorizontalPageBreak(row) on this Cells instance. |
ClearHorizontalPageBreaks() | Calls ClearHorizontalPageBreaks on this Cells instance. |
SetVerticalPageBreak(column) | Calls SetVerticalPageBreak(column) on this Cells instance. |
RemoveVerticalPageBreak(column) | Calls RemoveVerticalPageBreak(column) on this Cells instance. |
ClearVerticalPageBreaks() | Calls ClearVerticalPageBreaks on this Cells instance. |
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. |
__len__() | Gets the number of cells in the collection. |
__contains__(key) | Checks if a cell reference exists in the collection. |
__iter__() | Iterates over all cells in the collection. |
__repr__() | Returns a string representation of the Cells collection. |