We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MathML does not inserted correctly into document by insertHTML uising Java

Hi,
Someone help me whats preventing mathmL not rendering properly when trying to print on docx file using documentbuilder.insertHTML(xmlString);

xmlString is below.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:mfrac xmlns:ns2="http://www.w3.org/1998/Math/MathML" xmlns:ns1="http://www.w3.org/1999/xlink">
	<ns2:msup>
		<ns2:mn>5</ns2:mn>
		<ns2:mstyle>
			<ns2:mfrac bevelled="true">
				<ns2:mn>6</ns2:mn>
				<ns2:mn>7</ns2:mn>
			</ns2:mfrac>
		</ns2:mstyle>
	</ns2:msup>
	<ns2:mn>8</ns2:mn>
</ns2:mfrac>

expected o/p: image.png (370 Bytes)

output printed on word document is : 5678

@Mahesh_Marella

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20291 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tahir.manzoor Thanks for looking into it.

@Mahesh_Marella

It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-20291) as ‘Not a Bug’.

The given MathML is incorrect for MS Word. Please use following code example to get the desired output.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(
    "<math xmlns = \"http://www.w3.org/1998/Math/MathML\">" +
    "<mfrac>" +
    "<msup>" +
    "<mn>5</mn>" +
    "<mfrac bevelled=\"true\">" +
    "<mn>6</mn>" +
    "<mn>7</mn>" +
    "</mfrac>" +
    "</msup>" +
    "<mn>8</mn>" +
    "</mfrac>" +
    "</math>");

doc.Save(MyDir + "20.5.docx");