How to insert mathml to word? example:
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>x</mml:mi><mml:mo>=</mml:mo><mml:mfrac><mml:mrow><mml:mo>-</mml:mo><mml:mi>b</mml:mi><mml:mo>±</mml:mo><mml:msqrt><mml:msup><mml:mrow><mml:mi>b</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msup><mml:mo>-</mml:mo><mml:mn>4</mml:mn><mml:mi>a</mml:mi><mml:mi>c</mml:mi></mml:msqrt></mml:mrow><mml:mrow><mml:mn>2</mml:mn><mml:mi>a</mml:mi></mml:mrow></mml:mfrac></mml:math>
Hi,
Thanks for your interest in Aspose.Words. You can use DocumentBuilder.insertHtml method to insert an HTML fragment or whole HTML document into the document. Please see the following code:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertHtml(“your html string”);
doc.save(MyDir + “DocumentBuilder.InsertHtml Out.doc”);
I hope, this helps.
Best regards,
Thank you for your help, I would like to mathML code written to automatically into a mathematical formula word,like attachment。
Hi,
Thanks for the additional information. We will consider providing a method in public API to be able to insert MathML strings into the document in future. I have logged a new feature request in our issue tracking system. The ID of this feature is WORDSNET-8756. Your request has also been linked to this feature and you will be notified as soon as it is available. Sorry for the inconvenience.
Best regards,
1 Like
Hi there,
Thanks for your inquiry.
You may find that you can insert MathML into a document by first wrapping the data in a blank WordML document and loading that into Aspose.Words. The technique is detailed in
this forum thread.
Please let us know if this helps.
Thanks,
@dujian886,
Regarding WORDSNET-8756, we have completed the work on this issue and come to a conclusion to close this issue with “Won’t fix” status because DocumentBuilder.InsertHtml method can now handle MathML strings and we can suggest you to use InsertHtml method to insert MathML in Word document.