private void Form1_Load(object sender, System.EventArgs e)
{
fpSpread1.ActiveSheet.RowCount = 5;
fpSpread1.ActiveSheet.ColumnCount = 5;
fpSpread1.ActiveSheet.Rows[0].BackColor = Color.LemonChiffon;
fpSpread1.ActiveSheet.Rows[1].BackColor = Color.LightCyan;
fpSpread1.ActiveSheet.Rows[2].BackColor = Color.LightPink;
fpSpread1.ActiveSheet.Rows[3].BackColor = Color.LightGreen;
fpSpread1.ActiveSheet.Rows[4].BackColor = Color.LightCoral;
fpSpread1.ActiveSheet.Rows[0].Label = "行1";
fpSpread1.ActiveSheet.Rows[1].Label = "行2";
fpSpread1.ActiveSheet.Rows[2].Label = "行3";
fpSpread1.ActiveSheet.Rows[3].Label = "行4";
fpSpread1.ActiveSheet.Rows[4].Label = "行5";
fpSpread1.ActiveSheet.Columns[0].Label = "列1";
fpSpread1.ActiveSheet.Columns[1].Label = "列2";
fpSpread1.ActiveSheet.Columns[2].Label = "列3";
fpSpread1.ActiveSheet.Columns[3].Label = "列4";
fpSpread1.ActiveSheet.Columns[4].Label = "列5";
FarPoint.Win.Spread.Model.CellRange cr = new FarPoint.Win.Spread.Model.CellRange(1, 1, 3, 3);
fpSpread1.ActiveSheet.SetOutlineBorder(cr, new FarPoint.Win.LineBorder(Color.Blue, 2));
fpSpread1.ActiveSheet.Columns[0].Font = new Font("Arial", 12, FontStyle.Bold | FontStyle.Italic);
fpSpread1.ActiveSheet.Columns[0].ForeColor = Color.Blue;
fpSpread1.ActiveSheet.Columns[0].CellType = new FarPoint.Win.Spread.CellType.TextCellType();
fpSpread1.ActiveSheet.SetText(0, 0, "Excel");
fpSpread1.ActiveSheet.AddSpanCell(4, 0, 1, 2);
fpSpread1.ActiveSheet.SetText(4, 0, "SPREAD for .NET");
fpSpread1.ActiveSheet.Columns[1].CellType = new FarPoint.Win.Spread.CellType.DateTimeCellType();
fpSpread1.ActiveSheet.SetColumnWidth(1, 90);
fpSpread1.ActiveSheet.AddSpanCell(1, 1, 2, 1);
fpSpread1.ActiveSheet.SetValue(1, 1, new DateTime(2015, 6, 15));
FarPoint.Win.Spread.CellType.NumberCellType n = new FarPoint.Win.Spread.CellType.NumberCellType();
n.DecimalPlaces = 4;
fpSpread1.ActiveSheet.Columns[2].CellType = n;
fpSpread1.ActiveSheet.SetValue(2, 2, 123.45);
fpSpread1.ActiveSheet.Columns[3].CellType = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
fpSpread1.ActiveSheet.SetValue(3, 3, true);
FarPoint.Win.Spread.CellType.ComboBoxCellType c = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
c.Items = new String[] {"aaa", "bbb", "ccc"};
c.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.Index;
fpSpread1.ActiveSheet.Columns[4].CellType = c;
fpSpread1.ActiveSheet.SetValue(4, 4, 1);
fpSpread1.ActiveSheet.SheetName = "エクスポートされたシート";
}
private void button1_Click(object sender, System.EventArgs e)
{
//xls形式ファイルをカスタム列/行ヘッダを含めてエクスポートします
fpSpread1.SaveExcel("保存ファイルパス名.xls", FarPoint.Excel.ExcelSaveFlags.SaveBothCustomRowAndColumnHeaders);
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
FpSpread1.ActiveSheet.RowCount = 5
FpSpread1.ActiveSheet.ColumnCount = 5
FpSpread1.ActiveSheet.Rows(0).BackColor = Color.LemonChiffon
FpSpread1.ActiveSheet.Rows(1).BackColor = Color.LightCyan
FpSpread1.ActiveSheet.Rows(2).BackColor = Color.LightPink
FpSpread1.ActiveSheet.Rows(3).BackColor = Color.LightGreen
FpSpread1.ActiveSheet.Rows(4).BackColor = Color.LightCoral
FpSpread1.ActiveSheet.Rows(0).Label = "行1"
FpSpread1.ActiveSheet.Rows(1).Label = "行2"
FpSpread1.ActiveSheet.Rows(2).Label = "行3"
FpSpread1.ActiveSheet.Rows(3).Label = "行4"
FpSpread1.ActiveSheet.Rows(4).Label = "行5"
FpSpread1.ActiveSheet.Columns(0).Label = "列1"
FpSpread1.ActiveSheet.Columns(1).Label = "列2"
FpSpread1.ActiveSheet.Columns(2).Label = "列3"
FpSpread1.ActiveSheet.Columns(3).Label = "列4"
FpSpread1.ActiveSheet.Columns(4).Label = "列5"
Dim cr As New FarPoint.Win.Spread.Model.CellRange(1, 1, 3, 3)
FpSpread1.ActiveSheet.SetOutlineBorder(cr, New FarPoint.Win.LineBorder(Color.Blue, 2))
FpSpread1.ActiveSheet.Columns(0).Font = New Font("Arial", 12, FontStyle.Bold Or FontStyle.Italic)
FpSpread1.ActiveSheet.Columns(0).ForeColor = Color.Blue
FpSpread1.ActiveSheet.Columns(0).CellType = New FarPoint.Win.Spread.CellType.TextCellType
FpSpread1.ActiveSheet.SetText(0, 0, "Excel")
FpSpread1.ActiveSheet.AddSpanCell(4, 0, 1, 2)
FpSpread1.ActiveSheet.SetText(4, 0, "SPREAD for .NET")
FpSpread1.ActiveSheet.Columns(1).CellType = New FarPoint.Win.Spread.CellType.DateTimeCellType
FpSpread1.ActiveSheet.SetColumnWidth(1, 90)
FpSpread1.ActiveSheet.AddSpanCell(1, 1, 2, 1)
FpSpread1.ActiveSheet.SetValue(1, 1, New DateTime(2015, 6, 15))
Dim n As New FarPoint.Win.Spread.CellType.NumberCellType
n.DecimalPlaces = 4
FpSpread1.ActiveSheet.Columns(2).CellType = n
FpSpread1.ActiveSheet.SetValue(2, 2, 123.45)
FpSpread1.ActiveSheet.Columns(3).CellType = New FarPoint.Win.Spread.CellType.CheckBoxCellType
FpSpread1.ActiveSheet.SetValue(3, 3, True)
Dim c As New FarPoint.Win.Spread.CellType.ComboBoxCellType
c.Items = New String() {"aaa", "bbb", "ccc"}
c.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.Index
FpSpread1.ActiveSheet.Columns(4).CellType = c
FpSpread1.ActiveSheet.SetValue(4, 4, 1)
FpSpread1.ActiveSheet.SheetName = "エクスポートされたシート"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'xls形式ファイルをカスタム列/行ヘッダを含めてエクスポートします
FpSpread1.SaveExcel("保存ファイルパス名.xls", FarPoint.Excel.ExcelSaveFlags.SaveBothCustomRowAndColumnHeaders)
End Sub