当前位置:Gxlcms > PHP教程 > atitit.导出excel的设计查询结果导出为excel的实现java.netphp总结

atitit.导出excel的设计查询结果导出为excel的实现java.netphp总结

时间:2021-07-01 10:21:17 帮助过:11人阅读

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 titlesMap=HtmlX.getTitlesMap(jsppath,"tabid1", "utf-8");

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 titlesMap) {

String fileName=filex.getUUidName()+".xls";

String f=pathx.webAppPath()+"\\uploadf\\"+fileName;

excelUtil.toExcel(titlesMap, list, f);

return "uploadf/"+fileName;

}

人气教程排行