【セル型】 テキスト型セルで入力文字数制限、省略記号(...)の表示、IMEモード、パスワード属性の設定を行いたい。

文書番号 : 22179     文書種別 : 使用方法     最終更新日 : 2006/07/04
文書を印刷する
対象製品
SPREAD for .NET 2.5J Web Forms Edition
詳細
テキスト型セルの以下のプロパティで入力文字数制限、省略記号(...)の表示、IMEモード、パスワード属性の設定を行うことができます。

・MaxLength プロパティ : 入力可能な最大文字数の設定
・ShowEllipsis プロパティ : 省略記号(...)を表示
・Password プロパティ : パスワード属性の設定
・ImeMode プロパティ : IMEモード(ime-mode)の設定


【VB サンプルコード】
    ' A1セルの最大文字数を3に設定
    Dim t1 As New FarPoint.Web.Spread.TextCellType
    t1.MaxLength = 3
    FpSpread1.ActiveSheetView.Cells(0, 0).CellType = t1

    ' A2セルに省略記号(...)を表示
    Dim t2 As New FarPoint.Web.Spread.TextCellType
    t2.ShowEllipsis = True
    t2.AllowWrap = False
    FpSpread1.ActiveSheetView.Cells(1, 0).CellType = t2
    FpSpread1.ActiveSheetView.Cells(1, 0).Value = "長い文字列のため、省略記号(...)を表示します"

    ' B1セルにパスワード属性を設定
    Dim t3 As New FarPoint.Web.Spread.TextCellType
    t3.Password = True
    FpSpread1.ActiveSheetView.Cells(0, 1).CellType = t3

    ' B2セルのImeModeをDisabledに設定
    Dim t4 As New FarPoint.Web.Spread.TextCellType
    t4.ImeMode = FarPoint.Web.Spread.ImeMode.Disabled
    FpSpread1.ActiveSheetView.Cells(1, 1).CellType = t4

【C# サンプルコード】
      // A1セルの最大文字数を3に設定
      FarPoint.Web.Spread.TextCellType t1 = new FarPoint.Web.Spread.TextCellType();
      t1.MaxLength = 3;
      FpSpread1.ActiveSheetView.Cells[0, 0].CellType = t1;

      // A2セルに省略記号(...)を表示
      FarPoint.Web.Spread.TextCellType t2 = new FarPoint.Web.Spread.TextCellType();
      t2.ShowEllipsis = true;
      t2.AllowWrap = false;
      FpSpread1.ActiveSheetView.Cells[1, 0].CellType = t2;
      FpSpread1.ActiveSheetView.Cells[1, 0].Value = "長い文字列のため、省略記号(...)を表示します";

      // B1セルにパスワード属性を設定
      FarPoint.Web.Spread.TextCellType t3 = new FarPoint.Web.Spread.TextCellType();
      t3.Password = true;
      FpSpread1.ActiveSheetView.Cells[0, 1].CellType = t3;

      // B2セルのImeModeをDisabledに設定
      FarPoint.Web.Spread.TextCellType t4 = new FarPoint.Web.Spread.TextCellType();
      t4.ImeMode = FarPoint.Web.Spread.ImeMode.Disabled;
      FpSpread1.ActiveSheetView.Cells[1, 1].CellType = t4;
キーワード
セル型

この文書は、以前は次のFAQ IDで公開されていました : 9426