@Action(value="/export-exportDiagram",results={
/*@Result(name="getAllRule",location="/rule_list.jsp")*/
})
public void exportDiagram() throws ParseException, TemplateNotFoundException, MalformedTemplateNameException, freemarker.core.ParseException, IOException{
ExportWordAction e1 =new ExportWordAction();
String jsondata1=java.net.URLDecoder.decode(jsondata,"utf-8");
ifFirefox=java.net.URLDecoder.decode(ifFirefox,"utf-8");
path=java.net.URLDecoder.decode(path,"utf-8");
//System.out.println("jsondata1:"+jsondata1);
//System.out.println("ifFirefox1:"+ifFirefox+" path1:"+path);
JSONObject json = JSONObject.parseObject(jsondata1);
String startTime = json.getString("startTime");
String endTime = json.getString("endTime");
//String pm25ValueAndSTD = json.getString("pm25ValueAndSTD");
String familyValueAndSTD = json.getString("familyValueAndSTD");
String officeValueAndSTD = json.getString("officeValueAndSTD");
String outValueAndSTD = json.getString("outValueAndSTD");
String objectName = json.getString("objName");
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
Calendar cal=Calendar.getInstance();
Date startDate = sdf.parse( startTime );
cal.setTime(startDate);
int startYear = cal.get(Calendar.YEAR); //获取年
int startMonth = cal.get(Calendar.MONTH) + 1; //获取月份,0表示1月份
int startDay = cal.get(Calendar.DAY_OF_MONTH); //获取当前天数
Date endDate = sdf.parse(endTime);
cal.setTime(endDate);
int endYear = cal.get(Calendar.YEAR); //获取年
int endMonth = cal.get(Calendar.MONTH) + 1; //获取月份,0表示1月份
int endDay = cal.get(Calendar.DAY_OF_MONTH); //获取当前天数
//获取系统时间
cal.setTime(new Date());
int sysYear = cal.get(Calendar.YEAR);
int sysMonth = cal.get(Calendar.MONTH) + 1;
int sysDay = cal.get(Calendar.DAY_OF_MONTH);
Map<String, Object> ma
java导出word带图片之后台
最新推荐文章于 2024-08-01 16:22:39 发布
这篇博客介绍了如何在Java后台生成Word文档并插入图片。通过`getImageStr`方法获取图片字节流,利用BASE64编码转换为字符串。同时提供`deleteDirectory`和`deleteFile`方法用于删除文件或文件夹,确保资源的有效管理。
摘要由CSDN通过智能技术生成