Convert MathType equation embedded in OLE Binary file to MathML
Asked Answered
M

2

15

I am trying to convert MathType's equation which is stored as OLE binary file to MathML using MathType's SDK.

The input file for my program is a DocX which would contain embdedd MathType equations. I am looking for a solution thats independent of using MS Word. DocX is a zip file, and once it is extracted we can find the a binary file for each OLE object in the folder "word/embeddings/". Typically the file name would be oleObject1.bin, oleObject2.bin etc.

When I checked with MathType SDK it has a class "ConvertEquation" which has following method:

virtual public bool Convert(EquationInput ei, EquationOutput eo)

EquationInput is an abstract class for which following concrete classes are made available:

EquationInputFileText
EquationInputFileWMF2
EquationInputFileWMF
EquationInputFileGIF
EquationInputFileEPS

In the above listed classes none of them seems to support OLE binary.

According to MathType's SDK doc, MTEF data is saved as the native data format of the object. Whenever an equation object is to be written to an OLE "stream", a 28- byte header is written, followed by the MTEF data. I guess this is exactly what is present in this binary file. But just that there seems to be no way by which this format can be made to be used by SDK to convert it into MathML. Any thoughts?

Thanks

Min answered 26/8, 2015 at 6:39 Comment(4)
Although not a complete answer, you may find some inspiration in the following question. A link to download the proposed code can be found in the answer's last comment. It does depend on Word, but it might help get you started. #15320588Cocoon
Thanks. I saw that already. With that as a lead only I have come this far. But I am unable to proceed further from what I have put above.Min
If you can physically get the byte streams I would try this: Create an App that can OLE activate the object. Then you will have the reference to the internal object that you can then pass off to the conversion function. Your app would be doing what Word is doing when it ole activates the object. I would think about doing this in VB6 at least as a test.Puleo
Thats exactly what I am attempting to do, i.e. pass the internal object to the conversion function. But like I have put in my question, the conversion function does not seem to consume the internal object!Min
S
0

you can convert mathtype wmf file to mathml as follow: ConvertEquation conv = new ConvertEquation(); var input = EquationInputFileWMF("mathTYpe.wmf"); var output = EquationOutputFileText("MathMLName.txt", "MathML2 (m namespace).tdl")); conv.Convert(input , input);

the "MathML2 (m namespace).tdl" string stand for "tdl" file which contains in "MathType\Translators" path, if you open the Translators path ,you can find many of type.

Sabadell answered 3/3, 2017 at 8:37 Comment(0)
B
0

You may try MathMagic equation editor (Windows version). MathMagic can extract all Word embeded equations out of the document(s) (.doc or .docx), and can save/covert them to other format (such as JPG, PNG, BMP, PDF, TeX, LaTeX, MathML, ...) as a batch conversion job. Unfortunately, their trial version does not support this batch conversion. A valid license (even 1-month or 2-month license) is required to enable the Conversion feature.

Bethelbethena answered 3/7, 2017 at 17:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.