[]
You can specify the cell type for an individual cell, a range of cells, columns, rows, or an entire sheet using named styles. Object Parentage is also applied to the cell type. The closer to the cell level, the higher the precedence.
Create the cell type you want to apply and set it in the CellType property of named style and each object. CellType property can be set for the following objects:
Objects | Class | Property |
---|---|---|
Cell | ||
Column | ||
Row | ||
Alternating rows | ||
Named style |
You can also determine the cell type of the active cell using GetCellType method of SheetView class. You can check the cell type using the typeof operator in Visual Basic and is operator in C#.
This example code sets the cell type for rows, columns and specific cells.
// Set general cell in the entire first row.
fpSpread1.ActiveSheet.Rows[0].CellType = new FarPoint.Win.Spread.CellType.GeneralCellType();
// Set button cell for the entire second column.
FarPoint.Win.Spread.CellType.ButtonCellType buttonCell = new FarPoint.Win.Spread.CellType.ButtonCellType();
buttonCell.Text = "Button";
fpSpread1.ActiveSheet.Columns[1].CellType = buttonCell;
// Set date-time cell only for the first row and first column.
FarPoint.Win.Spread.CellType.DateTimeCellType datecell = new FarPoint.Win.Spread.CellType.DateTimeCellType();
datecell.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = datecell;
fpSpread1.ActiveSheet.Cells[0, 0].Value = System.DateTime.Now;
' Set general cell in the entire first row.
FpSpread1.ActiveSheet.Rows(0).CellType = New FarPoint.Win.Spread.CellType.GeneralCellType()
' Set button cell for the entire second column.
Dim buttonCell As New FarPoint.Win.Spread.CellType.ButtonCellType()
buttonCell.Text = "Button"
FpSpread1.ActiveSheet.Columns(1).CellType = buttonCell
' Set date-time cell only for the first row and first column.
Dim datecell As New FarPoint.Win.Spread.CellType.DateTimeCellType()
datecell.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate
FpSpread1.ActiveSheet.Cells(0, 0).CellType = datecell
FpSpread1.ActiveSheet.Cells(0, 0).Value = System.DateTime.Now
Understanding Cell Type Basics
Understanding How Cell Types Display and Format Data
Understanding How Cell Type Affects Model Data
Working with Editable Cell Types
Working with Graphical Cell Types
Understanding Additional Features of Cell Types
Understanding Cell Type Basics
Understanding How Cell Types Display and Format Data
Understanding How Cell Type Affects Model Data
Working with Editable Cell Types