表头遮住数据
接着上面的问题,导出是成功了,但是固定的两行表头会遮住两行datatable里的数据,就是前两行数据就看不到了,请问怎么解决
//添加表头
exportSpread.Sheets[0].ColumnHeader.RowCount = 2;
exportSpread.Sheets[0].ColumnHeader.Columns.Count = 121;
StyleInfo sty = new StyleInfo();
sty.BackColor = Color.DarkGray;
// sty.Font.Bold = true;
exportSpread.Sheets[0].ColumnHeader.DefaultStyle = sty;
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 0, 1, 7);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 0].Text = "企业基本信息";
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 7, 1, 11);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 7].Text = "项目基本信息";
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 18, 1, 12);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 18].Text = "投资情况(项目总投资)";
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 30, 1, 12);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 30].Text = "投资情况(上年累计完成投资)";
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 42, 1, 12);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 42].Text = "投资情况(本年度完成投资)";
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 54, 1, 31);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 54].Text = "建设内容及规模(建设规模)";
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 85, 1, 31);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 85].Text = "建设内容及规模(新增能力)";
exportSpread.Sheets[0].AddColumnHeaderSpanCell(0, 116, 1, 5);
exportSpread.Sheets[0].ColumnHeader.Cells[0, 116].Text = "其它信息";
string[] tmp = header.Split(',');
for (int i = 0 ; i < tmp.Length ; i++)
{
exportSpread.Sheets[0].ColumnHeader.Cells[1, i].Text = tmp;
}
exportSpread.Sheets[0].ColumnHeader.Rows[1].Height = 15;
exportSpread.Sheets[0].Protect = false;
//获取全部数据
DataTable dt = BasicInfoManage.GetSelCorpInfoByValue(usersql);
exportSpread.DataSource = dt;
截图如附件,本来有11条数据的,现在只能看到9条了 |
|