1,978
社区成员
发帖
与我相关
我的任务
分享
protected void Button4_Click(object sender, EventArgs e)
{
if (GridView1.Rows.Count == 0)
return;
Microsoft.Office.Interop.Excel.Application Excel = new Microsoft.Office.Interop.Excel.Application();
Excel.Application.Workbooks.Add(true);
Excel.Visible = true;
for (int i = 0; i > GridView1.Columns.Count; i++)
{
Excel.Cells[1, i + 1] = GridView1.Columns[i].HeaderText;
}
for (int i = 0; i > GridView1.Columns.Count; i++)
{
for (int j = 0; j < GridView1.Columns.Count; j++)
{
Excel.Cells[i + 2, j + 1] = GridView1.Rows[i].Cells[j].Text;
}
}
}
protected void Button4_Click(object sender, EventArgs e)
{
if (GridView1.Rows.Count == 0)
return;
Microsoft.Office.Interop.Excel.Application Excel = new Microsoft.Office.Interop.Excel.Application();
Excel.Application.Workbooks.Add(true);
Excel.Visible = true;
for (int i = 0; i < GridView1.Columns.Count; i++)
{
Excel.Cells[1, i + 1] = GridView1.Columns[i].HeaderText;
}
for (int i = 0; i < GridView1.Rows.Count; i++)
{
for (int j = 0; j < GridView1.Columns.Count; j++)
{
Excel.Cells[i + 2, j + 1] = GridView1.Rows[i].Cells[j].Text;
}
}
}
protected void Button4_Click(object sender, EventArgs e)
{
if (GridView1.Rows.Count == 0)
return;
Microsoft.Office.Interop.Excel.Application Excel = new Microsoft.Office.Interop.Excel.Application();
Excel.Application.Workbooks.Add(true);
Excel.Visible = true;
for (int i = 0; i < GridView1.Columns.Count; i++)
{
Excel.Cells[1, i + 1] = GridView1.Columns[i].HeaderText;
}
for (int i = 0; i < GridView1.Rows.Count; i++)
{
for (int j = 0; j < GridView1.Columns.Count; j++)
{
Excel.Cells[i + 2, j + 1] = GridView1.Rows[i].Cells[j].Text;
}
}
}
protected void Button4_Click(object sender, EventArgs e)
{
if (GridView1.Rows.Count == 0)
return;
Microsoft.Office.Interop.Excel.Application Excel = new Microsoft.Office.Interop.Excel.Application();
Excel.Application.Workbooks.Add(true);
Excel.Visible = true;
for (int i = 0; i < GridView1.Columns.Count; i++)
{
Excel.Cells[1, i + 1] = GridView1.Columns[i].HeaderText;
}
for (int i = 0; i < GridView1.Rows.Count; i++)
{
for (int j = 0; j < GridView1.Columns.Count; j++)
{
Excel.Cells[i + 2, j + 1] = GridView1.Rows[i].Cells[j].Text;
}
}
}