The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

Worksheet.DefaultRowHeight Property

Gets or sets the default height of worksheet rows.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

double DefaultRowHeight { get; set; }
Property DefaultRowHeight As Double
double DefaultRowHeight { get; set; }
Property DefaultRowHeight As Double

Property Value

Type Description
Double

A Double value that is the row height in units of measurement that are in effect.

Property Value

Type Description
Double

A Double value that is the row height in units of measurement that are in effect.

Remarks

Use the DefaultRowHeight property to set the height of worksheet rows whose height is not specified explicitly. If you need to set the height of all rows on the worksheet to the same value and override all previously applied row height settings, use the Range.RowHeight property of the Column object corresponding to any column on a worksheet.

For information on how to change the width of worksheet columns, see the How to: Specify Row Height or Column Width example.

Examples

This example demonstrates how to control the row height on a worksheet.

  • Set Height for Individual Rows

    Use the row's Row.Height property or the Range.RowHeight property of the cell or cell range object to set the row height in the workbook's units of measure.

    Note

    If the row height is set to 0, the row is hidden. You can also use the Row.Visible property to hide a row or display the hidden row again (see How to: Show or Hide a Row or Column).

  • AutoFit Row Height

    To automatically change the row height to fit the contents, use the row's Row.AutoFit method. To quickly autofit several rows on a worksheet, use the RowCollection.AutoFit method.

    Use the SpreadsheetCellOptions.AutoFitMergedCellRowHeight property to enable the AutoFit functionality for rows that have cells merged across and containing wrapped text.

  • Match the Height of Two Rows

    To match one row height to another, make their Row.Height property values equal.

  • Set the Default Row Height

    To set the default height for worksheet rows, use the Worksheet.DefaultRowHeight property. This property does not affect rows with an explicitly specified height.

  • Set the Height for All Rows on a Worksheet

    To change the height of all rows on a worksheet, use the Range.RowHeight property of the Column object corresponding to any column on a worksheet. This sets the height of all rows to the same value, overriding all previously applied row height settings.

// Set the height of the 3rd row to 50 points
workbook.Unit = DevExpress.Office.DocumentUnit.Point;
worksheet.Rows[2].Height = 50;

// Set the height of the row that contains the "C5" cell to 2 inches.
workbook.Unit = DevExpress.Office.DocumentUnit.Inch;
worksheet.Cells["C5"].RowHeight = 2;

// Set the height of the 7th row to the height of the 3rd row.
worksheet.Rows["7"].Height = worksheet.Rows["3"].Height;

// Set the default row height to 30 points.
workbook.Unit = DevExpress.Office.DocumentUnit.Point;
worksheet.DefaultRowHeight = 30;
See Also