文档拆分,处理在线编辑docx文件document.xml内容问题。
This commit is contained in:
+16
-4
@@ -237,10 +237,6 @@ public class FileSpiltService {
|
||||
}
|
||||
log.info("下载文档结束=========================================================");
|
||||
}
|
||||
|
||||
// 处理在线编辑文件中,图片拆分问题。
|
||||
splitFileIs = com.jero.common.util.FileUtils.docxModifier(splitFileIs);
|
||||
|
||||
//记录公式自动编号
|
||||
MathNumber mathNumber = new MathNumber();
|
||||
try (InputStream is = splitFileIs;InputStream is1 = splitFileIs1) {
|
||||
@@ -923,6 +919,22 @@ public class FileSpiltService {
|
||||
c.selectPath("./*");
|
||||
while (c.toNextSelection()) {
|
||||
XmlObject o = c.getObject();
|
||||
if(o.getDomNode().getNodeName().equals("mc:AlternateContent")){
|
||||
String str = o.toString();
|
||||
String imgId = "";
|
||||
Pattern pattern = Pattern.compile("r:embed=\"([^\"]+)\"");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
// 查找匹配项
|
||||
if (matcher.find()) {
|
||||
// 提取捕获组中的内容
|
||||
String result = matcher.group(1);
|
||||
imgId = result;
|
||||
}
|
||||
if(StringUtils.isNotBlank(imgId)){
|
||||
imageBundleList.add(imgId);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//如果子元素是<w:drawing>这样的形式,使用CTDrawing保存图片
|
||||
if (o instanceof CTDrawing) {
|
||||
CTDrawing drawing = (CTDrawing) o;
|
||||
|
||||
Reference in New Issue
Block a user