Spread for ASP.NET 8.0 Product Documentation
Aligning Cell Contents

You can set the horizontal or vertical alignment for the contents of a cell or a group of cells.

Cell Alignment

Using the Properties Window

  1. At design time, in the Properties window, select the FpSpread component.
  2. Select the Sheets property.
  3. Click the button to display the SheetView Collection Editor.
  4. Select the Cells collection and then select HorizontalAlign or VerticalAlign under the Misc. section (select the cells or cells).
  5. You can also select a cell or cells and select HorizontalAlign or VerticalAlign (Selected Item drop-down option).
  6. Click Apply and OK.

Using a Shortcut

Set the HorizontalAlign and VerticalAlign properties for the FpSpread object’s Cells property.

Example

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

Using the Spread Designer

  1. Select the Home menu.
  2. Select the cells you wish to change.
  3. Select the appropriate icon in the Alignment section.
  4. Click Apply to apply the changes.
  5. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback