Browse Source

图片转换成文件,直接加入word

tags/v1.1.0
qiujinyang 2 years ago
parent
commit
e41842611a
1 changed files with 14 additions and 11 deletions
  1. +14
    -11
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java

+ 14
- 11
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ReportServiceImpl.java View File

@@ -472,17 +472,20 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp
Image image = null;
//String url = CommonConfig.imageURL + reportInfoVO.getQuestionReportList().get(i).getFileMarkerUrl();
String url = reportInfoVO.getQuestionReportList().get(i).getFileMarkerUrl();
if (new UrlResource(url).exists()) {
image = Image.getInstance(url);
//image.setAlignment(Image.ALIGN_CENTER);
image.scalePercent(10); //依照比例缩放
// image.setAbsolutePosition(400, 600);
// image.scaleToFit(300, 300);//自定义大
} else {
log.error("图片不存在!" + url);
}
if (new UrlResource(url).exists()) {
cell.add(image);
UrlResource urlResource = new UrlResource(url);
boolean exists = urlResource.exists();
// if (exists) {
// image = Image.getInstance(url);
// image.setAlignment(Image.ALIGN_CENTER);
// image.scalePercent(50); //依照比例缩放
// //image.setAbsolutePosition(400, 600);
// image.scaleToFit(50, 50);//自定义大
// } else {
// log.error("图片不存在!" + url);
// }
if (exists) {
File file = urlResource.getFile();
cell.add(file);
} else {
cell.add(new Paragraph(""));
}

Loading…
Cancel
Save