|
@@ -967,11 +967,35 @@ public final class DocxProcessUtil {
|
|
|
}
|
|
|
return -1;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检测P标签中是否有值
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static boolean isTextFromP(String strHtml){
|
|
|
+ String value = "";
|
|
|
+ String regex = "<p>(.*)</p>";
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
+ Matcher matcher = pattern.matcher(strHtml);
|
|
|
+ while(matcher.find()){
|
|
|
+ value = matcher.group(1);
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(value)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
// System.out.println(formatPWordMl("<p>A</p>"));
|
|
|
// System.out.println(getOptionNum("A.123123123"));
|
|
|
- System.out.println(getTextInHtml("<p>#include <stdio.h></p>"));
|
|
|
-
|
|
|
+// System.out.println(getTextInHtml("<p>#include <stdio.h></p>"));
|
|
|
+ StringBuilder str = new StringBuilder("");
|
|
|
+ str.append("<p>11</p>");
|
|
|
+ str.append("<p></p>");
|
|
|
+ String html = str.toString();
|
|
|
+ int index = html.lastIndexOf("<p>");
|
|
|
+ String htm = html.substring(0,index);
|
|
|
+ System.out.println(htm);
|
|
|
}
|
|
|
}
|