update 文档拆分不能识别表格中图片

This commit is contained in:
lijiarao
2024-09-04 16:23:32 +08:00
parent e56e4374f8
commit 42efe8cef6
@@ -1023,13 +1023,20 @@ public class FileSpiltService {
XWPFPictureData pictureData = p.getDocument().getPictureDataByID(pictureId);
String imageName = UUIDUtils.randomUUID10() + pictureData.getFileName();
byte[] bytev = pictureData.getData();
String filepathandname = filePathCos + "/" + imageName;
//String filepathandname = filePathCos + "/" + imageName;
try {
String path = splitUrl+imageName;
//String path = splitUrl+imageName;
// MinioUtil.uploadByte(bytev, filepathandname);
ObsBootUtil.upload(new ByteArrayInputStream(bytev), filepathandname);
String imgCon = path;
String imgConVal = "<img class=\"wordImg\" style=\"width:100%;height:100%\" src=\"" + path + "\">";
InputStream inputStream = new ByteArrayInputStream(bytev);
MultipartFile file = new MockMultipartFile(imageName, imageName,ContentType.APPLICATION_OCTET_STREAM.toString(),inputStream);
String upload = ObsBootUtil.upload(file, "temp");
OSSFile ossFile = new OSSFile();
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
ossFile.setFileName(file.getName());
ossFile.setUrl(upload);
ossFileService.save(ossFile);
String imgCon = splitUrl+upload.replace("temp\\", "");
String imgConVal = "<img class=\"wordImg\" style=\"width:100%;height:100%\" src=\"" + imgCon + "\">";
stringBuilder.append(imgConVal);
} catch (Exception e) {
e.printStackTrace();