Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / TextCellType Class / EditorCssClass Property
Example


In This Topic
    EditorCssClass Property (TextCellType)
    In This Topic
    Gets the editor's CSS class.
    Syntax
    'Declaration
     
    Public Property EditorCssClass As String
    'Usage
     
    Dim instance As TextCellType
    Dim value As String
     
    instance.EditorCssClass = value
     
    value = instance.EditorCssClass
    public string EditorCssClass {get; set;}
    Remarks
    This property allows the user to format values in the cell editor using CSS settings.
    Example
    This example creates a style in a css file and then uses the style with the EditorCssClass property.
    //Content of css file (called CssStyle1):
    .CssStyle1 {
        
          text-align: center;
          font-family: Comic Sans MS !important;      
          font-weight: bold;
          font-size: large;
    }
    
    //Add to ASPX page
    <link href="CssStyle1.css" rel="stylesheet" type="text/css" />
    //Add to button click or other event
    FpSpread1.ActiveSheetView.Cells[0, 0].Value = "TextCellType";
    FpSpread1.ActiveSheetView.Cells[0, 1].Value = "1/1/2012";
    FpSpread1.ActiveSheetView.Cells[0, 2].Value = "2012";
    FpSpread1.ActiveSheetView.Cells[1, 0].Value = "0.7";
    FpSpread1.ActiveSheetView.Cells[1, 1].Value = "10.1";
    FpSpread1.ActiveSheetView.Cells[1, 2].Value = "10.1";
    FpSpread1.ActiveSheetView.Cells[2, 0].Value = "084-04-1269";
    
    FarPoint.Web.Spread.TextCellType text = new FarPoint.Web.Spread.TextCellType();
    text.EditorCssClass = "CssStyle1";
    text.CssClass = "CssStyle1";
    FpSpread1.ActiveSheetView.Cells[0, 0].CellType = text;
    FarPoint.Web.Spread.DateTimeCellType date = new FarPoint.Web.Spread.DateTimeCellType();
    date.EditorCssClass = "CssStyle1";
    FpSpread1.ActiveSheetView.Cells[0, 1].CellType = date;
    FarPoint.Web.Spread.IntegerCellType intc = new FarPoint.Web.Spread.IntegerCellType();
    intc.EditorCssClass = "CssStyle1";
    FpSpread1.ActiveSheetView.Cells[0, 2].CellType = intc;
    FarPoint.Web.Spread.PercentCellType perc = new FarPoint.Web.Spread.PercentCellType();
    perc.EditorCssClass = "CssStyle1";
    FpSpread1.ActiveSheetView.Cells[1, 0].CellType = perc;
    FarPoint.Web.Spread.DoubleCellType douc = new FarPoint.Web.Spread.DoubleCellType();
    douc.EditorCssClass = "CssStyle1";
    FpSpread1.ActiveSheetView.Cells[1, 1].CellType = douc;
    FarPoint.Web.Spread.CurrencyCellType curc = new FarPoint.Web.Spread.CurrencyCellType();
    curc.EditorCssClass = "CssStyle1";
    FpSpread1.ActiveSheetView.Cells[1, 2].CellType = curc;
    FarPoint.Web.Spread.RegExpCellType regc = new FarPoint.Web.Spread.RegExpCellType();
    regc.ErrorMessage = "SSN ( ex, 123-45-6789 )";
    regc.ValidationExpression = "^\\d{3}-\\d{2}-\\d{4}$";
    regc.EditorCssClass = "CssStyle1";
    FpSpread1.ActiveSheetView.Cells[2, 0].CellType = regc;
    'Content of css file (called CssStyle1):
    .CssStyle1 {
        
          text-align: center;
          font-family: Comic Sans MS !important;      
          font-weight: bold;
          font-size: large;
    }
    
    'Add to ASPX page
    <link href="CssStyle1.css" rel="stylesheet" type="text/css" />
    
    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    FpSpread1.ActiveSheetView.Cells(0, 0).Value = "TextCellType"
    FpSpread1.ActiveSheetView.Cells(0, 1).Value = "1/1/2012"
    FpSpread1.ActiveSheetView.Cells(0, 2).Value = "2012"
    FpSpread1.ActiveSheetView.Cells(1, 0).Value = "0.7"
    FpSpread1.ActiveSheetView.Cells(1, 1).Value = "10.1"
    FpSpread1.ActiveSheetView.Cells(1, 2).Value = "10.1"
    FpSpread1.ActiveSheetView.Cells(2, 0).Value = "084-04-1269"
    
    Dim text As New FarPoint.Web.Spread.TextCellType()
    text.EditorCssClass = "CssStyle1"
    text.CssClass = "CssStyle1"
    FpSpread1.ActiveSheetView.Cells(0, 0).CellType = text
    Dim date1 As New FarPoint.Web.Spread.DateTimeCellType()
    date1.EditorCssClass = "CssStyle1"
    FpSpread1.ActiveSheetView.Cells(0, 1).CellType = date1
    Dim intc As New FarPoint.Web.Spread.IntegerCellType()
    intc.EditorCssClass = "CssStyle1"
    FpSpread1.ActiveSheetView.Cells(0, 2).CellType = intc
    Dim perc As New FarPoint.Web.Spread.PercentCellType()
    perc.EditorCssClass = "CssStyle1"
    FpSpread1.ActiveSheetView.Cells(1, 0).CellType = perc
    Dim douc As New FarPoint.Web.Spread.DoubleCellType()
    douc.EditorCssClass = "CssStyle1"
    FpSpread1.ActiveSheetView.Cells(1, 1).CellType = douc
    Dim curc As New FarPoint.Web.Spread.CurrencyCellType()
    curc.EditorCssClass = "CssStyle1"
    FpSpread1.ActiveSheetView.Cells(1, 2).CellType = curc
    Dim regc As New FarPoint.Web.Spread.RegExpCellType()
    regc.ErrorMessage = "SSN ( ex, 123-45-6789 )"
    regc.ValidationExpression = "^\\d{3}-\\d{2}-\\d{4}$"
    regc.EditorCssClass = "CssStyle1"
    FpSpread1.ActiveSheetView.Cells(2, 0).CellType = regc
    End Sub
    See Also