|
@@ -152,7 +152,7 @@ public final class DocxProcessUtil {
|
|
public static boolean isText(P p) {
|
|
public static boolean isText(P p) {
|
|
List<Object> mathList = getAllElementFromObject(p, CTOMath.class);
|
|
List<Object> mathList = getAllElementFromObject(p, CTOMath.class);
|
|
List<Object> mathParaList = getAllElementFromObject(p, CTOMathPara.class);
|
|
List<Object> mathParaList = getAllElementFromObject(p, CTOMathPara.class);
|
|
- List<Object> drawList = getAllElementFromObject(p, Drawing.class);
|
|
|
|
|
|
+ List<Object> drawList = getAllImageElementFromObject(p);
|
|
if (mathParaList.size() > 0 || mathList.size() > 0 || drawList.size() > 0) {
|
|
if (mathParaList.size() > 0 || mathList.size() > 0 || drawList.size() > 0) {
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|
|
@@ -378,6 +378,21 @@ public final class DocxProcessUtil {
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+ public static List<Object> getAllImageElementFromObject(Object obj) {
|
|
|
|
+
|
|
|
|
+ List<Object> result = new ArrayList<>();
|
|
|
|
+ if (obj instanceof JAXBElement)
|
|
|
|
+ obj = ((JAXBElement<?>) obj).getValue();
|
|
|
|
+ if (obj.getClass().equals(Drawing.class)||obj.getClass().equals(Pict.class))
|
|
|
|
+ result.add(obj);
|
|
|
|
+ else if (obj instanceof ContentAccessor) {
|
|
|
|
+ List<?> children = ((ContentAccessor) obj).getContent();
|
|
|
|
+ for (Object child : children) {
|
|
|
|
+ result.addAll(getAllImageElementFromObject(child));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
public static List<Object> getAllElementWithBrFromObject(Object obj, Class<?> toSearch) {
|
|
public static List<Object> getAllElementWithBrFromObject(Object obj, Class<?> toSearch) {
|
|
|
|
|
|
List<Object> result = new ArrayList<>();
|
|
List<Object> result = new ArrayList<>();
|