Set Row Height in Excel Workbook in C#, VB.NET

  • Demo
  • C# source
  • VB.Net source

The sample demonstrates how to set row height in Excel workbook via Spire.XLS.

using Spire.Xls;

namespace SetRowHeight
    class Program
        static void Main(string[] args)
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];
            //set the RowHeight=25 of the first row
            sheet.SetRowHeight(1, 25);

            workbook.SaveToFile("sample.xls", ExcelVersion.Version97to2003);

Imports Spire.Xls

Namespace SetRowHeight
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			Dim workbook As New Workbook()
			Dim sheet As Worksheet = workbook.Worksheets(0)

			'set the RowHeight=25 of the first row
			sheet.SetRowHeight(1, 25)

			workbook.SaveToFile("sample.xls", ExcelVersion.Version97to2003)
		End Sub
	End Class
End Namespace