I am writing a converter from XML&MathML to MS Word document.
I'm using MFC and Word automation, so there's no problem in writing text like this:
_Application app;
COleVariant vtOpt(DISP_E_PARAMNOTFOUND, VT_ERROR),
vtTrue((short)TRUE),
vtFalse((short)FALSE);
app.CreateDispatch("Word.Application",NULL);
Documents docs = app.GetDocuments();
_Document doc = docs.Add (vtOpt, vtOpt, vtOpt, vtOpt);
Range range = doc.Range (vtOpt, vtOpt);
range.InsertAfter (_T("Hello Word!"));
Now the problem is in converting MathML equations into embedded MathType objects. One of the possible ways, that I've found, is to write equations in TeX and then programmatically call MTCommand_TeXToggle (found in MathType 6.5 library for Word) macro, that replaces TeX with MathType OLE objects. But then I have to convert MathML to TeX somehow, wich is not so easy.
I know, that MathType OLE object should accept raw MathML data, but when I'm trying to create and access OLE object programmatically:
InlineShapes shapes = doc.GetInlineShapes ();
InlineShape control = shapes.AddOLEObject (COleVariant("Equation.DSMT4"), vtOpt, vtFalse, vtFalse, vtOpt, vtOpt, vtOpt, vtOpt);
OLEFormat fm = control.GetOLEFormat ();
COleDispatchDriver drv = fm.GetObject();
I end up with no reasonable interface to feed it with the MathML data. So, the question is: 1) Is there a way to get control over the OLE object and send it some MathML data? Or 2) Is there a way to get a MS Word VB macro, that converts the selection from MathML to MathType OLE object?
Thanks in advance, Nick Stanch
vba
Macros. I'm new in VBA and i would like to convertMathML2MathType
OLE Format. – Decidua