spread6 for asp.net
1.建立一个页面 default.aspx
2.放置控件FpSpread到页面上
3.在PageLoad中加入如下代码。- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- InitExcel();
- }
- }
- protected void InitExcel()
- {
- FpSpread1.Sheets[0].Reset();
- FpSpread1.Sheets[0].Rows.Count = 60; //指定行数
- FpSpread1.Sheets[0].ColumnCount = 8; //指定列数
- FpSpread1.Sheets[0].Cells[0, 0].Value = "客户信息";
- FpSpread1.Sheets[0].Cells[1, 0].Value = "客户名称";
- FpSpread1.Sheets[0].Cells[1, 4].Value = "助记码";
- FpSpread1.Sheets[0].Cells[2, 0].Value = "建档日期";
- FpSpread1.Sheets[0].Cells[2, 4].Value = "客户来源";
- FpSpread1.Sheets[0].Cells[3, 0].Value = "客户类别";
- FpSpread1.Sheets[0].Cells[3, 4].Value = "价值评估";
- FpSpread1.Sheets[0].Cells[4, 0].Value = "信用等级";
- FpSpread1.Sheets[0].Cells[4, 4].Value = "所属行业";
- FpSpread1.Sheets[0].Cells[5, 0].Value = "关系等级";
- FpSpread1.Sheets[0].Cells[5, 4].Value = "人员规模";
- FpSpread1.Sheets[0].Cells[6, 0].Value = "所属国家";
- FpSpread1.Sheets[0].Cells[6, 4].Value = "邮编";
- FpSpread1.Sheets[0].Cells[7, 0].Value = "地址";
- FpSpread1.Sheets[0].Cells[8, 0].Value = "电话1";
- FpSpread1.Sheets[0].Cells[8, 4].Value = "电话2";
- FpSpread1.Sheets[0].Cells[8, 0].Value = "电话3";
- FpSpread1.Sheets[0].Cells[8, 4].Value = "传真";
- FpSpread1.Sheets[0].Cells[9, 0].Value = "网址";
- FpSpread1.Sheets[0].Cells[10, 0].Value = "备注";
- FpSpread1.Sheets[0].Cells[11, 0].Value = "录入人";
- FpSpread1.Sheets[0].Cells[11, 4].Value = "录入时间";
- }
复制代码 运行后只能显示10行,录入人和录入时间不能显示出来。 |
|