ExcelRow Class
Excel row contains row options and cell range with row cells.
public sealed class ExcelRow : ExcelColumnRowBase
Public NotInheritable Class ExcelRow
Inherits ExcelColumnRowBase
- Inheritance:
- System.ObjectExcelRow
Properties
AllocatedCells
Gets only currently allocated cells for this row.
public ExcelCellCollection AllocatedCells { get; }
Public ReadOnly Property AllocatedCells As ExcelCellCollection
Property Value
Remarks
Use this collection if you are reading entire Excel file (you don't know exact position of cells with data). If writing values, using Cells property is recommended.
This collection contains only allocated cells so it is faster as you avoid checking every single cell in a row. You still need to check if a specific cell contains any value (it can be empty).
See Also
Height
Gets or sets row height.
Property Value
- System.Int32
Remarks
Unit is twip (1/20th of a point).
IsAutoFitted
Gets a value indicating whether this row height is automatically fitted.
Property Value
- System.Boolean
true if this instance is automatically fitted; otherwise, false.
Methods
AutoFit()
Automatically fits row height to the minimum size required for all lines in the row cells to be visible.
Remarks
Auto-fit row height is a MS Excel feature and not a file format feature. When rows are auto-fit in MS Excel user interface, MS Excel will calculate current character heights and set row height to the new numeric value.
This method will set Height to the approximate value (maxLinesCount * 255).
This method doesn't take into account merged ranges when calculating the height. To take into account also merged ranges, use the AutoFit(Boolean) method.
AutoFit(Boolean)
Automatically fits row height to the minimum size required for all lines in the row cells to be visible.
public void AutoFit(bool autoFitMergedRanges)
Public Sub AutoFit(autoFitMergedRanges As Boolean)
Parameters
autoFitMergedRanges
- System.Boolean
True if merged ranges should be taken into account.
Remarks
Auto-fit row height is a MS Excel feature and not a file format feature. When rows are auto-fit in MS Excel user interface, MS Excel will calculate current character heights and set row height to the new numeric value.
This method will set Height to the approximate value (maxLinesCount * 255).
GetHeight(LengthUnit)
Gets the height of row in arbitrary length unit.
public double GetHeight(LengthUnit lengthUnit)
Public Function GetHeight(lengthUnit As LengthUnit) As Double
Parameters
lengthUnit
- LengthUnit
The length unit in which to return row height.
Returns
- System.Double
The height of row in arbitrary length unit.
SetHeight(Double, LengthUnit)
Sets the height of row in arbitrary length unit.
public void SetHeight(double value, LengthUnit lengthUnit)
Public Sub SetHeight(value As Double, lengthUnit As LengthUnit)
Parameters
value
- System.Double
Row height value.
lengthUnit
- LengthUnit
The length unit in which value
is specified.
Inherited Properties
Cells | Gets cell range with column / row cells. (Inherited from ExcelColumnRowBase) |
Collapsed | Gets or sets whether object is collapsed in outlining. (Inherited from ExcelColumnRowBase) |
Hidden | Gets or sets whether excel object is hidden. (Inherited from ExcelColumnRowBase) |
Index | Gets the row / column zero-based index which represents its position in a worksheet. (Inherited from ExcelColumnRowBase) |
Name | Gets the name of ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |
OutlineLevel | Gets or sets outline level. (Inherited from ExcelColumnRowBase) |
Style | Gets or sets the cell formatting of cells in this column / row. (Inherited from ExcelColumnRowBase) |
Inherited Methods
Equals(System.Object) | Determines whether the specified System.Object is equal to this ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |
GetHashCode() | Returns a hash code for this ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |
ToString() | Returns a System.String that represents this ExcelColumnRowBase instance. (Inherited from ExcelColumnRowBase) |