private void Form1_Load(object sender, System.EventArgs e)
{
// リッチテキスト文字列の作成
String rtfText = null;
using (RichTextBox temp = new RichTextBox())
{
temp.Text = "ABC" + "\r\n" + "DEF" + "\r\n" + "GHI";
temp.SelectionStart = 0;
temp.SelectionLength = 3;
temp.SelectionColor = Color.Red;
temp.SelectionFont = new Font("MS UI Gothic", 9);
temp.SelectionStart = 4;
temp.SelectionLength = 3;
temp.SelectionColor = Color.Blue;
temp.SelectionFont = new Font("MS UI Gothic", 12);
temp.SelectionStart = 8;
temp.SelectionLength = 3;
temp.SelectionColor = Color.Green;
temp.SelectionFont = new Font("MS UI Gothic", 15);
temp.SelectionStart = 0;
temp.SelectionLength = 12;
temp.SelectionAlignment = HorizontalAlignment.Center;
rtfText = temp.Rtf;
}
// リッチテキスト型セルの定義
FarPoint.Win.Spread.CellType.RichTextCellType rich = new FarPoint.Win.Spread.CellType.RichTextCellType();
rich.Multiline = true;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = rich;
fpSpread1.ActiveSheet.Cells[0, 0].Value = rtfText;
fpSpread1.ActiveSheet.SetRowHeight(0, 80);
}
Private Sub CellType_10_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' リッチテキスト文字列の作成
Dim rtfText As String = String.Empty
Using temp As New RichTextBox()
temp.Text = "ABC" + vbCrLf + "DEF" + vbCrLf + "GHI"
temp.SelectionStart = 0
temp.SelectionLength = 3
temp.SelectionColor = Color.Red
temp.SelectionFont = New Font("MS UI Gothic", 9)
temp.SelectionStart = 4
temp.SelectionLength = 3
temp.SelectionColor = Color.Blue
temp.SelectionFont = New Font("MS UI Gothic", 12)
temp.SelectionStart = 8
temp.SelectionLength = 3
temp.SelectionColor = Color.Green
temp.SelectionFont = New Font("MS UI Gothic", 15)
temp.SelectionStart = 0
temp.SelectionLength = 12
temp.SelectionAlignment = HorizontalAlignment.Center
rtfText = temp.Rtf
End Using
'リッチテキスト型セルの定義
Dim rich As New FarPoint.Win.Spread.CellType.RichTextCellType()
rich.Multiline = True
FpSpread1.ActiveSheet.Cells(0, 0).CellType = rich
FpSpread1.ActiveSheet.Cells(0, 0).Value = rtfText
FpSpread1.ActiveSheet.SetRowHeight(0, 80)
End Sub