UseCasesDTO useCasesDTO = detail(id);
Map<String, Object> params = MapUtils.beanToMap(useCasesDTO);
InputStream path = getClass().getResourceAsStream("/templates/usecases/UseCasesTemplate.docx");
String fileName = useCasesDTO.getUseCasesName() + System.currentTimeMillis() + ".docx";
String tmpPath =System.currentTimeMillis() + ".docx";
String pdfPath =System.currentTimeMillis() + ".pdf";
String pdfName = useCasesDTO.getUseCasesName() + System.currentTimeMillis() + ".pdf";
try {
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
Configure configure = Configure.builder()
.bind("infoDesc", htmlRenderPolicy)
.bind("basicProcess",htmlRenderPolicy)
.build();
XWPFTemplate template = XWPFTemplate.compile(path, configure).render(params);
FileOutputStream fileOutputStream = new FileOutputStream(tmpPath);
template.writeAndClose(fileOutputStream);
fileOutputStream.close();
catch (Exception e) {
e.printStackTrace();
}