java.lang.Object
com.aspose.words.MathObjectType
public class MathObjectType
- extends java.lang.Object
Utility class containing constants.
Specifies type of an Office Math object.
Example:
Traverse a document with a visitor that prints all OfficeMath nodes that it encounters.
public void officeMathToText() throws Exception {
// Open the document that has office math objects we want to print the info of
Document doc = new Document(getMyDir() + "DocumentVisitor-compatible features.docx");
// Create an object that inherits from the DocumentVisitor class
OfficeMathInfoPrinter visitor = new OfficeMathInfoPrinter();
// Accepting a visitor lets it start traversing the nodes in the document,
// starting with the node that accepted it to then recursively visit every child
doc.accept(visitor);
// Once the visiting is complete, we can retrieve the result of the operation,
// that in this example, has accumulated in the visitor
System.out.println(visitor.getText());
}
/// <summary>
/// This Visitor implementation prints information about office math objects encountered in the document.
/// </summary>
public static class OfficeMathInfoPrinter extends DocumentVisitor {
public OfficeMathInfoPrinter() {
mBuilder = new StringBuilder();
mVisitorIsInsideOfficeMath = false;
}
/// <summary>
/// Gets the plain text of the document that was accumulated by the visitor.
/// </summary>
public String getText() {
return mBuilder.toString();
}
/// <summary>
/// Called when a Run node is encountered in the document.
/// </summary>
public int visitRun(final Run run) {
if (mVisitorIsInsideOfficeMath) {
indentAndAppendLine("[Run] \"" + run.getText() + "\"");
}
return VisitorAction.CONTINUE;
}
/// <summary>
/// Called when an OfficeMath node is encountered in the document.
/// </summary>
public int visitOfficeMathStart(final OfficeMath officeMath) {
indentAndAppendLine("[OfficeMath start] Math object type: " + officeMath.getMathObjectType());
mDocTraversalDepth++;
mVisitorIsInsideOfficeMath = true;
return VisitorAction.CONTINUE;
}
/// <summary>
/// Called when the visiting of a OfficeMath node is ended.
/// </summary>
public int visitOfficeMathEnd(final OfficeMath officeMath) {
mDocTraversalDepth--;
indentAndAppendLine("[OfficeMath end]");
mVisitorIsInsideOfficeMath = false;
return VisitorAction.CONTINUE;
}
/// <summary>
/// Append a line to the StringBuilder and indent it depending on how deep the visitor is into the document tree.
/// </summary>
/// <param name="text"></param>
private void indentAndAppendLine(final String text) {
for (int i = 0; i < mDocTraversalDepth; i++) {
mBuilder.append("| ");
}
mBuilder.append(text + "\r\n");
}
private boolean mVisitorIsInsideOfficeMath;
private int mDocTraversalDepth;
private StringBuilder mBuilder;
}
Field Summary |
static final int | O_MATH = 0 | |
Instance of mathematical text.
|
static final int | O_MATH_PARA = 1 | |
Math paragraph, or display math zone, that contains one or more O_MATH elements that are in display mode.
|
static final int | ACCENT = 2 | |
Accent function, consisting of a base and a combining diacritical mark.
|
static final int | BAR = 3 | |
Bar function, consisting of a base argument and an overbar or underbar.
|
static final int | BORDER_BOX = 4 | |
Border Box object, consisting of a border drawn around an instance of mathematical text (such as a formula or equation)
|
static final int | BOX = 5 | |
Box object, which is used to group components of an equation or other instance of mathematical text.
|
static final int | DELIMITER = 6 | |
Delimiter object, consisting of opening and closing delimiters (such as parentheses,
braces, brackets, and vertical bars), and an element contained inside.
|
static final int | DEGREE = 7 | |
Degree in the mathematical radical.
|
static final int | ARGUMENT = 8 | |
Argument object. Encloses Office Math entities when they are used as arguments to other Office Math entities.
|
static final int | ARRAY = 9 | |
Array object, consisting of one or more equations, expressions, or other mathematical text runs
that can be vertically justified as a unit with respect to surrounding text on the line.
|
static final int | FRACTION = 10 | |
Fraction object, consisting of a numerator and denominator separated by a fraction bar.
|
static final int | DENOMINATOR = 11 | |
Denominator of a fraction object.
|
static final int | NUMERATOR = 12 | |
Numerator of the Fraction object.
|
static final int | FUNCTION = 13 | |
Function-Apply object, which consists of a function name and an argument element acted upon.
|
static final int | FUNCTION_NAME = 14 | |
Name of the function. For example, function names are sin and cos.
|
static final int | GROUP_CHARACTER = 15 | |
Group-Character object, consisting of a character drawn above or below text, often
with the purpose of visually grouping items
|
static final int | LIMIT = 16 | |
Lower limit of the LOWER_LIMIT object and
the upper limit of the UPPER_LIMIT function.
|
static final int | LOWER_LIMIT = 17 | |
Lower-Limit object, consisting of text on the baseline and reduced-size text immediately below it.
|
static final int | UPPER_LIMIT = 18 | |
Upper-Limit object, consisting of text on the baseline and reduced-size text immediately above it.
|
static final int | MATRIX = 19 | |
Matrix object, consisting of one or more elements laid out in one or more rows and one or more columns.
|
static final int | MATRIX_ROW = 20 | |
Single row of the matrix.
|
static final int | N_ARY = 21 | |
N-ary object, consisting of an n-ary object, a base (or operand), and optional upper and lower limits.
|
static final int | PHANTOM = 22 | |
Phantom object.
|
static final int | RADICAL = 23 | |
Radical object, consisting of a radical, a base element, and an optional degree .
|
static final int | SUBSCRIPT_PART = 24 | |
Subscript of the object that can have subscript part.
|
static final int | SUPERSCRIPT_PART = 25 | |
Superscript of the superscript object.
|
static final int | PRE_SUB_SUPERSCRIPT = 26 | |
Pre-Sub-Superscript object, which consists of a base element and a subscript and superscript placed to the left of the base.
|
static final int | SUBSCRIPT = 27 | |
Subscript object, which consists of a base element and a reduced-size script placed below and to the right.
|
static final int | SUB_SUPERSCRIPT = 28 | |
Sub-superscript object, which consists of a base element, a reduced-size script placed below and to the right, and a reduced-size script placed above and to the right.
|
static final int | SUPERCRIPT = 29 | |
Superscript object, which consists of a base element and a reduced-size script placed above and to the right.
|
O_MATH = 0 | |
public static final int O_MATH |
-
Instance of mathematical text.
O_MATH_PARA = 1 | |
public static final int O_MATH_PARA |
-
Math paragraph, or display math zone, that contains one or more O_MATH elements that are in display mode.
ACCENT = 2 | |
public static final int ACCENT |
-
Accent function, consisting of a base and a combining diacritical mark.
BAR = 3 | |
public static final int BAR |
-
Bar function, consisting of a base argument and an overbar or underbar.
BORDER_BOX = 4 | |
public static final int BORDER_BOX |
-
Border Box object, consisting of a border drawn around an instance of mathematical text (such as a formula or equation)
BOX = 5 | |
public static final int BOX |
-
Box object, which is used to group components of an equation or other instance of mathematical text.
DELIMITER = 6 | |
public static final int DELIMITER |
-
Delimiter object, consisting of opening and closing delimiters (such as parentheses,
braces, brackets, and vertical bars), and an element contained inside.
DEGREE = 7 | |
public static final int DEGREE |
-
Degree in the mathematical radical.
ARGUMENT = 8 | |
public static final int ARGUMENT |
-
Argument object. Encloses Office Math entities when they are used as arguments to other Office Math entities.
ARRAY = 9 | |
public static final int ARRAY |
-
Array object, consisting of one or more equations, expressions, or other mathematical text runs
that can be vertically justified as a unit with respect to surrounding text on the line.
FRACTION = 10 | |
public static final int FRACTION |
-
Fraction object, consisting of a numerator and denominator separated by a fraction bar.
DENOMINATOR = 11 | |
public static final int DENOMINATOR |
-
Denominator of a fraction object.
NUMERATOR = 12 | |
public static final int NUMERATOR |
-
Numerator of the Fraction object.
FUNCTION = 13 | |
public static final int FUNCTION |
-
Function-Apply object, which consists of a function name and an argument element acted upon.
FUNCTION_NAME = 14 | |
public static final int FUNCTION_NAME |
-
Name of the function. For example, function names are sin and cos.
GROUP_CHARACTER = 15 | |
public static final int GROUP_CHARACTER |
-
Group-Character object, consisting of a character drawn above or below text, often
with the purpose of visually grouping items
LIMIT = 16 | |
public static final int LIMIT |
-
Lower limit of the LOWER_LIMIT object and
the upper limit of the UPPER_LIMIT function.
LOWER_LIMIT = 17 | |
public static final int LOWER_LIMIT |
-
Lower-Limit object, consisting of text on the baseline and reduced-size text immediately below it.
UPPER_LIMIT = 18 | |
public static final int UPPER_LIMIT |
-
Upper-Limit object, consisting of text on the baseline and reduced-size text immediately above it.
MATRIX = 19 | |
public static final int MATRIX |
-
Matrix object, consisting of one or more elements laid out in one or more rows and one or more columns.
MATRIX_ROW = 20 | |
public static final int MATRIX_ROW |
-
Single row of the matrix.
N_ARY = 21 | |
public static final int N_ARY |
-
N-ary object, consisting of an n-ary object, a base (or operand), and optional upper and lower limits.
PHANTOM = 22 | |
public static final int PHANTOM |
-
Phantom object.
RADICAL = 23 | |
public static final int RADICAL |
-
Radical object, consisting of a radical, a base element, and an optional degree .
SUBSCRIPT_PART = 24 | |
public static final int SUBSCRIPT_PART |
-
Subscript of the object that can have subscript part.
SUPERSCRIPT_PART = 25 | |
public static final int SUPERSCRIPT_PART |
-
Superscript of the superscript object.
PRE_SUB_SUPERSCRIPT = 26 | |
public static final int PRE_SUB_SUPERSCRIPT |
-
Pre-Sub-Superscript object, which consists of a base element and a subscript and superscript placed to the left of the base.
SUBSCRIPT = 27 | |
public static final int SUBSCRIPT |
-
Subscript object, which consists of a base element and a reduced-size script placed below and to the right.
SUB_SUPERSCRIPT = 28 | |
public static final int SUB_SUPERSCRIPT |
-
Sub-superscript object, which consists of a base element, a reduced-size script placed below and to the right, and a reduced-size script placed above and to the right.
SUPERCRIPT = 29 | |
public static final int SUPERCRIPT |
-
Superscript object, which consists of a base element and a reduced-size script placed above and to the right.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.