Convert OfficeMath/MathML to Latex in output HTML | Convert Cell to HTML using Java

we have to read docx tables and convert table’s each cell’s Content into Html format.

Please guide us how its possible using aspose.word .

We are using aspose-words-21.2-jdk16.jar

From
Nitin Chopkar

@nitinchopkar

You can use Node.ToString method to achieve your requirement. Please use the following code example to convert table’s cell content into HTML.

Document doc = new Document(MyDir + "cell.docx");
 for (Table table : (Iterable<Table>) doc.getChildNodes(NodeType.TABLE, true))
 {
     for (Cell cell : (Iterable<Cell>) table.getChildNodes(NodeType.CELL, true))
     {
         System.out.println(cell.toString(SaveFormat.HTML));
     }
 }

Thank you, Its worked.

Also guide us how will we get docx containing Math equation into MathML format while converting to HTML. We need that whatever equation in our docx that should be get in MathML format.

From
Nitin Chopkar

@nitinchopkar

Please use Node.ToString method as shown below to get the desired output.

 Document doc = new Document(MyDir + "input.docx");
 for (OfficeMath om : (Iterable<OfficeMath>) doc.getChildNodes(NodeType.OFFICE_MATH, true))
 {
     System.out.println(om.toString(SaveFormat.HTML));
 }

Thank You, it works.

One more help I need, How we can get same Math equation into LeText format while converting to HTML.

From
Nitin Chopkar

@nitinchopkar

Could you please ZIP and attach your input Word document along with expected output HTML here for our reference? We will then provide you information on it.

Thank you for reply,

As per you request I enclosed zip file which contains docx file and expected html format file.
Math_DocxEquation_To_HtmlMathLaText.zip (9.5 KB)
Let me know if you want any more clarity regarding same.

From
Nitin chopkar

@nitinchopkar

Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-18001 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.