|
@@ -546,8 +546,12 @@ public final class DocxProcessUtil {
|
|
|
Text text = (Text) rChild;
|
|
|
String tmpText = text.getValue();
|
|
|
if (quesUnit == QuesUnit.QUES_BODY) {
|
|
|
+
|
|
|
// 过滤题干标题
|
|
|
if (tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
|
+ if (index == 2) {
|
|
|
+ return p;
|
|
|
+ }
|
|
|
tmpText = tmpText.replaceFirst("\\d{1,}\\.", "");
|
|
|
text.setValue(tmpText);
|
|
|
} else {
|
|
@@ -558,13 +562,17 @@ public final class DocxProcessUtil {
|
|
|
}
|
|
|
text.setValue(tmpText);
|
|
|
if (index == 2) {
|
|
|
- break;
|
|
|
+ return p;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} else if (quesUnit == QuesUnit.QUES_OPTION) {
|
|
|
+
|
|
|
// 过滤选项标题
|
|
|
if (tmpText.matches("^[A-Z]\\.[\\s\\S]*")) {
|
|
|
+ if (index == 2) {
|
|
|
+ return p;
|
|
|
+ }
|
|
|
tmpText = tmpText.replaceFirst("[A-Z]\\.", "");
|
|
|
text.setValue(tmpText);
|
|
|
} else {
|
|
@@ -575,7 +583,7 @@ public final class DocxProcessUtil {
|
|
|
}
|
|
|
text.setValue(tmpText);
|
|
|
if (index == 2) {
|
|
|
- break;
|
|
|
+ return p;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -586,7 +594,7 @@ public final class DocxProcessUtil {
|
|
|
.replaceFirst("[:|:]", "");
|
|
|
text.setValue(tmpText);
|
|
|
} else {
|
|
|
- break;
|
|
|
+ return p;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -661,6 +669,9 @@ public final class DocxProcessUtil {
|
|
|
WordprocessingMLPackage wordMLPackage = (WordprocessingMLPackage) flatOpcXmlImporter.get();
|
|
|
|
|
|
for (WordprocessingMLPackage wp : wordMLPackages) {
|
|
|
+
|
|
|
+ //初始化图片路径
|
|
|
+ initPkgImage(wp);
|
|
|
// 获取资源文件存储
|
|
|
PartStore partStore = wp.getSourcePartStore();
|
|
|
// 获取图片资源定义
|
|
@@ -790,7 +801,7 @@ public final class DocxProcessUtil {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public static String html2Docx(WordprocessingMLPackage wordMLPackage,String html)throws Exception {
|
|
|
- initPkgImage(wordMLPackage);
|
|
|
+ initTmpPackage(wordMLPackage);
|
|
|
XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
|
|
|
String wordMl = "";
|
|
|
wordMLPackage.getMainDocumentPart().getContent().addAll(
|
|
@@ -804,5 +815,8 @@ public final class DocxProcessUtil {
|
|
|
return wordMl;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String str = "1";
|
|
|
+ System.out.println(str.matches("^\\d{1,}\\.[\\s\\S]*"));
|
|
|
+ }
|
|
|
}
|