Cells

ImageRenderOptions

ImageRenderOptions cells ماژول مجموعه‌ای از Cell اشیائی که نمایانگر سلول‌های صفحه‌گسترده هستند و هر دو کلیدهای رشته‌ای به سبک A1 و ایندکس‌گذاری عددی (row, col) را پشتیبانی می‌کنند. از طریق Worksheet.cells و با Workbook شیء ریشه برای file I/O و مدیریت worksheet.

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 کلاس مجموعه‌ای از Cell اشیائی با دسترسی هم به سبک A1 و هم به سبک (row, col). به عنوان cells ویژگی در Worksheet نمونه‌ها و ایندکس‌گذاری را از طریق کلیدهای رشته‌ای مانند “A1” یا تاپل‌های عددی مانند (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 مجموعه دسترسی به موارد فردی را فراهم می‌کند Cell اشیاء از طریق کلیدهای سبک A1 یا اندیس‌های (row, col). هر Cell قالب‌بندی و ویژگی‌های محتوا را از طریق style و سایر ویژگی‌های فقط‑خواندنی افشا می‌کند.

ImageRenderOptionsImageRenderOptionsImageRenderOptions
valuestrمقدار سلول (به‌صورت مستقیم اختصاص دهید: ws.cells["A1"].value = x)
formulastrفرمول سلول (به‌صورت مستقیم اختصاص دهید: ws.cells["A2"].formula = "=SUM(A1:A5)")
styleStyleقالب‌بندی سلول: font، fill، borders، number format، alignment
commentstrنظر سلول
data_typestrنوع دادهٔ سلول

ویژگی‌های AutoFilter

ImageRenderOptions AutoFilter به شیء از طریق دسترسی می‌شود worksheet.auto_filter. این ویژگی‌ها را برای بررسی و پیکربندی رفتار فیلترگذاری در یک بازهٔ کاربرگ فراهم می‌کند.

ImageRenderOptionsImageRenderOptionsImageRenderOptions
rangestrبازهٔ سلولی که فیلتر خودکار بر آن اعمال می‌شود (مثلاً “A1:D10”).
filter_columnslistفهرست تنظیمات فیلتر ستون‌ها.
sort_statedictپیکربندی وضعیت مرتب‌سازی فعلی.

ImageRenderOptions

مثال زیر نشان‌دهندهٔ دستکاری پایهٔ سلول و ایجاد شکل با استفاده از Aspose.Cells FOSS است. این مثال مقادیر سلول‌ها را تنظیم می‌کند، استایل قلم را اعمال می‌نماید و یک شکل مستطیل گرد با متن و قالب‌بندی پرکننده اضافه می‌کند. این شامل Cell کلاس برای نمایش سلول و Shape کلاس برای اشیای رسم.

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

همچنین ببینید

ImageRenderOptions Cells class نمایانگر یک مجموعه از سلول‌ها در یک worksheet است و از دسترسی به سبک A1-style و (row, col)-style پشتیبانی می‌کند. کلاس‌های مرتبط شامل Cell برای عملیات‌های سلول منفرد و SparklineGroup برای مدیریت سبک‌های بصری sparkline.

 فارسی