Search Results for

    Show / Hide Table of Contents

    Class RangeRow

    A class that represents a single row of cells.

    Inheritance
    System.Object
    Range
    RangeRow
    Implements
    System.Collections.Generic.IEnumerable<Cell>
    System.Collections.IEnumerable
    Inherited Members
    Range.ClearContents()
    Range.GetEnumerator()
    Range.ToArray()
    Range.Sum()
    Range.Max()
    Range.Min()
    Range.Avg()
    Range.AddRange(Range)
    Range.AddRange(RangeAddress)
    Range.SubtractRange(Range)
    Range.SubtractRange(RangeAddress)
    Range.RemoveRow(Int32)
    Range.RemoveRow(RangeRow)
    Range.RemoveColumn(String)
    Range.RemoveColumn(Int32)
    Range.RemoveColumn(RangeColumn)
    Range.InsertRow(Int32)
    Range.InsertRows(Int32, Int32)
    Range.InsertColumn(Int32)
    Range.InsertColumn(String)
    Range.InsertColumns(String, Int32)
    Range.InsertColumns(Int32, Int32)
    Range.SortAscending()
    Range.SortDescending()
    Range.SortByColumn(String, SortOrder)
    Range.SortByColumn(Int32, SortOrder)
    Range.Trim()
    Range.ToDataTable(Boolean)
    Range.SetCellValue(Int32, Int32, Object)
    Range.GetValue<TType>()
    Range.TryGetValue<TType>(TType)
    Range.ToString()
    Range.Copy(WorkSheet, String)
    Range.Replace(String, String)
    Range.SaveAsNamedTable(String, Boolean, TableStyle, Boolean)
    Range.SaveAsNamedRange(String, Boolean)
    Range.Row(Int32)
    Range.Column(Int32)
    Range.RangeAddress
    Range.RangeAddressAsString
    Range.Count
    Range.ColumnCount
    Range.RowCount
    Range.Style
    Range.WorkBook
    Range.IsEmpty
    Range.Rows
    Range.Columns
    Range.Value
    Range.FormatString
    Range.Formula
    Range.StringValue
    Range.DateTimeValue
    Range.BoolValue
    Range.IntValue
    Range.DoubleValue
    Range.DecimalValue
    Range.FloatValue
    Range.Int64Value
    Range.LongValue
    Range.Int32Value
    Range.AllRowsInRange
    Range.AllColumnsInRange
    Namespace: IronXL
    Assembly: IronXL.dll
    Syntax
    public class RangeRow : Range, IEnumerable<Cell>, IEnumerable

    Properties

    Height

    Gets or sets the height of the row.

    Declaration
    public int Height { get; set; }
    Property Value
    Type Description
    System.Int32

    Hidden

    Gets or sets a value indicating whether this row is hidden.

    Declaration
    public bool Hidden { get; set; }
    Property Value
    Type Description
    System.Boolean

    RowNumber

    0-based index of the row.

    Declaration
    public int RowNumber { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    AutoSizeRow()

    Changes height of the row to fit the content based on font measurements.

    This method measures the text in the cell based on the font that is used for the cell.

    If the exact font is not found on the machine, it will try to measure with a default font (Arial).

    ------------------------------------------------

    Usage:

    // Auto-size row 5 to fit its content
    var workbook = WorkBook.Load("example.xlsx");
    var sheet = workbook.DefaultWorkSheet;
    var row = sheet.GetRow(5);
    row.AutoSizeRow();
    workbook.SaveAs("autosized.xlsx");

    ------------------------------------------------

    Declaration
    public void AutoSizeRow()
    Remarks

    Important Considerations:

    ⚠️ Font Availability: The exact font must be installed on the system for accurate measurements.

    📝 Note: This overload does not consider merged cells. Use AutoSizeRow(true) to include merged cells.

    Related Documentation:

    📖 How-To Guide:AutoSize Rows and Columns Guide

    📚 API Reference:RangeRow API Documentation

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the row cannot be auto-sized.

    SixLabors.Fonts.FontException

    Thrown when no fonts are found installed on the machine.

    AutoSizeRow(Boolean)

    Changes height of the row to fit the content based on font measurements.

    This method measures the text in the cell based on the font that is used for the cell.

    If the exact font is not found on the machine, it will try to measure with a default font (Arial).

    ------------------------------------------------

    Usage:

    // Auto-size row 5 including merged cells
    var workbook = WorkBook.Load("example.xlsx");
    var sheet = workbook.DefaultWorkSheet;
    var row = sheet.GetRow(5);
    row.AutoSizeRow(true);  // Include merged cells
    workbook.SaveAs("autosized.xlsx");

    ------------------------------------------------

    Declaration
    public void AutoSizeRow(bool useMergedCells)
    Parameters
    Type Name Description
    System.Boolean useMergedCells

    If true, the height of merged cells will be considered.

    Remarks

    Important Considerations:

    ⚠️ Font Availability: The exact font must be installed on the system for accurate measurements.

    📝 Merged Cells: When useMergedCells is true, the height calculation considers cells that span multiple rows.

    🎯 Wrap Text: If cells have wrap text enabled, the height will be adjusted to show all wrapped content.

    Related Documentation:

    📖 How-To Guide:AutoSize Rows and Columns Guide

    📚 API Reference:RangeRow API Documentation

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when the row cannot be auto-sized.

    SixLabors.Fonts.FontException

    Thrown when no fonts are found installed on the machine.

    RemoveRow()

    Removes the row from the worksheet.

    Declaration
    public void RemoveRow()

    Implements

    System.Collections.Generic.IEnumerable<>
    System.Collections.IEnumerable

    Inherited members

    ClearContents()
    GetEnumerator()
    ToArray()
    Sum()
    Max()
    Min()
    Avg()
    AddRange(Range)
    AddRange(RangeAddress)
    SubtractRange(Range)
    SubtractRange(RangeAddress)
    RemoveRow(Int32)
    RemoveRow(RangeRow)
    RemoveColumn(String)
    RemoveColumn(Int32)
    RemoveColumn(RangeColumn)
    InsertRow(Int32)
    InsertRows(Int32, Int32)
    InsertColumn(Int32)
    InsertColumn(String)
    InsertColumns(String, Int32)
    InsertColumns(Int32, Int32)
    SortAscending()
    SortDescending()
    SortByColumn(String, SortOrder)
    SortByColumn(Int32, SortOrder)
    Trim()
    ToDataTable(Boolean)
    SetCellValue(Int32, Int32, Object)
    GetValue<TType>()
    TryGetValue<TType>(TType)
    ToString()
    Copy(WorkSheet, String)
    Replace(String, String)
    SaveAsNamedTable(String, Boolean, TableStyle, Boolean)
    SaveAsNamedRange(String, Boolean)
    Row(Int32)
    Column(Int32)
    RangeAddress
    RangeAddressAsString
    Count
    ColumnCount
    RowCount
    Style
    WorkBook
    IsEmpty
    Rows
    Columns
    Value
    FormatString
    Formula
    StringValue
    DateTimeValue
    BoolValue
    IntValue
    DoubleValue
    DecimalValue
    FloatValue
    Int64Value
    LongValue
    Int32Value
    AllRowsInRange
    AllColumnsInRange
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    Want to deploy IronXL to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronXL free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.