Paragraph

Inheritance: java.lang.Object

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

public final class Paragraph implements IParagraph, IDOMObject

Represents a paragraph of text.

Constructors

ConstructorDescription
Paragraph()Initializes a new instance of the Paragraph class with default properties.
Paragraph(Paragraph para)Copy constructor that initializes a new instance of a Paragraph class.

Methods

MethodDescription
getPortions()Returns the collection of a text portions.
getParagraphFormat()Returns the formatting object for this paragraph.
joinPortionsWithSameFormatting()Joins runs with same formatting.
getText()Gets or sets the the plain text of a paragraph.
setText(String value)Gets or sets the the plain text of a paragraph.
getRect()Get coordinates of rect that bounds paragraph.
getLinesCount()Get number of lines in a paragraph.
getEndParagraphPortionFormat()Specifies the portion properties that are to be used if another portion is inserted after the last one.
setEndParagraphPortionFormat(IPortionFormat value)Specifies the portion properties that are to be used if another portion is inserted after the last one.
getParent_Immediate()
getSlide()Returns the parent slide of a paragraph.
getPresentation()Returns the parent presentation of a paragraph.

Paragraph()

public Paragraph()

Initializes a new instance of the Paragraph class with default properties.

Paragraph(Paragraph para)

public Paragraph(Paragraph para)

Copy constructor that initializes a new instance of a Paragraph class.

Parameters:

ParameterTypeDescription
paraParagraph

getPortions()

public final IPortionCollection getPortions()

Returns the collection of a text portions. Read-only IPortionCollection.

Returns: IPortionCollection

getParagraphFormat()

public final IParagraphFormat getParagraphFormat()

Returns the formatting object for this paragraph. Read-only IParagraphFormat.


The formatting object contains the formatting parameters defined for the current paragraph only, inherited data is not applied.

In order to get the effective values including inherited ones use the ParagraphFormat.getEffective method.

Returns: IParagraphFormat

joinPortionsWithSameFormatting()

public final void joinPortionsWithSameFormatting()

Joins runs with same formatting.

getText()

public final String getText()

Gets or sets the the plain text of a paragraph. Read/write String.

Value: The text.

Returns: java.lang.String

setText(String value)

public final void setText(String value)

Gets or sets the the plain text of a paragraph. Read/write String.

Value: The text.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getRect()

public final Rectangle2D.Float getRect()

Get coordinates of rect that bounds paragraph. The rect includes all the lines of text in paragraph, including empty ones.

Returns: java.awt.geom.Rectangle2D.Float

getLinesCount()

public final int getLinesCount()

Get number of lines in a paragraph.


Example:
 
 Presentation pres = new Presentation();
 try {
     ISlide sld = pres.getSlides().get_Item(0);
     IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 150, 75, 150, 50);
     IParagraph para = ashp.getTextFrame().getParagraphs().get_Item(0);
     IPortion portion = para.getPortions().get_Item(0);
     portion.setText("Aspose Paragraph GetLinesCount() Example");
     System.out.println("Lines Count = " + para.getLinesCount());
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: int - Lines count in a paragraph

getEndParagraphPortionFormat()

public final IPortionFormat getEndParagraphPortionFormat()

Specifies the portion properties that are to be used if another portion is inserted after the last one.

Returns: IPortionFormat

setEndParagraphPortionFormat(IPortionFormat value)

public final void setEndParagraphPortionFormat(IPortionFormat value)

Specifies the portion properties that are to be used if another portion is inserted after the last one.

Parameters:

ParameterTypeDescription
valueIPortionFormat

getParent_Immediate()

public final IDOMObject getParent_Immediate()

Returns Parent_Immediate object. Read-only IDOMObject.

Returns: com.aspose.slides.IDOMObject

getSlide()

public final IBaseSlide getSlide()

Returns the parent slide of a paragraph. Read-only BaseSlide.

Returns: IBaseSlide

getPresentation()

public final IPresentation getPresentation()

Returns the parent presentation of a paragraph. Read-only IPresentation.

Returns: IPresentation