We are trying to build to java code to read the word document (docx file) using apache POI. I have taken hint from this solution Reading equations from Word (*.docx) to HTML together with their text context using apache poi. I have imported the required dependencies.
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.0.0</version>
</dependency>
I have imported the exact CTP and CTOMath functions.
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.officeDocument.x2006.math.CTOMath;
import org.openxmlformats.schemas.officeDocument.x2006.math.CTOMathPara;
I have changed the xsl file to MML2OMML.XSL which i got from Microsoft Office folder in Windows. Earlier i used the described xsl file (OMML2MML.XSL) which gave me more errors.
The problem is i am not getting desired mathml output.
My input was word doc like this:
My output was
- mathml for formula 1:
- mathml for formula 2:
- Text: Hi this is Nikhil
Could somebody please help me here? Any suggestions are appreciated. Thanks in advance.
x+an=k=0nnkxkan-k
a2+b2=c2
Hi this is nikhil
Equations looks like general text. – Nikhil Cherian Jul 16 '21 at 14:22