|
@@ -57,6 +57,7 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
|
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
|
|
|
+import org.apache.poi.xwpf.usermodel.XWPFRun;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -1377,6 +1378,7 @@ public class SubInfoExportController extends BaseController {
|
|
year, month, jsddMap.get(key), tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
year, month, jsddMap.get(key), tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
month, "0%", "0%", "0%", lastMonth, "0", "0", "0"));
|
|
month, "0%", "0%", "0%", lastMonth, "0", "0", "0"));
|
|
|
|
+ subjectZhStr.append("\n").append("\t");
|
|
});
|
|
});
|
|
data.put("subjectZhStr", subjectZhStr);
|
|
data.put("subjectZhStr", subjectZhStr);
|
|
|
|
|
|
@@ -1398,6 +1400,7 @@ public class SubInfoExportController extends BaseController {
|
|
month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
));
|
|
));
|
|
|
|
+ scaleZhStr.append("\n").append("\t");
|
|
});
|
|
});
|
|
data.put("scaleZhStr", scaleZhStr);
|
|
data.put("scaleZhStr", scaleZhStr);
|
|
|
|
|
|
@@ -1420,6 +1423,7 @@ public class SubInfoExportController extends BaseController {
|
|
month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
));
|
|
));
|
|
|
|
+ hyZhStr.append("\n").append("\t");
|
|
});
|
|
});
|
|
data.put("hyZhStr", hyZhStr);
|
|
data.put("hyZhStr", hyZhStr);
|
|
// 二、存在问题
|
|
// 二、存在问题
|
|
@@ -1459,8 +1463,9 @@ public class SubInfoExportController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
WordExportUtil.exportWord07(word, data);
|
|
WordExportUtil.exportWord07(word, data);
|
|
|
|
+ addBreakInCell(word.getParagraphs());
|
|
response.setHeader("content-disposition","attachment;filename="+new String("analysis".getBytes(),"ISO8859-1"));
|
|
response.setHeader("content-disposition","attachment;filename="+new String("analysis".getBytes(),"ISO8859-1"));
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
word.write(response.getOutputStream());
|
|
word.write(response.getOutputStream());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1487,6 +1492,24 @@ public class SubInfoExportController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static void addBreakInCell(List<XWPFParagraph> paragraphs) {
|
|
|
|
+ for (XWPFParagraph p : paragraphs) {
|
|
|
|
+ for (XWPFRun run : p.getRuns()) {//XWPFRun对象定义具有一组公共属性的文本区域
|
|
|
|
+ if(run.getText(0)!= null && run.getText(0).contains("\n")) {
|
|
|
|
+ String[] lines = run.getText(0).split("\n");
|
|
|
|
+ if(lines.length > 0) {
|
|
|
|
+ run.setText(lines[0], 0); // set first line into XWPFRun
|
|
|
|
+ for(int i=1;i<lines.length;i++){
|
|
|
|
+ // add break and insert new text
|
|
|
|
+ run.addBreak();//中断
|
|
|
|
+// run.addCarriageReturn();//回车符,但是不起作用
|
|
|
|
+ run.setText(lines[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
private String buildZhData(Map<String, List<LogOperate>> collect) {
|
|
private String buildZhData(Map<String, List<LogOperate>> collect) {
|
|
StringBuilder zhStrBuilder = new StringBuilder();
|
|
StringBuilder zhStrBuilder = new StringBuilder();
|