fix 文档拆分--公式
This commit is contained in:
@@ -165,10 +165,10 @@
|
|||||||
<artifactId>jeuclid-core</artifactId>
|
<artifactId>jeuclid-core</artifactId>
|
||||||
<version>3.1.9</version>
|
<version>3.1.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!--<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-ooxml-schemas</artifactId>
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
<version>3.17</version>
|
<version>3.17</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
+20
-19
@@ -26,6 +26,7 @@ import org.apache.shiro.SecurityUtils;
|
|||||||
import org.apache.xmlbeans.XmlCursor;
|
import org.apache.xmlbeans.XmlCursor;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject;
|
||||||
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtension;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture;
|
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor;
|
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
|
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
|
||||||
@@ -154,17 +155,17 @@ public class FileSpiltService {
|
|||||||
ZipSecureFile.setMinInflateRatio(-1.0d);
|
ZipSecureFile.setMinInflateRatio(-1.0d);
|
||||||
XWPFDocument doc = new XWPFDocument(is);
|
XWPFDocument doc = new XWPFDocument(is);
|
||||||
// 获取文档中的图片
|
// 获取文档中的图片
|
||||||
//List<XWPFPictureData> allPictures = doc.getAllPictures();
|
List<XWPFPictureData> allPictures = doc.getAllPictures();
|
||||||
//// 遍历图片并处理数学公式
|
// 遍历图片并处理数学公式
|
||||||
//for (XWPFPictureData pictureData : allPictures) {
|
for (XWPFPictureData pictureData : allPictures) {
|
||||||
// String contentType = pictureData.getPackagePart().getContentType();
|
String contentType = pictureData.getPackagePart().getContentType();
|
||||||
// System.out.println(contentType);
|
System.out.println(contentType);
|
||||||
// // 判断图片类型是否为数学公式
|
// 判断图片类型是否为数学公式
|
||||||
// if (contentType.equals(PictureType.EMF.getExtension())) {
|
if (contentType.equals(PictureType.EMF.getExtension())) {
|
||||||
// // 处理数学公式,你可以在这里添加自己的逻辑
|
// 处理数学公式,你可以在这里添加自己的逻辑
|
||||||
// System.out.println("Found a math equation!");
|
System.out.println("Found a math equation!");
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//获得序号标题和无标题序号
|
//获得序号标题和无标题序号
|
||||||
TitleNumberVO titleNumberVO = AsposeUtil.getNumber(is1);
|
TitleNumberVO titleNumberVO = AsposeUtil.getNumber(is1);
|
||||||
//TitleNumberVO titleNumberVO = new TitleNumberVO();
|
//TitleNumberVO titleNumberVO = new TitleNumberVO();
|
||||||
@@ -200,16 +201,16 @@ public class FileSpiltService {
|
|||||||
CTOMath ctoMath = (CTOMath) child;
|
CTOMath ctoMath = (CTOMath) child;
|
||||||
//stringBuilder.append(ctoMath.xmlText());
|
//stringBuilder.append(ctoMath.xmlText());
|
||||||
// 处理word中存在的公式成mathML格式
|
// 处理word中存在的公式成mathML格式
|
||||||
String imageName = OmmlUtils.convertOmathToPng(ctoMath.xmlText());
|
//String imageName = OmmlUtils.convertOmathToPng(ctoMath.xmlText());
|
||||||
if (messageList.size() > 0) {
|
//if (messageList.size() > 0) {
|
||||||
addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, imageName);
|
// addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, imageName);
|
||||||
}
|
//}
|
||||||
} else if (child instanceof CTOMathPara) {
|
} else if (child instanceof CTOMathPara) {
|
||||||
CTOMathPara ctoMathPara = (CTOMathPara) child;
|
CTOMathPara ctoMathPara = (CTOMathPara) child;
|
||||||
String imageName = OmmlUtils.convertOmathToPng(ctoMathPara.xmlText());
|
//String imageName = OmmlUtils.convertOmathToPng(ctoMathPara.xmlText());
|
||||||
if (messageList.size() > 0) {
|
//if (messageList.size() > 0) {
|
||||||
addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, imageName);
|
// addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, imageName);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,8 @@ public class ImageParse {
|
|||||||
super();
|
super();
|
||||||
// this.targetDir = targetDir;
|
// this.targetDir = targetDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String parse(byte[] data, String extName) {
|
public String parse(byte[] data, String extName) {
|
||||||
String imageName = UUIDUtils.randomUUID10() + extName;
|
return parse(new ByteArrayInputStream(data), extName);
|
||||||
|
|
||||||
String filepathandname = filePathCos + "/" + imageName;
|
|
||||||
MinioUtil.uploadByte(data, filepathandname);
|
|
||||||
return imageName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String parse(InputStream in, String extName) {
|
public String parse(InputStream in, String extName) {
|
||||||
@@ -50,5 +45,17 @@ public class ImageParse {
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//public String parse(byte[] data, String extName) {
|
||||||
|
// String imageName = UUIDUtils.randomUUID10() + extName;
|
||||||
|
//
|
||||||
|
// String filepathandname = filePathCos + "/" + imageName;
|
||||||
|
// MinioUtil.uploadByte(data, filepathandname);
|
||||||
|
// return imageName;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user