Row class
Row class
Represents a single row in a worksheet.
The Row type exposes the following members:
Properties
Property | Description |
---|---|
is_blank | Indicates whether the row contains any data |
is_collapsed | whether the row is collapsed |
height | Gets and sets the row height in unit of Points. |
is_hidden | Indicates whether the row is hidden. |
index | Gets the index of this row. |
group_level | Gets the group level of the row. |
is_height_matched | Indicates whether the row height matches current default font setting of the workbook. True of this property also denotes the row height is “automatic” without custom height value set by user. |
has_custom_style | Indicates whether this row has custom style settings(different from the default one inherited from workbook). |
first_cell | Gets the first cell object in the row. |
first_data_cell | Gets the first non-blank cell in the row. |
last_cell | Gets the last cell object in the row. |
last_data_cell | Gets the last non-blank cell in the row. |
Gets the cell.
Indexer
Name | Description |
---|---|
[index] | The column index |
Methods
Method | Description |
---|---|
get_cell_by_index | Get the cell by specific index in the cells collection of this row. |
get_enumerator | Gets an enumerator that iterates cells through this row. |
get_cell_or_null | Gets the cell or null in the specific index. |
get_style | Gets the style of this row. |
set_style | Sets the style of this row. |
copy_settings | Copy settings of row, such as style, height, visibility, …etc. |
apply_style | Applies formats for a whole row. |
equals | Checks whether this object refers to the same row with another row object. |
Example
from aspose.cells import BackgroundType, StyleFlag, Workbook
from aspose.pydrawing import Color
# Instantiating a Workbook object
workbook = Workbook()
# Obtaining the reference of the first worksheet
worksheet = workbook.worksheets[0]
style = workbook.create_style()
# Setting the background color to Blue
style.background_color = Color.blue
# Setting the foreground color to Red
style.foreground_color = Color.red
# setting Background Pattern
style.pattern = BackgroundType.DIAGONAL_STRIPE
# New Style Flag
styleFlag = StyleFlag()
# Set All Styles
styleFlag.all = True
# Get first row
row = worksheet.cells.rows[0]
# Apply Style to first row
row.apply_style(style, styleFlag)
# Saving the Excel file
workbook.save("book1.xls")
See Also
- module
aspose.cells