RichEditTextDocument.SetMathML(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Updates the RichEditBox content with the specified Mathematical Markup Language (MathML) formatted string.
public:
virtual void SetMathML(Platform::String ^ value) = SetMathML;
void SetMathML(winrt::hstring const& value);
public void SetMathML(string value);
function setMathML(value)
Public Sub SetMathML (value As String)
Parameters
- value
-
String
Platform::String
winrt::hstring
A MathML formatted string.
Examples
Passing the string in the example below in SetMathML will render to the RichEditBox as a math expression:
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="block">
<mml:msup>
<mml:mrow>
<mml:mi mathcolor="#000000">x</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn mathcolor="#000000">3</mml:mn>
</mml:mrow>
</mml:msup>
<mml:mo mathcolor="#000000">+</mml:mo>
<mml:mi mathcolor="#000000">y</mml:mi>
<mml:mo mathcolor="#000000">></mml:mo>
<mml:mn mathcolor="#000000">5</mml:mn>
</mml:math>
The example above will render as a rich text formatted representation of x³ + y > 5
.
Use the GetMathML API to get MathML content for existing text in a math mode enabled RichEditBox.
Remarks
This method overwrites the existing content of RichEditBox.
Before calling SetMathML, applications must enable math mode by calling SetMathMode. This method throws an E_INVALIDARG error if the RichEditBox is not set to math mode.
This method throws an E_INVALIDARG error if value is not a properly formatted MathML string (the current content of the RichEditBox is also cleared).