You can set the height of the rows and the width of the columns in a worksheet as per your preferences by using the UseStandardHeight property and UseStandardWidth property of the IRange interface respectively.
You can use the ColumnWidth property to set custom width in characters for the individual columns of a range. In order to set custom width in pixels, you can use the ColumnWidthInPixel property of the IRange interface.
You can also set custom height of the individual rows of a range in points and in pixels by using the RowHeight property and RowHeightInPixel property of the IRange interface.
In order to specify custom total height and total width, you can use the Height (in points), HeightInPixel (in pixels), Width (in characters) and WidthInPixel (in pixels) properties of the IRange interface.
Refer to the following example code in order to customize the row height and column width in a worksheet.
C# |
Copy Code |
---|---|
//set row height for row 1:2. worksheet.Range["1:2"].RowHeight = 50; //set column width for column C:D. worksheet.Range["C:D"].ColumnWidth = 20; |