if (StringUtils.isEmpty(fileName)) {
fileName = "exportResult";
}
// 配置导出上下文
Context context = new Context();
context.put("format", format);
context.put("exportFile", fileName);
context.put("template", template);
String properties = get("properties");
if (null != properties) {
String[] props = StringUtils.split(properties, ",");
List<String> keys = CollectUtils.newArrayList();
List<String> titles = CollectUtils.newArrayList();
for (String prop : props) {
keys.add(StringUtils.substringBefore(prop, ":"));
titles.add(getTextInternal(StringUtils.substringAfter(prop, ":")));
}
context.put(Context.KEYS, StrUtils.join(keys, ","));
context.put(Context.TITLES, StrUtils.join(titles, ","));
} else {
context.put(Context.KEYS, get("keys"));
context.put(Context.TITLES, get("titles"));
}
context.put(Context.EXTRACTOR, getPropertyExtractor());
HttpServletResponse response = ServletActionContext.getResponse();
Exporter exporter = buildExporter(context);
exporter.getWriter().setOutputStream(response.getOutputStream());
configExporter(exporter, context);