Can I Import a MathML Equation into Aspose.Slides MathPortion in Java?

@fzeng2012,
Please share a code example that demonstrates the problem.

The following produces a letter “a” in a square box with open top, as shown in the image. However MathBorderBox does not seem to support a circle or a phasorangle.

       MathBorderBox mathBorderBox = new MathBorderBox(new MathematicalText("a"));
       mathBorderBox.setHideTop(true);

image.png (415 Bytes)

@fzeng2012,
Thank you for the code example.

Could you also specify all the math elements that Aspose.Slides should support for your purposes?

The MathML element is “menclose”. Here is the official spec.

https://www.w3.org/TR/MathML3/chapter3.html#presm.menclose

@fzeng2012,
Thank you for the additional information. I’ve added a ticket with ID SLIDESJAVA-38947 to our issue-tracking system. Our developers will consider implementing the remaining features you specified in the menclose element. You will be notified when a new release of Aspose.Slides with a fix is published.

Thank you for the help!

@fzeng2012,
Thank you for using Aspose.Slides.

@fzeng2012,
Our development team has considered using of enclose expressions like “menclose” from MathML. To work with mathematical expressions, PowerPoint uses OMML, which is similar to MathML, but with a number of differences. Unfortunately, OOML has no analogs for “menclose”. You can verify this for yourself by trying to create a similar element using PowerPoint.

Thanks for the update.

The issues you found earlier (filed as SLIDESJAVA-38946) have been fixed in Aspose.Slides for Java 23.1 (JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.

Is the issue resolved or still struggling? :thinking:
I have done a little bit of research on it and I found this answer…It does not natively support importing MathML equations into a MathPortion. However, you may be able to convert a MathML equation to a different format (such as a PNG image) and then insert that image into a slide using Aspose.Slides. Alternatively, you can convert MathML to a vector format like SVG and then insert it in the slide as an image.

Thanks for the suggestion.

Because PowerPoint is not a flow document format, it is hard to mix images with text. Math formulas in images can not be part of normal paragraphs. While your suggestions will work in many situations, it does not work for my use case.

I will to test the new release Aspose.Slides for Java 23.1.

@fzeng2012,
Please let us know if you run into any issues again.

I tried out release 23.1 and got mixed results for my use cases.

On the one hand it handles fractions (mfrac), radicals (mroot) and summations (munderover) very well.

On the other hand it does not render arrows(mover + →) and harpoons (mover + ⇀) well. It does not do boxes (menclose) well either. It does not handle delimiters at all (mfenced).

I am attaching the following in a zip file for your reference:

inputMath.xml: MathML fragments. You may view the rendered formula using https://codepen.io/bqlou/pen/yOgbmb
Htmlmport.pptx: PPT generated with IParagraphCollection.addFromHtml(String)
MathApi: PPT generated with the math APIs provided in Aspose.Slides.

forum.zip (79.7 KB)

@fzeng2012,
Could you please share the complete HTML file or string that you used with the IParagraphCollection.addFromHtml method?

Here it the HTML fragment passed into IParagraphCollection.addFromHtml

scratch_22.zip (579 Bytes)

@fzeng2012,
Thank you for the sample HTML file. I will get back to you ASAP.

@fzeng2012,
I’ve reproduced the problem with importing the MathML expressions into a PowerPoint presentation.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39107

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you! @Andrey_Potapov

The issues you found earlier (filed as SLIDESJAVA-39107) have been fixed in Aspose.Slides for Java 23.4 (JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.