Spread for ASP.NET 10 Product Documentation > Developer's Guide > Customizing the Appearance > Customizing the Appearance of a Cell > Aligning Cell Contents |
You can set the horizontal or vertical alignment for the contents of a cell or a group of cells.
Set the HorizontalAlign and VerticalAlign properties for the FpSpread object’s Cells property.
This example code sets the horizontal alignment of the first cell (A1) to be right-aligned, the vertical alignment of that cell to be top-aligned, and the horizontal alignment of cells from B2 to C3 to be centered.
C# |
Copy Code
|
---|---|
FpSpread1.Sheets[0].Cells[0,0].HorizontalAlign = HorizontalAlign.Right; FpSpread1.Sheets[0].Cells[0,0].VerticalAlign = VerticalAlign.Top; FpSpread1.Sheets[0].Cells[1,1,2,2].HorizontalAlign = HorizontalAlign.Center; |
VB |
Copy Code
|
---|---|
FpSpread1.Sheets(0).Cells(0,0).HorizontalAlign = HorizontalAlign.Right FpSpread1.Sheets(0).Cells(0,0).VerticalAlign = VerticalAlign.Top FpSpread1.Sheets(0).Cells(1,1,2,2).HorizontalAlign = HorizontalAlign.Center |