FieldEQ Class

Implements the EQ field.
Inheritance Hierarchy

Namespace:  Aspose.Words.Fields
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
public class FieldEQ : Field

The FieldEQ type exposes the following members.

Public methodFieldEQ
Initializes a new instance of the FieldEQ class
Public propertyCode exampleDisplayResult
Gets the text that represents the displayed field result.
(Inherited from Field.)
Public propertyCode exampleEnd
Gets the node that represents the field end.
(Inherited from Field.)
Public propertyCode exampleFormat
Gets a FieldFormat object that provides typed access to field's formatting.
(Inherited from Field.)
Public propertyCode exampleIsDirty
Gets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document.
(Inherited from Field.)
Public propertyCode exampleIsLocked
Gets or sets whether the field is locked (should not recalculate its result).
(Inherited from Field.)
Public propertyCode exampleLocaleId
Gets or sets the LCID of the field.
(Inherited from Field.)
Public propertyCode exampleResult
Gets or sets text that is between the field separator and field end.
(Inherited from Field.)
Public propertyCode exampleSeparator
Gets the node that represents the field separator. Can be null.
(Inherited from Field.)
Public propertyCode exampleStart
Gets the node that represents the start of the field.
(Inherited from Field.)
Public propertyCode exampleType
Gets the Microsoft Word field type.
(Inherited from Field.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodCode exampleGetFieldCode
Returns text between field start and field separator (or field end if there is no separator). Both field code and field result of child fields are included.
(Inherited from Field.)
Public methodCode exampleGetFieldCode(Boolean)
Returns text between field start and field separator (or field end if there is no separator).
(Inherited from Field.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodNeedStoreOldResultNodes (Inherited from Field.)
Public methodCode exampleRemove
Removes the field from the document. Returns a node right after the field. If the field's end is the last child of its parent node, returns its parent paragraph. If the field is already removed, returns null.
(Inherited from Field.)
Public methodToString (Inherited from Object.)
Public methodCode exampleUnlink
Performs the field unlink.
(Inherited from Field.)
Public methodCode exampleUpdate
Performs the field update. Throws if the field is being updated already.
(Inherited from Field.)
Public methodCode exampleUpdate(Boolean)
Performs a field update. Throws if the field is being updated already.
(Inherited from Field.)
Shows how to use the EQ field to display a variety of mathematical equations.
public void FieldEQ()
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);

    // An EQ field displays a mathematical equation consisting of one or many elements
    // Each element takes the following form: [switch][options][arguments]
    // One switch, several possible options, followed by a set of argument values inside round braces

    // Here we use a document builder to insert an EQ field, with an "\f" switch, which corresponds to "Fraction"
    // No options are invoked, and the values 1 and 4 are passed as arguments
    // This field will display a fraction with 1 as the numerator and 4 as the denominator
    FieldEQ field = InsertFieldEq(builder, @"\f(1,4)");

    Assert.AreEqual(@" EQ \f(1,4)", field.GetFieldCode());

    // One EQ field may contain multiple elements placed sequentially,
    // and elements may also be nested by being placed inside the argument brackets of other elements
    // The full list of switches and their corresponding options can be found here:

    // Array switch "\a", aligned left, 2 columns, 3 points of horizontal and vertical spacing
    InsertFieldEq(builder, @"\a \al \co2 \vs3 \hs3(4x,- 4y,-4x,+ y)");

    // Bracket switch "\b", bracket character "[", to enclose the contents in a set of square braces
    // Note that we are nesting an array inside the brackets, which will altogether look like a matrix in the output
    InsertFieldEq(builder, @"\b \bc\[ (\a \al \co3 \vs3 \hs3(1,0,0,0,1,0,0,0,1))");

    // Displacement switch "\d", displacing text "B" 30 spaces to the right of "A", displaying the gap as an underline
    InsertFieldEq(builder, @"A \d \fo30 \li() B");

    // Formula consisting of multiple fractions
    InsertFieldEq(builder, @"\f(d,dx)(u + v) = \f(du,dx) + \f(dv,dx)");

    // Integral switch "\i", with a summation symbol
    InsertFieldEq(builder, @"\i \su(n=1,5,n)");

    // List switch "\l"
    InsertFieldEq(builder, @"\l(1,1,2,3,n,8,13)");

    // Radical switch "\r", displaying a cubed root of x
    InsertFieldEq(builder, @"\r (3,x)");

    // Subscript/superscript switch "/s", first as a superscript and then as a subscript
    InsertFieldEq(builder, @"\s \up8(Superscript) Text \s \do8(Subscript)");

    // Box switch "\x", with lines at the top, bottom, left and right of the input
    InsertFieldEq(builder, @"\x \to \bo \le \ri(5)");

    // More complex combinations
    InsertFieldEq(builder, @"\a \ac \vs1 \co1(lim,n→∞) \b (\f(n,n2 + 12) + \f(n,n2 + 22) + ... + \f(n,n2 + n2))");
    InsertFieldEq(builder, @"\i (,,  \b(\f(x,x2 + 3x + 2))) \s \up10(2)");
    InsertFieldEq(builder, @"\i \in( tan x, \s \up2(sec x), \b(\r(3) )\s \up4(t) \s \up7(2)  dt)");

    doc.Save(ArtifactsDir + "Field.EQ.docx");

/// <summary>
/// Use a document builder to insert an EQ field, set its arguments and start a new paragraph.
/// </summary>
private static FieldEQ InsertFieldEq(DocumentBuilder builder, string args)
    FieldEQ field = (FieldEQ)builder.InsertField(FieldType.FieldEquation, true);

    return field;
See Also