Spread for ASP.NET 11 Product Documentation
Setting a Label Cell
Spread for ASP.NET 11 Product Documentation > Developer's Guide > Customizing with Cell Types > Working with Graphical Cell Types > Setting a Label Cell

A label cell is a cell that cannot be edited by the end user and serves as a label for other cells.

Label Cell

To create a cell that contains a label, follow this procedure.

For details on the properties and methods for this cell type, refer to the LabelCellType class in the Assembly Reference.

Using Code

  1. Define the label cell type by creating an instance of the LabelCellType class.
  2. Format and specify the text to appear as the label.
  3. Assign the label cell type to a cell.

Example

This example creates a label cell that displays a currency value.

C#
Copy Code
FarPoint.Web.Spread.LabelCellType lblcell = new FarPoint.Web.Spread.LabelCellType();
int i =100;
string fstring = i.ToString("C");
lblcell.FormatString = fstring;
FpSpread1.ActiveSheetView.Cells[0, 0].CellType = lblcell;
FpSpread1.ActiveSheetView.Cells[0, 0].Text = fstring; 
VB
Copy Code
Dim lblcell As New FarPoint.Web.Spread.LabelCellType()
Dim i As Integer = 100
Dim fstring As String = i.ToString("C")
lblcell.FormatString = fstring
FpSpread1.ActiveSheetView.Cells(0, 0).CellType = lblcell
FpSpread1.ActiveSheetView.Cells(0, 0).Text = fstring 

Using the Spread Designer

  1. In the work area, select the cell or cells for which you want to set the cell type.
  2. Select the Home menu.
  3. Select the SetCellType icon under the CellType section.
  4. Select the cell type and any other cell properties.
  5. Select OK to close the dialog.
  6. Click Apply and Exit to close the Spread Designer.
See Also