哪位大神有C#WEB项目把数据导出Excel表格的代码

哪位大神有C#WEB项目把数据导出Excel表格的代码在线等挺急的

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Xml;
using System.Net;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel;
using System.Drawing;
using System.Reflection;

namespace Export
{
class Export
{
public bool ExportForAVGTR(System.Data.DataTable AVGTR,string name)
{
//建立Excel对象
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
try
{
app.Visible = false;
Microsoft.Office.Interop.Excel.Workbook xlBook = app.Workbooks.Add(true);
Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlBook.Worksheets[1];
for (int i = 0; i < AVGTR.Columns.Count; i++)
xlSheet.Cells[1, i + 1] = AVGTR.Columns[i].ColumnName.ToString();
for (int i = 0; i < AVGTR.Rows.Count; i++)
{
for (int j = 0; j < AVGTR.Columns.Count; j++)
{
xlSheet.Cells[i + 2, j + 1] = AVGTR.Rows[i][j].ToString();
}
}
xlSheet.Name = name;
xlSheet.Cells.Font.Size = 11;
xlSheet.Cells.Font.FontStyle = FontStyle.Bold;
xlSheet.Cells.Font.Name = "微软雅黑";
xlSheet.Columns.AutoFit();
}
finally
{
app.Visible = true;
}
return true;
}

}

}