Class Row
Contents
[
Hide
]Row class
Represents a single row in a worksheet.
public class Row : IEnumerable
Properties
Name | Description |
---|---|
FirstCell { get; } | Gets the first cell object in the row. |
FirstDataCell { get; } | Gets the first non-blank cell in the row. |
GroupLevel { get; set; } | Gets the group level of the row. |
HasCustomStyle { get; } | Indicates whether this row has custom style settings(different from the default one inherited from workbook). |
Height { get; set; } | Gets and sets the row height in unit of Points. |
Index { get; } | Gets the index of this row. |
IsBlank { get; } | Indicates whether the row contains any data |
IsCollapsed { get; set; } | whether the row is collapsed |
IsHeightMatched { get; set; } | Indicates that row height and default font height matches. |
IsHidden { get; set; } | Indicates whether the row is hidden. |
Item { get; } | Gets the cell. |
LastCell { get; } | Gets the last cell object in the row. |
LastDataCell { get; } | Gets the last non-blank cell in the row. |
Style { get; } | (Obsolete.) Represents the style of this row. |
Methods
Name | Description |
---|---|
ApplyStyle(Style, StyleFlag) | Applies formats for a whole row. |
CopySettings(Row, bool) | Copy settings of row, such as style, height, visibility, …etc. |
override Equals(object) | Checks whether this object refers to the same row with another. |
Equals(Row) | Checks whether this object refers to the same row with another row object. |
GetCellByIndex(int) | (Obsolete.) Get the cell by specific index in the list. |
GetCellOrNull(int) | Gets the cell or null in the specific index. |
GetEnumerator() | Gets the cells enumerator |
GetEnumerator(bool, bool) | Gets an enumerator that iterates cells through this row. |
GetStyle() | Gets the style of this row. |
SetStyle(Style) | Sets the style of this row. |
Examples
[C#]
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
Style style = workbook.CreateStyle();
//Setting the background color to Blue
style.BackgroundColor = Color.Blue;
//Setting the foreground color to Red
style.ForegroundColor= Color.Red;
//setting Background Pattern
style.Pattern = BackgroundType.DiagonalStripe;
//New Style Flag
StyleFlag styleFlag = new StyleFlag();
//Set All Styles
styleFlag.All = true;
//Get first row
Row row = worksheet.Cells.Rows[0];
//Apply Style to first row
row.ApplyStyle(style, styleFlag);
//Saving the Excel file
workbook.Save("book1.xls");
[VB.NET]
'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Obtaining the reference of the first worksheet
Dim worksheet As Worksheet = workbook.Worksheets(0)
Dim style As Style = workbook.CreateStyle()
'Setting the background color to Blue
style.BackgroundColor = Color.Blue
'Setting the foreground color to Red
style.ForegroundColor = Color.Red
'setting Background Pattern
style.Pattern = BackgroundType.DiagonalStripe
'New Style Flag
Dim styleFlag As New StyleFlag()
'Set All Styles
styleFlag.All = True
'Get first row
Dim row as Row = worksheet.Cells.Rows(0)
'Apply Style to first row
row.ApplyStyle(style, styleFlag)
'Saving the Excel file
workbook.Save("book1.xls")
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells