| TextExtensionsToOfficeMathML Method |
Returns a string containing the Office MathML (OMML) markup for the math text in the range.
Namespace: TextObjectModelAssembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax public static string ToOfficeMathML(
this TextRange range,
[OptionalAttribute] OfficeMathMLMode mode,
[OptionalAttribute] bool includeProperties
)
<ExtensionAttribute>
Public Shared Function ToOfficeMathML (
range As TextRange,
<OptionalAttribute> mode As OfficeMathMLMode,
<OptionalAttribute> includeProperties As Boolean
) As String
public:
[ExtensionAttribute]
static String^ ToOfficeMathML(
TextRange^ range,
[OptionalAttribute] OfficeMathMLMode mode,
[OptionalAttribute] bool includeProperties
)
Parameters
- range
- Type: TextObjectModelTextRange
The range containing the math text. - mode (Optional)
- Type: TextObjectModelOfficeMathMLMode
Determines how the markup is structured. - includeProperties (Optional)
- Type: SystemBoolean
Whether to include document-level math properties.
Return Value
Type:
String
A string containing one or more top-level OMML tags, depending on
the math content and the value of
mode and
includeProperties.
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 Remarks
This method works by converting the Math RTF in the range to OMML,
as the two representations are semantically identical.
Note: Setting the includeProperties parameter to
true will result in an XML fragment (instead of a document). This
will also occur if mode is set to
Default or
Inline and there are multiple math
zones in the range.
Examples
The following example demonstrates how to build-up math text and then convert it to OMML:
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.ToOfficeMathML());
}
See Also