Home > Backend Development > PHP Tutorial > atitit.导出excel的设计查询结果 导出为excel的实现java .net php 总结

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

WBOY
Release: 2016-06-23 13:38:36
Original
934 people have browsed it

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;

}

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template