Spread for ASP.NET 10 Product Documentation > Developer's Guide > Customizing the Appearance > Customizing the Appearance of Rows and Columns > Setting the Row Height or Column Width |
You can set the row height or column width as a specified number of pixels. Each sheet uses and lets you set a default size, making all rows or columns in the sheet the same size. You can override that setting by setting the value for individual rows or columns.
You can set the column width with the Width property of the FpSpread component Columns object. You can set the row height with the Height property of the FpSpread component Rows object.
You can also use the DefaultColumnWidth property for the sheet to set the width for all columns in the sheet; use the SetColumnWidth method or use the Column Width property to set the width for a specific column. For row heights, set the DefaultRowHeight property for the sheet to set the height for all the rows in the sheet; use the SetRowHeight method or use the Row Height property to set the height for a specific row.
Users can change the row height or column width by dragging the header lines between rows or columns.
Typically, set the default column width for the sheet and set the width of individual columns on that sheet as needed. Similarly, set the default row height for the sheet and set the height of individual rows on that sheet as needed.
This example code changes the default width of all columns for the first sheet to 50 pixels, but makes the width of the second column 100 pixels.
C# |
Copy Code
|
---|---|
// Set default width to 50, but second column 100.
FpSpread1.Sheets[0].DefaultColumnWidth = 50;
FpSpread1.Sheets[0].Columns[1].Width = 100;
|
VB |
Copy Code
|
---|---|
' Set default width to 50, but second column 100.
FpSpread1.Sheets(0).DefaultColumnWidth = 50
FpSpread1.Sheets(0).Columns(1).Width = 100
|
Set the Width property for a Column object.
This example code sets the width of the second column to 100 pixels.
C# |
Copy Code
|
---|---|
FarPoint.Web.Spread.Column Col1; Col1 = fpSpread1.Sheets[0].Columns[1]; Col1.Width = 100; |
VB |
Copy Code
|
---|---|
Dim Col1 As FarPoint.Web.Spread.Column Col1 = FpSpread1.Sheets(0).Columns(1) Col1.Width = 100 |