MESCIUS SPREAD for Windows Forms 15.0J
GetColumnHeaderSpanCell メソッド
使用例 

セルの行インデックス
セルの列インデックス
シート上の列ヘッダの指定されたセルで連結されているセル範囲を取得します。
構文
'宣言
 
Public Overridable Function GetColumnHeaderSpanCell( _
   ByVal row As Integer, _
   ByVal column As Integer _
) As CellRange
public virtual CellRange GetColumnHeaderSpanCell( 
   int row,
   int column
)

パラメータ

row
セルの行インデックス
column
セルの列インデックス

戻り値の型

セル結合情報を含むCellRangeオブジェクト。セル結合が存在しない場合はnull。
使用例
次のサンプルコードは、GetColumnHeaderSpanCellメソッドを使用します。
private void Form1_Load(object sender, EventArgs e)
        {
            // Set the number of rows in the column header.
            fpSpread1.ActiveSheet.ColumnHeader.RowCount = 3;
            // Set the number of columns in the row header.
            fpSpread1.ActiveSheet.RowHeader.ColumnCount = 2;
            // Define the labels for the spanned column header cells.
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 0].Text = "East";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 1].Text = "West";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 2].Text = "East";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 3].Text = "West";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 4].Text = "East";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 5].Text = "West";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 6].Text = "East";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[2, 7].Text = "West";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 0].Text = "1st Quarter";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 2].Text = "2nd Quarter";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 4].Text = "3rd Quarter";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[1, 6].Text = "4th Quarter";
            fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Text = "Fiscal Year 2004";
            // Define the column header cell spans.
            fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 0, 1, 2);
            fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 2, 1, 2);
            fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 4, 1, 2);
            fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 6, 1, 2);
            fpSpread1.ActiveSheet.AddColumnHeaderSpanCell(0, 0, 1, 8);
            // Define the label for the spanned row header cells.
            fpSpread1.ActiveSheet.RowHeader.Cells[0, 0].Text = "Branch #";
            // Define the row header cell span.
            fpSpread1.ActiveSheet.AddRowHeaderSpanCell(0, 0, 12, 1);
        }               

        private void button1_Click(object sender, EventArgs e)
        {
        FarPoint.Win.Spread.Model.CellRange cr;
        cr = fpSpread1.Sheets[0].GetColumnHeaderSpanCell(0, 0);
        listBox1.Items.Add(cr.ColumnCount.ToString());            
        }
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load       
        ' Set the number of rows in the column header.
        FpSpread1.ActiveSheet.ColumnHeader.RowCount = 3
        ' Set the number of columns in the row header.
        FpSpread1.ActiveSheet.RowHeader.ColumnCount = 2
        ' Define the labels for the spanned column header cells.
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 0).Text = "East"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 1).Text = "West"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 2).Text = "East"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 3).Text = "West"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 4).Text = "East"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 5).Text = "West"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 6).Text = "East"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(2, 7).Text = "West"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(1, 0).Text = "1st Quarter"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(1, 2).Text = "2nd Quarter"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(1, 4).Text = "3rd Quarter"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(1, 6).Text = "4th Quarter"
        FpSpread1.ActiveSheet.ColumnHeader.Cells(0, 0).Text = "Fiscal Year 2004"
        ' Define the column header cell spans.
        FpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 0, 1, 2)
        FpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 2, 1, 2)
        FpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 4, 1, 2)
        FpSpread1.ActiveSheet.AddColumnHeaderSpanCell(1, 6, 1, 2)
        FpSpread1.ActiveSheet.AddColumnHeaderSpanCell(0, 0, 1, 8)
        ' Define the label for the spanned row header cells.
        FpSpread1.ActiveSheet.RowHeader.Cells(0, 0).Text = "Branch #"
        ' Define the row header cell span.
        FpSpread1.ActiveSheet.AddRowHeaderSpanCell(0, 0, 12, 1)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cr As FarPoint.Win.Spread.Model.CellRange
        cr = FpSpread1.Sheets(0).GetColumnHeaderSpanCell(0, 0)
        ListBox1.Items.Add(cr.ColumnCount.ToString())
    End Sub
参照

SheetView クラス
SheetView メンバ

 

 


© MESCIUS inc. All rights reserved.