展开全部
using System; using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Data;
using Aspose.Cells;
///
///OutFileDao 的摘要说明
///
public class OutFileDao
{
public OutFileDao()
{
//
//TODO: 在此处添加构造函e68a84e8a2ad62616964757a686964616f31333365633835数逻辑
//
}
///
/// 测试程序
///
public static void testOut()
{
DataTable dt = new DataTable();
dt.Columns.Add("name");
dt.Columns.Add("sex");
DataRow dr = dt.NewRow();
dr["name"] = "名称1";
dr["sex"] = "性别1";
dt.Rows.Add(dr);
DataRow dr1 = dt.NewRow();
dr1["name"] = "名称2";
dr1["sex"] = "性别2";
dt.Rows.Add(dr1);
OutFileToDisk(dt, "测试标题", @"d:\测试.xls");
}
///
/// 导出数据到本地
///
/// 要导出的数据
/// 表格标题
/// 保存路径
public static void OutFileToDisk(DataTable dt,string tableName,string path)
{
Workbook workbook = new Workbook(); //工作簿
Worksheet