public class Portion extends java.lang.Object implements IPortion
Represents a portion of text inside a text paragraph.
Constructor and Description |
---|
Portion()
Initializes a new instance of the Portion class.
|
Portion(Portion portion)
Initializes a new instance of the Portion class.
|
Portion(java.lang.String str)
Initializes a new instance of the Portion class.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(IFieldType fieldType)
Converts this portion to the automaticaly updated field.
|
void |
addField(java.lang.String internalString)
Converts this portion to the automaticaly updated field.
|
IPortionFormatEffectiveData |
createPortionFormatEffective()
Deprecated.
Use Portion.PortionFormat.GetEffective() instead. The method will be removed after release of version 20.8.
|
java.awt.geom.Point2D.Float |
getCoordinates()
Get coordinates of the beginning of the portion.
|
IField |
getField()
Returns a field of this portion.
|
com.aspose.slides.IDOMObject |
getParent_Immediate()
Returns Parent_Immediate object.
|
IPortionFormat |
getPortionFormat()
Returns oformatting bject which contains explicitly set formatting properties of the text portion with no inheritance applied.
|
IPresentation |
getPresentation()
Returns the parent presentation of a text.
|
java.awt.geom.Rectangle2D.Float |
getRect()
Get coordinates of rect that bounds portion.
|
IBaseSlide |
getSlide()
Returns the parent slide of a text.
|
java.lang.String |
getText()
Gets or sets the plain text of a portion.
|
void |
removeField()
Converts this field portion to the simple portion.
|
void |
setText(java.lang.String value)
Gets or sets the plain text of a portion.
|
public Portion()
Initializes a new instance of the Portion class.
public Portion(java.lang.String str)
Initializes a new instance of the Portion class.
public Portion(Portion portion)
Initializes a new instance of the Portion class.
public final IPortionFormat getPortionFormat()
Returns oformatting bject which contains explicitly set formatting properties of the text portion with no inheritance applied.
Read-only IPortionFormat
.
The formatting object contains the formatting parameters defined for the current portion only, inherited data is not applied.
In order to get the effective values including inherited ones use the PortionFormat.getEffective()
method.
getPortionFormat
in interface IPortion
@Deprecated public final IPortionFormatEffectiveData createPortionFormatEffective()
Creates and returns PortionFormatEffectiveData
object which contains current portion formatting properties, including inherited.
createPortionFormatEffective
in interface IPortion
PortionFormatEffectiveData
instance.public final java.lang.String getText()
Gets or sets the plain text of a portion.
Read/write String
.
public final void setText(java.lang.String value)
Gets or sets the plain text of a portion.
Read/write String
.
public final void addField(IFieldType fieldType)
Converts this portion to the automaticaly updated field.
public final void addField(java.lang.String internalString)
Converts this portion to the automaticaly updated field.
public final void removeField()
Converts this field portion to the simple portion.
removeField
in interface IPortion
public final java.awt.geom.Rectangle2D.Float getRect()
Get coordinates of rect that bounds portion. The rect includes all the lines of text in portion, including empty ones.
Example:Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 200, 50); shape.getTextFrame().getParagraphs().get_Item(0).getPortions().clear(); Portion portion0 = new Portion("Some text"); Portion portion1 = new Portion("GetRect text"); shape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion0); shape.getTextFrame().getParagraphs().get_Item(0).getPortions().add(portion1); Rectangle2D.Float rect = shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(1).getRect(); ... } finally { if (pres != null) pres.dispose(); }
public final java.awt.geom.Point2D.Float getCoordinates()
Get coordinates of the beginning of the portion. The X coordinate of point represents the portion beginning from the first character including left side bearing. The Y coordinate includes top side bearing.
getCoordinates
in interface IPortion
public final IBaseSlide getSlide()
Returns the parent slide of a text.
Read-only BaseSlide
.
getSlide
in interface ISlideComponent
public final IPresentation getPresentation()
Returns the parent presentation of a text.
Read-only IPresentation
.
getPresentation
in interface IPresentationComponent
public final com.aspose.slides.IDOMObject getParent_Immediate()
Returns Parent_Immediate object.
Read-only IDOMObject
.