|
@@ -195,6 +195,9 @@ public class ExportPaperUtil {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // header
|
|
|
+ writePaperHeader(docxTargetDir, paperExp.getCourseName(), docxTemplate);
|
|
|
// content-type
|
|
|
writePaperContentType(docxTargetDir, dto, docxTemplate);
|
|
|
// document
|
|
@@ -204,6 +207,25 @@ public class ExportPaperUtil {
|
|
|
// image file
|
|
|
writeImage(docxTargetDir, dto);
|
|
|
}
|
|
|
+
|
|
|
+ private static void writePaperHeader(File docxTargetDir, String courseName, DocxTemplateBean docxTemplate)
|
|
|
+ throws IOException {
|
|
|
+ Template head=docxTemplate.getHeader();
|
|
|
+ if(head==null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("courseName", courseName);
|
|
|
+ StringWriter result = null;
|
|
|
+ try {
|
|
|
+ result = new StringWriter();
|
|
|
+ head.process(map, result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ExamCloudRuntimeException(e);
|
|
|
+ }
|
|
|
+ File file = new File(docxTargetDir.getAbsolutePath() + "/word/header1.xml");
|
|
|
+ FileUtils.writeStringToFile(file, result.toString(), "utf-8");
|
|
|
+ }
|
|
|
|
|
|
private static void writePaperDocument(File docxTargetDir, PaperExp paperExp, DocxTemplateBean docxTemplate)
|
|
|
throws IOException {
|