【テキスト型セル】 セルに入りきらない値を省略表示することは出来ますか?
対象製品
SPREAD for Windows Forms 7.0J
詳細
TextCellTypeクラスメンバであるStringTrimプロパティ(デフォルト値はStringTrimming.None:トリミングなし)の設定によって表示させることができます。また、上記プロパティの設定ではなく、FpSpreadクラスメンバであるTextTipPolicyプロパティの設定により、長過ぎるテキストを含むデータセル上にあるときにポップアップヒントを表示させるかどうかを定義することもできます。
  メモ
◎サンプルコード(VB)
◎サンプルコード(C#)
  メモ
- 折り返し(WordWrap)を有効にしている場合は正しく動作しません。
◎サンプルコード(VB)
Imports FarPoint.Win.Spread.CellType
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'ポップアップヒントポリシー定義
FpSpread1.TextTipPolicy = FarPoint.Win.Spread.TextTipPolicy.Floating
FpSpread1.TextTipDelay = 100
'テキスト型セル定義
Dim t As New TextCellType
t.StringTrim = StringTrimming.EllipsisCharacter
FpSpread1.ActiveSheet.Cells(0, 0).CellType = t
FpSpread1.ActiveSheet.SetText(0, 0, "abcdefghijklmnopqrstu")
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'ポップアップヒントポリシー定義
FpSpread1.TextTipPolicy = FarPoint.Win.Spread.TextTipPolicy.Floating
FpSpread1.TextTipDelay = 100
'テキスト型セル定義
Dim t As New TextCellType
t.StringTrim = StringTrimming.EllipsisCharacter
FpSpread1.ActiveSheet.Cells(0, 0).CellType = t
FpSpread1.ActiveSheet.SetText(0, 0, "abcdefghijklmnopqrstu")
End Sub
◎サンプルコード(C#)
using FarPoint.Win.Spread.CellType;
private void Form1_Load(object sender, System.EventArgs e)
{
//ポップアップヒントポリシー定義
fpSpread1.TextTipPolicy = FarPoint.Win.Spread.TextTipPolicy.Floating;
fpSpread1.TextTipDelay = 100;
//テキスト型セル定義
TextCellType t = new TextCellType();
t.StringTrim = StringTrimming.EllipsisCharacter;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = t;
fpSpread1.ActiveSheet.SetText(0, 0, "abcdefghijklmnopqrstu");
}
private void Form1_Load(object sender, System.EventArgs e)
{
//ポップアップヒントポリシー定義
fpSpread1.TextTipPolicy = FarPoint.Win.Spread.TextTipPolicy.Floating;
fpSpread1.TextTipDelay = 100;
//テキスト型セル定義
TextCellType t = new TextCellType();
t.StringTrim = StringTrimming.EllipsisCharacter;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = t;
fpSpread1.ActiveSheet.SetText(0, 0, "abcdefghijklmnopqrstu");
}
関連情報
キーワード
「テキスト型セル」