清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
class XlsController{ /** * 字符串编码 */ final def encode(String value,String charSet='UTF-8'){ java.net.URLEncoder.encode(value, charSet) } def xlsExportService def i18nKeyList = ['username','nickname'] def exportXls = { def fileName = encode('东明') response.setHeader("Contentdisposition","attachment;filename=${fileName}.xls") response.setContentType("application/vnd.ms-excel") def dataList = personService.list(cache:true) def titleList = i18nKeyList.collect{ key -> message(code:key) } xlsExportService.genForList(dataList,titleList,response.outputStream) } }