using system;
using system.collections.generic;
using system.linq;
using system.web;
using system.io;
using system.text;
using npoi.hssf.usermodel;
using system.reflection;
///< script >
/// function ff()
///,
/// error: function(data)
/// });
///}
//////
///
///
public fileresult upload()
if (extentsfilename.contains(extenfilename.tolower()));}
else;}
}else;}
}/// /// 匯入
///
/// public int import()
///
/// scope.complete();
/// }
/// return i;
/// }
///
///
/// 字典集合 execl標題=》物件屬性
/// 物件集合
public listimportexcel(dictionarydic) where t : class, new()
}for (var j = 1; j <= sheet.lastrownum; j++)}}
}list.add(t);}}
return list;
}else
}/// /// 匯出
/// 儲存到客戶端的檔名
/// 要匯出的資料集合
/// 字典集合 屬性=》標題
public void exportexcel(string filename, listlist, dictionarydic) where t : class, new()
}//模擬20行20列資料
for (var i = 1; i <= list.count; i++)}}
response.clear();
response.clearheaders();
response.clearcontent();
response.buffer = true;
response.addheader("content-disposition", string.format("attachment; filename=", filename));
response.charset = "gb2312";
response.contentencoding = encoding.getencoding("gb2312");
workbook.write(response.outputstream);
response.flush();
response.close();
}private static object getvalue(string obj, propertyinfo p)
return o;
}}public class fileresult
public string msg
public string url
}
Excel的匯入和匯出
操作excel的依賴的poi包 org.apache.poi poi3.14 org.apache.poi poi ooxml 3.14 org.apache.poi poi ooxml schemas 3.14 匯入檔案的控制層 description 匯入excel資料 author lcy p...
excel匯入匯出
匯出 yii框架中 header content disposition attachment filename 123.xls arr connection createcommand select from recruit queryall array this db get recruit r...
EXCEL匯入匯出
系統管理員登入,系統下資源管理 分機號列表內容匯出 suppresswarnings rawtypes responsebody public jsonobject selectfenjihaoinxitongforexportbyparam requestparam value fenjihao ...