PowerTools SPREAD for ASP.NET 8.0J
EditorCssClass プロパティ (TextCellType)

エディタのCSSクラスを取得します。
構文
'Declaration
 
Public Property EditorCssClass As String
public string EditorCssClass {get; set;}
解説
このプロパティを使用することで、CSS設定を使用してセルエディタの値を書式設定できます。
次のサンプルコードは、CSSファイルにスタイルを作成し、そのスタイルをEditorCssClassプロパティで使用します。
//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
protected void Button1_Click(object sender, EventArgs e)
{
    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
参照

TextCellType クラス
TextCellType メンバ

 

 


© 2003-2015, GrapeCity inc. All rights reserved.