FineUI 官方论坛
标题:
泛型集合数据输出EXCEL的尝试
[打印本页]
作者:
rental
时间:
2013-10-21 16:44
标题:
泛型集合数据输出EXCEL的尝试
最近利用APPBox3.0 GRID数据直接输出EXCEL的尝试,其中利用了NPOI控件,把源泛型数据投影成中间类,再利用空间直接输出. /// </summary> /// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
IQueryable<Attend> q = DB.Attends
.Include(a => a.User)
.Include(a => a.User.Dept)
.Include(a => a.Checkstate);
.........
var r = q.Select( a => new AttendRptView
{
Workdate = a.Workdate,
DeptName = a.User.Dept.Name,
Name = a.User.ChineseName,
StartTime = (DateTime)a.StartTime,
EndTime = (DateTime)a.EndTime,
StateName = a.Checkstate.StateName
}).ToList();
string[] propertyName = new string[] { "Workdate", "DeptName", "Name", "StartTime", "EndTime", "StateName" };
ExcelHelper<AttendRptView>.ListToExcel(r, "result", propertyName);
}
作者:
erp8@live.cn
时间:
2013-10-21 20:47
正在寻找相关例子,多谢了!
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4