彩票走势图

如何在Spread ASP.NET中创建多行列表头

原创|其它|编辑:郝浩|2012-11-12 11:55:53.000|阅读 434 次

概述:主要讲解在Spread ASP.NET中创建多行列表头,附加源码

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

Spread ASP.NET中可以轻松的创建如下所示的多个行以及多个列的表头:

如何在Spread ASP.NET中创建多行列表头

当然你可以直接在属性窗口中操作完成类似面的效果,如下所示的步骤:

  1. 在运行时,在设计窗口中选择FpSpread控件;
  2. 选择Sheets 属性;
  3. 点击Sheet按钮来出现SheetView Collection编辑器;
  4. 选择点击你想要改变行列数的Sheet;
  5. 在列头的行列属性中设置你想要的在表头中出现的行列数;
  6. 关闭编辑器。

现在我们一起来看看后台的代码是如何实现上图的效果,每列有两行子列,一共有三行:

代码如下:

C#

FpSpread1.Sheets[0].ColumnCount = 8;
FpSpread1.Sheets[0].RowCount = 8;
// Set the number or rows and columns in the headers.
FpSpread1.Sheets[0].ColumnHeader.RowCount = 3;
FpSpread1.Sheets[0].RowHeader.ColumnCount = 2;

// Span the header cells as needed.
FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(0, 0, 1, 8);
FpSpread1.Sheets[0].RowHeaderSpanModel.Add(0,0,12,1);

FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(1, 0, 1, 2);
FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(1, 2, 1, 2);
FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(1, 4, 1, 2);
FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(1, 6, 1, 2);
FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(1, 8, 1, 2);

// Set the labels as needed --
// using the Label property or the cell Text property.
FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "Fiscal Year 2005";
FpSpread1.Sheets[0].RowHeader.Cells[0, 0].Text = "Branch #";

FpSpread1.Sheets[0].ColumnHeader.Cells[1, 0].Text = "1st Quarter";
FpSpread1.Sheets[0].ColumnHeader.Cells[1, 2].Text = "2nd Quarter";
FpSpread1.Sheets[0].ColumnHeader.Cells[1, 4].Text = "3rd Quarter";
FpSpread1.Sheets[0].ColumnHeader.Cells[1, 6].Text = "4th Quarter";

FpSpread1.Sheets[0].ColumnHeader.Cells[2, 0].Text = "East";
FpSpread1.Sheets[0].ColumnHeader.Cells[2, 1].Text = "West";
FpSpread1.Sheets[0].ColumnHeader.Cells[2, 2].Text = "East";
FpSpread1.Sheets[0].ColumnHeader.Cells[2, 3].Text = "West";
FpSpread1.Sheets[0].ColumnHeader.Cells[2, 4].Text = "East";
FpSpread1.Sheets[0].ColumnHeader.Cells[2, 5].Text = "West";
FpSpread1.Sheets[0].ColumnHeader.Cells[2, 6].Text = "East";
FpSpread1.Sheets[0].ColumnHeader.Cells[2, 7].Text = "West";  

VB

FpSpread1.Sheets(0).RowCount = 8
FpSpread1.Sheets(0).ColumnCount = 8
’ Set the number or rows and columns in the headers.
FpSpread1.Sheets(0).ColumnHeader.RowCount = 3
FpSpread1.Sheets(0).RowHeader.ColumnCount = 2
 
' Span the header cells as needed.
FpSpread1.Sheets(0).ColumnHeaderSpanModel.Add(0, 0, 1, 8)
FpSpread1.Sheets(0).RowHeaderSpanModel.Add(0,0,12,1)
 
FpSpread1.Sheets(0).ColumnHeaderSpanModel.Add(1, 0, 1, 2)
FpSpread1.Sheets(0).ColumnHeaderSpanModel.Add(1, 2, 1, 2)
FpSpread1.Sheets(0).ColumnHeaderSpanModel.Add(1, 4, 1, 2)
FpSpread1.Sheets(0).ColumnHeaderSpanModel.Add(1, 6, 1, 2)
FpSpread1.Sheets(0).ColumnHeaderSpanModel.Add(1, 8, 1, 2)
 
' Set the labels as needed -- 
' using the Label property or the cell Text property.
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 0).Text = "Fiscal Year 2005"
FpSpread1.Sheets(0).RowHeader.Cells(0, 0).Text = "Branch #"
 
FpSpread1.Sheets(0).ColumnHeader.Cells(1, 0).Text = "1st Quarter"
FpSpread1.Sheets(0).ColumnHeader.Cells(1, 2).Text = "2nd Quarter"
FpSpread1.Sheets(0).ColumnHeader.Cells(1, 4).Text = "3rd Quarter"
FpSpread1.Sheets(0).ColumnHeader.Cells(1, 6).Text = "4th Quarter"
 
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 0).Text = "East"
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 1).Text = "West"
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 2).Text = "East"
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 3).Text = "West"
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 4).Text = "East"
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 5).Text = "West"
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 6).Text = "East"
FpSpread1.Sheets(0).ColumnHeader.Cells(2, 7).Text = "West"

标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP