NamedRange.RowHeight Property

Gets or sets the height of all the rows in the NamedRange control, measured in points.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
Property RowHeight As Object
Object RowHeight { get; set; }

Property Value

Type: System.Object
The height of all the rows in the NamedRange control, measured in points. Returns nulla null reference (Nothing in Visual Basic) if the rows in the specified range are not all the same height.

Remarks

For a single row, the value of the Height property is equal to the value of the RowHeight property. However, you can also use the Height property to return the total height of a range of cells.

Other differences between RowHeight and Height include the following:

  • Height is read-only.

  • If you return the RowHeight property of several rows, you will get either the row height of each of the rows (if all the rows are the same height) or nulla null reference (Nothing in Visual Basic) (if they are different heights). If you return the Height property of several rows, you will get the total height of all the rows.

Examples

The following code example creates a NamedRange and then sets the width of the columns and the height of the rows that are part of the range.

This example is for a document-level customization.

Private setColumnRowRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub SetColumnAndRowSizes()
    setColumnRowRange = Me.Controls.AddNamedRange( _
        Me.Range("C3", "E6"), "setColumnRowRange")
    Me.setColumnRowRange.ColumnWidth = 20
    Me.setColumnRowRange.RowHeight = 25
    setColumnRowRange.Select()
End Sub
Microsoft.Office.Tools.Excel.NamedRange setColumnRowRange;
private void SetColumnAndRowSizes()
{
    setColumnRowRange = this.Controls.AddNamedRange(
        this.Range["C3", "E6"], "setColumnRowRange");
    this.setColumnRowRange.ColumnWidth = 20;
    this.setColumnRowRange.RowHeight = 25;
    setColumnRowRange.Select();
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace