更改保存方式

This commit is contained in:
付庆吉
2021-08-20 17:08:26 +08:00
parent ba8b916278
commit 071e4151fc

View File

@ -106,7 +106,7 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
} }
//保存合并后的文档 //保存合并后的文档
d1.saveToFile(path + "/merged.docx", FileFormat.Docx_2010); d1.saveToFile(path + "merged.docx", FileFormat.Docx_2010);
//转为pdf //转为pdf
long l = System.currentTimeMillis(); long l = System.currentTimeMillis();
@ -114,11 +114,11 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
return null; return null;
} }
File f = new File(path + "/merged.pdf"); File f = new File(path + "merged.pdf");
FileOutputStream fos = new FileOutputStream(f); FileOutputStream fos = new FileOutputStream(f);
try { try {
com.aspose.words.Document doc = new com.aspose.words.Document(path + "/merged.docx"); com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx");
doc.save(fos, SaveFormat.PDF); doc.save(fos, SaveFormat.PDF);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -187,7 +187,7 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
XWPFTemplate template = XWPFTemplate.compile(file).render(all); XWPFTemplate template = XWPFTemplate.compile(file).render(all);
FileInputStream fis = null; FileInputStream fis = null;
try { try {
String docPath = path + "/expertSignature.docx"; String docPath = path + "expertSignature.docx";
template.writeToFile(docPath); template.writeToFile(docPath);
fis = new FileInputStream(new File(docPath)); fis = new FileInputStream(new File(docPath));