Class FunctionEquationNode

FunctionEquationNode class

This class specifies the Function-Apply equation, which consists of a function name and an argument acted upon. The types of the name and argument components are ‘EquationNodeType.FunctionName’ and ‘EquationNodeType.Base’ respectively.

public class FunctionEquationNode : EquationNode

Properties

NameDescription
EquationType { get; }Get the equation type of the current node(Inherited from EquationNode.)
Font { get; }Returns the font of this object.(Inherited from FontSetting.)
Length { get; }Gets the length of the characters.(Inherited from FontSetting.)
ParentNode { get; set; }Specifies the parent node of the current node(Inherited from EquationNode.)
StartIndex { get; }Gets the start index of the characters.(Inherited from FontSetting.)
TextOptions { get; }Returns the text options.(Inherited from FontSetting.)
override Type { get; }Represents the type of the node.(Inherited from EquationNode.)

Methods

NameDescription
AddChild(EquationNode)Inserts the specified node at the end of the current node’s list of child nodes.(Inherited from EquationNode.)
AddChild(EquationNodeType)Insert a node of the specified type at the end of the child node list of the current node.(Inherited from EquationNode.)
override Equals(object)Determine whether the current equation node is equal to the specified node
GetChild(int)Returns the node at the specified index among the children of the current node.(Inherited from EquationNode.)
InsertAfter(EquationNodeType)Inserts the specified node after the current node.(Inherited from EquationNode.)
InsertBefore(EquationNodeType)Inserts the specified node before the current node.(Inherited from EquationNode.)
InsertChild(int, EquationNodeType)Inserts a node of the specified type at the specified index position in the current node’s child node list.(Inherited from EquationNode.)
Remove()Removes itself from the parent.(Inherited from EquationNode.)
RemoveAllChildren()Removes all the child nodes of the current node.(Inherited from EquationNode.)
RemoveChild(EquationNode)Removes the specified node from the current node’s children.(Inherited from EquationNode.)
RemoveChild(int)Removes the node at the specified index from the current node’s children.(Inherited from EquationNode.)
SetWordArtStyle(PresetWordArtStyle)Sets the preset WordArt style.(Inherited from FontSetting.)
ToLaTeX()Convert this equtation to LaTeX expression.(Inherited from EquationNode.)
ToMathML()Convert this equtation to MathML expression.(Inherited from EquationNode.)

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using Aspose.Cells.Drawing.Texts;
using Aspose.Cells.Drawing.Equations;

namespace AsposeCellsExamples
{
    public class EquationsClassFunctionEquationNodeDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Add an equation to the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];
            TextBox textBox = worksheet.Shapes.AddTextBox(3, 0, 3, 0, 100, 200);

            // Get the equation's root node
            EquationNode mathNode = textBox.GetEquationParagraph().GetChild(0);

            // Create a function node with superscripted name
            FunctionEquationNode functionNode = (FunctionEquationNode)mathNode.AddChild(EquationNodeType.Function);

            // Add function name with superscript
            EquationNode functionName = functionNode.AddChild(EquationNodeType.FunctionName);
            EquationNode supNode = functionName.AddChild(EquationNodeType.Sup);

            // Add base text for function name
            EquationNode baseNode = supNode.AddChild(EquationNodeType.Base);
            TextRunEquationNode baseText = (TextRunEquationNode)baseNode.AddChild(EquationNodeType.Text);
            baseText.Text = "Add";

            // Add superscript text
            EquationNode superscriptNode = supNode.AddChild(EquationNodeType.Superscript);
            TextRunEquationNode superscriptText = (TextRunEquationNode)superscriptNode.AddChild(EquationNodeType.Text);
            superscriptText.Text = "-2";

            // Add function argument
            EquationNode baseArg = functionNode.AddChild(EquationNodeType.Base);
            TextRunEquationNode argText = (TextRunEquationNode)baseArg.AddChild(EquationNodeType.Text);
            argText.Text = "x";

            // Save the workbook
            workbook.Save("FunctionEquationDemo.xlsx");
        }
    }
}

See Also