回复 1楼lypvc的帖子
参考代码如下:
- [C#]
- // 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);
- [Visual Basic]
- ' 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)
复制代码 |