A label cell is a cell that cannot be edited by the end user and serves as a label for other cells.
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
- Define the label cell type by creating an instance of the LabelCellType class.
- Format and specify the text to appear as the label.
- 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
- In the work area, select the cell or cells for which you want to set the cell type.
- Select the Home menu.
- Select the SetCellType icon under the CellType section.
- Select the cell type and any other cell properties.
- Select OK to close the dialog.
- Click Apply and Exit to close the Spread Designer.