Condividi tramite


NamedRange.RowHeight Property

Definition

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

public:
 property System::Object ^ RowHeight { System::Object ^ get(); void set(System::Object ^ value); };
public object RowHeight { get; set; }
member this.RowHeight : obj with get, set
Public Property RowHeight As Object

Property Value

The height of all the rows in the NamedRange control, measured in points. Returns null if the rows in the specified range are not all the same height.

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.

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();
}
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

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 null (if they are different heights). If you return the Height property of several rows, you will get the total height of all the rows.

Applies to