feat: 1997-2003版本doc文件图片拆分

This commit is contained in:
2024-09-07 13:48:40 +08:00
parent f756d21478
commit 77b2228370
@@ -362,10 +362,12 @@ public class FileSpiltService {
if (CollectionUtils.isNotEmpty(titleNumberMap.get(paragraphString))){ if (CollectionUtils.isNotEmpty(titleNumberMap.get(paragraphString))){
replaceNumberFlag = true; replaceNumberFlag = true;
List<String> stringList = titleNumberMap.get(paragraphString); List<String> stringList = titleNumberMap.get(paragraphString);
replaceNumber = stringList.get(0); if(CollectionUtils.isNotEmpty(stringList)){
//replaceNumber = titleNumberMap.get(paragraphString); replaceNumber = stringList.get(0);
paragraphString = replaceNumber + paragraphString; //replaceNumber = titleNumberMap.get(paragraphString);
stringList.remove(0); paragraphString = replaceNumber + paragraphString;
stringList.remove(0);
}
} }
} }
String startDigit; String startDigit;
@@ -679,6 +681,22 @@ public class FileSpiltService {
c.selectPath("./*"); c.selectPath("./*");
while (c.toNextSelection()) { while (c.toNextSelection()) {
XmlObject o = c.getObject(); XmlObject o = c.getObject();
if(o.getDomNode().getNodeName().equals("w:pict")){
String str = o.toString();
String imgId = "";
Pattern pattern = Pattern.compile("v:imagedata r:id=\"([^\"]+)\"");
Matcher matcher = pattern.matcher(str);
// 查找匹配项
if (matcher.find()) {
// 提取捕获组中的内容
String result = matcher.group(1);
imgId = result;
}
if(StringUtils.isNotBlank(imgId)){
imageBundleList.add(imgId);
continue;
}
}
if(o.getDomNode().getNodeName().equals("mc:AlternateContent")){ if(o.getDomNode().getNodeName().equals("mc:AlternateContent")){
String str = o.toString(); String str = o.toString();
String imgId = ""; String imgId = "";