MathParagraph

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.slides.IMathParagraph, com.aspose.slides.IDOMObject

public class MathParagraph implements IMathParagraph, IDOMObject

Mathematical paragraph that is a container for mathematical blocks (IMathBlock)


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.setJustification(MathJustification.LeftJustified);

Constructors

ConstructorDescription
MathParagraph()Initializes a new instance of the MathParagraph class.
MathParagraph(IMathBlock mathBlock)Initializes a new instance of the MathParagraph class.

Methods

MethodDescription
getJustification()Paragraph Justification Default value: CenteredAsGroup
setJustification(int value)Paragraph Justification Default value: CenteredAsGroup
getParent_Immediate()Returns Parent_Immediate object.
getCount()Gets the number of elements actually contained in the collection.
get_Item(int index)Gets the item at the specified index.
set_Item(int index, IMathBlock value)Gets the item at the specified index.
clear()Removes all elements from the collection.
add(IMathBlock mathBlock)Adds IMathBlock to the end of collection.
remove(IMathBlock mathBlock)Removes the first occurrence of a specific object from the collection.
contains(IMathBlock mathBlock)Determines whether the collection contains a specific value.
indexOf(IMathBlock mathBlock)Determines the index of a specific IMathBlock in collection.
insert(int index, IMathBlock mathBlock)Inserts IMathBlock into the collection at the specified index.
removeAt(int index)Removes an item at the specified index of the collection.
iterator()
iteratorJava()
writeAsMathMl(OutputStream stream)Saves content of this MathParagraph as MathML
toLatex()Gets mathematical equation in LaTeX format

MathParagraph()

public MathParagraph()

Initializes a new instance of the MathParagraph class.


Example:
 
 MathParagraph mathParagraph = new MathParagraph();

MathParagraph(IMathBlock mathBlock)

public MathParagraph(IMathBlock mathBlock)

Initializes a new instance of the MathParagraph class.


Example:
 
 MathParagraph mathParagraph = new MathParagraph(new MathBlock());

Parameters:

ParameterTypeDescription
mathBlockIMathBlock

getJustification()

public final int getJustification()

Paragraph Justification Default value: CenteredAsGroup


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.setJustification(MathJustification.LeftJustified);

Returns: int

setJustification(int value)

public final void setJustification(int value)

Paragraph Justification Default value: CenteredAsGroup


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.setJustification(MathJustification.LeftJustified);

Parameters:

ParameterTypeDescription
valueint

getParent_Immediate()

public final IDOMObject getParent_Immediate()

Returns Parent_Immediate object. Read-only IDOMObject.

Returns: com.aspose.slides.IDOMObject

getCount()

public final int getCount()

Gets the number of elements actually contained in the collection. Read-only int.


Example:
 
 MathParagraph mathParagraph = new MathParagraph();
 int blocksCount = mathParagraph.getCount();

Returns: int

get_Item(int index)

public final IMathBlock get_Item(int index)

Gets the item at the specified index. Read-only IMathBlock.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.add(new MathBlock(new MathematicalText("block1")));
 mathParagraph.add(new MathBlock(new MathematicalText("block2")));
 IMathBlock block = mathParagraph.get_Item(1);

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the item to get

Returns: IMathBlock - The block of a mathematical text.

set_Item(int index, IMathBlock value)

public final void set_Item(int index, IMathBlock value)

Gets the item at the specified index. Read-only IMathBlock.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.add(new MathBlock(new MathematicalText("block1")));
 mathParagraph.add(new MathBlock(new MathematicalText("block2")));
 IMathBlock block = mathParagraph.get_Item(1);

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the item to get
valueIMathBlockThe block of a mathematical text.

clear()

public final void clear()

Removes all elements from the collection.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.add(new MathBlock(new MathematicalText("block1")));
 mathParagraph.add(new MathBlock(new MathematicalText("block2")));
 mathParagraph.clear();

add(IMathBlock mathBlock)

public final void add(IMathBlock mathBlock)

Adds IMathBlock to the end of collection.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.add(new MathBlock(new MathematicalText("x")));

Parameters:

ParameterTypeDescription
mathBlockIMathBlockA mathematical block that will be added to the end of the collection

remove(IMathBlock mathBlock)

public final boolean remove(IMathBlock mathBlock)

Removes the first occurrence of a specific object from the collection.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.add(new MathBlock(new MathematicalText("x")));
 IMathBlock block = new MathBlock(new MathematicalText("y"));
 mathParagraph.add(block);
 mathParagraph.remove(block);

Parameters:

ParameterTypeDescription
mathBlockIMathBlockThe object to remove from the collection.

Returns: boolean - true if mathBlock was successfully removed from the collection; otherwise, false. This method also returns false if mathBlock is not found in the original collection.

contains(IMathBlock mathBlock)

public final boolean contains(IMathBlock mathBlock)

Determines whether the collection contains a specific value.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 IMathBlock block = new MathBlock(new MathematicalText("y"));
 mathParagraph.add(block);
 boolean contains = mathParagraph.contains(block);

Parameters:

ParameterTypeDescription
mathBlockIMathBlockThe object to locate in the collection.

Returns: boolean - true if mathBlock is found in the collection; otherwise, false.

indexOf(IMathBlock mathBlock)

public final int indexOf(IMathBlock mathBlock)

Determines the index of a specific IMathBlock in collection.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 IMathBlock block = new MathBlock(new MathematicalText("y"));
 mathParagraph.add(block);
 int index = mathParagraph.indexOf(block);

Parameters:

ParameterTypeDescription
mathBlockIMathBlockThe item to locate in the collection.

Returns: int - The index of mathBlock if found in the collection; otherwise, -1.

insert(int index, IMathBlock mathBlock)

public final void insert(int index, IMathBlock mathBlock)

Inserts IMathBlock into the collection at the specified index.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 IMathBlock block = new MathBlock(new MathematicalText("y"));
 mathParagraph.insert(0, block);

Parameters:

ParameterTypeDescription
indexintThe zero-based index at which an item should be inserted.
mathBlockIMathBlockThe IMathBlock to insert.

removeAt(int index)

public final void removeAt(int index)

Removes an item at the specified index of the collection.


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 IMathBlock block = new MathBlock(new MathematicalText("y"));
 mathParagraph.add(block);
 mathParagraph.removeAt(0);

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the item to remove.

iterator()

public final System.Collections.Generic.IGenericEnumerator<IMathBlock> iterator()

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.slides.IMathBlock>

iteratorJava()

public final System.Collections.IEnumerator iteratorJava()

Returns: com.aspose.ms.System.Collections.IEnumerator

writeAsMathMl(OutputStream stream)

public final void writeAsMathMl(OutputStream stream)

Saves content of this MathParagraph as MathML

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamTarget stream

toLatex()

public final String toLatex()

Gets mathematical equation in LaTeX format


Example:
 
 IAutoShape shape = slide.getShapes().addMathShape(x, y, width, height);
 IMathParagraph mathParagraph = ((MathPortion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph();
 mathParagraph.add(new MathematicalText("a").join("+").join(new MathematicalText("b").join("=").join(new MathematicalText("c"))));
 String mathLatex = mathParagraph.toLatex();

Returns: java.lang.String