SPREAD for Windows Forms 10.0J サンプルコード集
セル幅より長いテキストを自動的に次の行に折り返す

テキスト型セル(TextCellTypeクラス)のWordWrapプロパティをTrueに設定することで、セル幅より長いテキストを自動的に次の行に折り返すことができます。

【実行例】

自動改行

 private void Form1_Load(object sender, EventArgs e)
 {

   // テキストを自動的に次の行に折り返す
   FarPoint.Win.Spread.CellType.TextCellType txt = new FarPoint.Win.Spread.CellType.TextCellType();
   txt.WordWrap = true;
   fpSpread1.ActiveSheet.Cells[1, 1].CellType = txt;
   fpSpread1.ActiveSheet.Cells[1, 1].Text = "This is a text cell.";

   fpSpread1.ActiveSheet.Rows[1].Height = 40;
   fpSpread1.ActiveSheet.Columns[1].Width = 80;

 }
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

   ' テキストを自動的に次の行に折り返す
   Dim txt As New FarPoint.Win.Spread.CellType.TextCellType()
   txt.WordWrap = True
   FpSpread1.ActiveSheet.Cells(1, 1).CellType = txt
   FpSpread1.ActiveSheet.Cells(1, 1).Text = "This is a text cell."

   FpSpread1.ActiveSheet.Rows(1).Height = 40
   FpSpread1.ActiveSheet.Columns(1).Width = 80

 End Sub

 

 


© 2004-2017, GrapeCity inc. All rights reserved.