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