Free Support Forum - aspose.cloud

How to convert docx with Math Equation to HTML with Aspose.Words REST API

Hi There,

I am working on a script to convert word document to html.
These word documents contains Math Equation and I need MathML code in the converted HTML document for these Math Equations.

Could you please help me on this

Kind Regards,
Rahul

@connectrahul1991

Please try SaveAs method with HtmlSaveOptions settings as following. It will help to convert DOCX with Math Equation to HTML.

curl -X PUT "https://api.aspose.cloud/v4.0/words/formula.docx/saveAs?folder=Temp%2Fhtml" 
-H "accept: application/json" 
-H "Authorization: Bearer [Access_Token]" 
-H "Content-Type: application/json" 
-H "x-aspose-client: Containerize.Swagger" 
-d "{\"SaveFormat\":\"html\",\"FileName\":\"test.html\",\"ZipOutput\":true,\"ExportImagesAsBase64\":true,\"ExportTextBoxAsSvg\":true,\"MetafileFormat\":\"Svg\",\"PrettyFormat\":true,\"ImageResolution\":150,\"ScaleImageToShapeSize\":false}"

Hi Tilal,

I’ve tried with the example which you’ve provided. Unfortunately it didn’t work.
Can you please tell me the exact option which I need to set.
I’ve tried setting OfficeMathOutputMode to ‘MathML’ but it didn’t work.

Kind Regards,
Rahul

Hi Tilal,

The expected output which I need is mathml xml code, not image.

For example:
{{400}^{0}}C

Kind Regards,
Rahul

@connectrahul1991

Please share your sample input document and expected HTML as a zip file. You can generate your expected output HTML file using MS Word. It will help us to address your issue exactly.

sample_.zip (17.1 KB)
Please find the attached sample document. I’ve tried all the example but the I am not getting MATHML code in the output html document.

@connectrahul1991

It seems your input document includes Equation.DSMT4 instead of MathML. Currently, Aspose.Words Cloud API does not support Equation.DSMT4. So we have logged a feature request WORDSCLOUD-1532 for the requirement. We will notify you as soon as it is resolved.