.
This commit is contained in:
@@ -27,11 +27,14 @@ public class MetaRender implements HttpRender<HttpScope> {
|
||||
List list = (List) attr.get("data");
|
||||
Kv heads = (Kv) attr.get("heads");
|
||||
String fileName = (String) attr.get("fileName");
|
||||
if (!fileName.endsWith(".xls")) {
|
||||
fileName += ".xls";
|
||||
}
|
||||
|
||||
try {
|
||||
Workbook workbook = ExcelKit.exportExcel(list, heads);
|
||||
|
||||
File file = new File(String.format("tmp/%s.xls", fileName));
|
||||
File file = new File(String.format("tmp/%s", fileName));
|
||||
file.getParentFile().mkdirs();
|
||||
if (file.exists()) file.delete();
|
||||
|
||||
@@ -43,7 +46,7 @@ public class MetaRender implements HttpRender<HttpScope> {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.finish(file);
|
||||
response.finish(fileName, file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user