|
@@ -25,6 +25,7 @@ import org.docx4j.dml.wordprocessingDrawing.Inline;
|
|
import org.docx4j.finders.ClassFinder;
|
|
import org.docx4j.finders.ClassFinder;
|
|
import org.docx4j.jaxb.Context;
|
|
import org.docx4j.jaxb.Context;
|
|
import org.docx4j.math.CTOMath;
|
|
import org.docx4j.math.CTOMath;
|
|
|
|
+import org.docx4j.math.CTOMathPara;
|
|
import org.docx4j.openpackaging.exceptions.Docx4JException;
|
|
import org.docx4j.openpackaging.exceptions.Docx4JException;
|
|
import org.docx4j.openpackaging.io3.stores.PartStore;
|
|
import org.docx4j.openpackaging.io3.stores.PartStore;
|
|
import org.docx4j.openpackaging.io3.stores.ZipPartStore;
|
|
import org.docx4j.openpackaging.io3.stores.ZipPartStore;
|
|
@@ -131,13 +132,14 @@ public final class DocxProcessUtil {
|
|
* @param p
|
|
* @param p
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public static boolean isNotText(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> drawList = getAllElementFromObject(p, Drawing.class);
|
|
List<Object> drawList = getAllElementFromObject(p, Drawing.class);
|
|
- if (mathList.size() > 0 || drawList.size() > 0) {
|
|
|
|
- return true;
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (mathParaList.size() > 0 || mathList.size() > 0 || drawList.size() > 0) {
|
|
return false;
|
|
return false;
|
|
|
|
+ } else {
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -275,6 +277,11 @@ public final class DocxProcessUtil {
|
|
"http://schemas.openxmlformats.org/officeDocument/2006/math", "oMath", CTOMath.class);
|
|
"http://schemas.openxmlformats.org/officeDocument/2006/math", "oMath", CTOMath.class);
|
|
byte[] imgByte = convertMathml2Img(omml2mml(omml));
|
|
byte[] imgByte = convertMathml2Img(omml2mml(omml));
|
|
pContent.set(index, newImage(wordMLPackage, imgByte, "math" + (index), "math" + (index)));
|
|
pContent.set(index, newImage(wordMLPackage, imgByte, "math" + (index), "math" + (index)));
|
|
|
|
+ }else if(child.getClass().equals(CTOMathPara.class)){
|
|
|
|
+ String omml = XmlUtils.marshaltoString(child, true, true, Context.jc,
|
|
|
|
+ "http://schemas.openxmlformats.org/officeDocument/2006/math", "oMathPara", CTOMathPara.class);
|
|
|
|
+ byte[] imgByte = convertMathml2Img(omml2mml(omml));
|
|
|
|
+ pContent.set(index, newImage(wordMLPackage, imgByte, "math" + (index), "math" + (index)));
|
|
}
|
|
}
|
|
index++;
|
|
index++;
|
|
}
|
|
}
|
|
@@ -770,12 +777,12 @@ public final class DocxProcessUtil {
|
|
int index = 0;
|
|
int index = 0;
|
|
for (Relationship relationship : relationships) {
|
|
for (Relationship relationship : relationships) {
|
|
String tmpId = relationship.getId();
|
|
String tmpId = relationship.getId();
|
|
|
|
+ String tmp = getRldNum() + (++index);
|
|
for (Object obj : blips) {
|
|
for (Object obj : blips) {
|
|
if (obj.getClass().equals(CTBlip.class)) {
|
|
if (obj.getClass().equals(CTBlip.class)) {
|
|
CTBlip ctBlip = (CTBlip) obj;
|
|
CTBlip ctBlip = (CTBlip) obj;
|
|
String tmpEmbed = ctBlip.getEmbed();
|
|
String tmpEmbed = ctBlip.getEmbed();
|
|
if (tmpId.equals(tmpEmbed)) {
|
|
if (tmpId.equals(tmpEmbed)) {
|
|
- String tmp = getRldNum() + (++index);
|
|
|
|
relationship.setId(tmp);
|
|
relationship.setId(tmp);
|
|
ctBlip.setEmbed(tmp);
|
|
ctBlip.setEmbed(tmp);
|
|
}
|
|
}
|