文字列の折り返し方法を指定したい
対象製品
SPREAD for Windows Forms 8.0J
詳細
GcTextBox型セルのWrapModeプロパティにて、文字列の折り返し方法を指定(単語単位または文字単位)することができます。
◎サンプルコード(VB)
◎サンプルコード(C#)
◎サンプルコード(VB)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 単語単位で折り返し
Dim gctcww As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctcww.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.WordWrap
gctcww.Multiline = True
FpSpread1.ActiveSheet.Columns(0).CellType = gctcww
' 文字単位で折り返し
Dim gctccw As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctccw.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.CharWrap
gctccw.Multiline = True
FpSpread1.ActiveSheet.Columns(1).CellType = gctccw
' テストデータの設定
FpSpread1.ActiveSheet.Cells(0, 0).Value = "Your automobile is very expensive."
FpSpread1.ActiveSheet.Cells(0, 1).Value = "Your automobile is very expensive."
FpSpread1.ActiveSheet.Rows(0).Height = 60
End Sub
' 単語単位で折り返し
Dim gctcww As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctcww.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.WordWrap
gctcww.Multiline = True
FpSpread1.ActiveSheet.Columns(0).CellType = gctcww
' 文字単位で折り返し
Dim gctccw As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctccw.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.CharWrap
gctccw.Multiline = True
FpSpread1.ActiveSheet.Columns(1).CellType = gctccw
' テストデータの設定
FpSpread1.ActiveSheet.Cells(0, 0).Value = "Your automobile is very expensive."
FpSpread1.ActiveSheet.Cells(0, 1).Value = "Your automobile is very expensive."
FpSpread1.ActiveSheet.Rows(0).Height = 60
End Sub
◎サンプルコード(C#)
private void Form1_Load(object sender, EventArgs e)
{
// 単語単位で折り返し
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType gctcww = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
gctcww.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.WordWrap;
gctcww.Multiline = true;
fpSpread1.ActiveSheet.Columns[0].CellType = gctcww;
// 文字単位で折り返し
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType gctccw = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
gctccw.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.CharWrap;
gctccw.Multiline = true;
fpSpread1.ActiveSheet.Columns[1].CellType = gctccw;
// テストデータの設定
fpSpread1.ActiveSheet.Cells[0, 0].Value = "Your automobile is very expensive.";
fpSpread1.ActiveSheet.Cells[0, 1].Value = "Your automobile is very expensive.";
fpSpread1.ActiveSheet.Rows[0].Height = 60;
}
{
// 単語単位で折り返し
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType gctcww = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
gctcww.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.WordWrap;
gctcww.Multiline = true;
fpSpread1.ActiveSheet.Columns[0].CellType = gctcww;
// 文字単位で折り返し
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType gctccw = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
gctccw.WrapMode = GrapeCity.Win.Spread.InputMan.CellType.WrapMode.CharWrap;
gctccw.Multiline = true;
fpSpread1.ActiveSheet.Columns[1].CellType = gctccw;
// テストデータの設定
fpSpread1.ActiveSheet.Cells[0, 0].Value = "Your automobile is very expensive.";
fpSpread1.ActiveSheet.Cells[0, 1].Value = "Your automobile is very expensive.";
fpSpread1.ActiveSheet.Rows[0].Height = 60;
}
キーワード
セル型