com.aspose.slides

Interfaces

Classes

Exceptions

com.aspose.slides

Interface IPortion

    • Method Detail

      • getPortionFormat

        IPortionFormat getPortionFormat()

        Returns formatting object 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 IPortionFormat.getEffective() method.

      • getText

        java.lang.String getText()

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

        Value: The text.
      • setText

        void setText(java.lang.String value)

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

        Value: The text.
      • getField

        IField getField()

        Returns a field of this portion. Read-only IField.

      • addField

        void addField(IFieldType fieldType)

        Converts this portion to the automaticaly updated field.

      • addField

        void addField(java.lang.String internalString)

        Converts this portion to the automaticaly updated field.

        Parameters:
        internalString - Internal name of FieldTypeEx.
      • removeField

        void removeField()

        Converts this field portion to the simple portion.

      • getRect

        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();
         }
         
      • getCoordinates

        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.