| TextExtensionsToMathML Method |
Returns a string containing the W3C MathML (MML) markup for the math text in the range.
Namespace: TextObjectModelAssembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax public static string ToMathML(
this TextRange range
)
<ExtensionAttribute>
Public Shared Function ToMathML (
range As TextRange
) As String
public:
[ExtensionAttribute]
static String^ ToMathML(
TextRange^ range
)
Parameters
- range
- Type: TextObjectModelTextRange
The range containing the math text.
Return Value
Type:
StringA string containing the MathML markup.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
TextRange. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Exception | Condition |
---|
NotSupportedException |
Microsoft Office is not installed, or the XSL stylesheet (used in the conversion process) was not found.
|
Remarks
This method works by transforming the OMML representation of the
math text to MathML via an XSL stylesheet included with Microsoft
Office. This method cannot be used if Microsoft Office is not
installed.
Note: If the current process is 32-bit and only the 64-bit version
of Office is installed, MathML conversion will be unavailable.
Examples
The following example demonstrates how to build-up math text and then convert it to MathML:
using (RichTextBoxEx rtb = new RichTextBoxEx()) {
TextDocument doc = TextDocument.FromRichTextBox(rtb);
TextRange range = doc.EntireRange;
range.Text = "(a+b/c)/(u+x/y)";
range.BuildUpMath();
Console.WriteLine(range.ToMathML());
}
See Also