atitit.导出excel的设计查询结果 导出为excel的实现java .net php 总结
1. 主要的流程
查询获得list
读取jsp的table获得标题and 字段的map
toexcel(map,list)
2. 提交的html数据结构_meth=sql dwr 的元数据
_metadata=xxxx
reqDatas....
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
3. 处理代码
prj:wechatadm4prp
Command.reg("export", new Closure2() {
@Override
public Object execute(Object arg0) {
Map m2 = convert2atiormMap(m);
Object sql = new OrmX().convert2sql(JsonX.toJsonStrO88(m2));
Hbx hbx = AaaCfg.IocX.getBean(Hbx.class);
try {
List li = hbx.exe(sql);
Map m3=new HashMap ();
m3.put("size", li.size());
JSONObject metadata = JSONObject.fromObject(m.get("_metadata"));
String jsppath=metadata.getString("titleMapFile");
List
m3.put("url", geneExportExcel(li,titlesMap));
return m3;
} catch (SQLGrammarException e) {
filex.saveLog(sql.toString(), "c:\\e");
throw new RuntimeException(sql.toString(), e);
}
// return s;
}
});
protected Object geneExportExcel(List list, List
String fileName=filex.getUUidName()+".xls";
String f=pathx.webAppPath()+"\\uploadf\\"+fileName;
excelUtil.toExcel(titlesMap, list, f);
return "uploadf/"+fileName;
}