Interface TextShape<S extends Shape<S,​P>,​P extends TextParagraph<S,​P,​? extends TextRun>>

    • Method Detail

      • getText

        java.lang.String getText()
        Returns the text contained in this text frame, which has been made safe for printing and other use.
        Returns:
        the text string for this textbox.
        Since:
        POI 3.14-Beta2
      • setText

        TextRun setText​(java.lang.String text)
        Sets (overwrites) the current text. Uses the properties of the first paragraph / textrun. Text paragraphs are split by \\r or \\n. New lines within text run are split by \\u000b
        Parameters:
        text - the text string used by this object.
        Returns:
        the last text run of the - potential split - text
      • appendText

        TextRun appendText​(java.lang.String text,
                           boolean newParagraph)
        Adds the supplied text onto the end of the TextParagraphs, creating a new RichTextRun for it to sit in.
        Parameters:
        text - the text string to be appended.
        newParagraph - if true, a new paragraph will be added, which will contain the added text
        Since:
        POI 3.14-Beta1
      • getTextParagraphs

        java.util.List<P> getTextParagraphs()
        Returns:
        the TextParagraphs for this text box
      • getInsets

        Insets2D getInsets()
        Returns:
        text shape margin
      • setInsets

        void setInsets​(Insets2D insets)
        Sets the shape margins
        Parameters:
        insets - the new shape margins
      • getTextHeight

        double getTextHeight()
        Compute the cumulative height occupied by the text
        Returns:
        the cumulative height occupied by the text
      • getTextHeight

        double getTextHeight​(java.awt.Graphics2D graphics)
        Compute the cumulative height occupied by the text
        Parameters:
        graphics - a customized graphics context, e.g. which contains font mappings
        Returns:
        the cumulative height occupied by the text
        Since:
        POI 3.17-beta2
      • getVerticalAlignment

        VerticalAlignment getVerticalAlignment()
        Returns the type of vertical alignment for the text.
        Returns:
        the type of vertical alignment
      • setVerticalAlignment

        void setVerticalAlignment​(VerticalAlignment vAlign)
        Sets the type of vertical alignment for the text.
        Parameters:
        vAlign - - the type of alignment. A null values unsets this property.
      • isHorizontalCentered

        boolean isHorizontalCentered()
        Returns if the text is centered. If true and if the individual paragraph settings allow it, the whole text block will be displayed centered, i.e. its left and right margin will be maximized while still keeping the alignment of the paragraphs
        Returns:
        true, if the text anchor is horizontal centered
      • setHorizontalCentered

        void setHorizontalCentered​(java.lang.Boolean isCentered)
        Sets if the paragraphs are horizontal centered
        Parameters:
        isCentered - true, if the paragraphs are horizontal centered A null values unsets this property.
      • getWordWrap

        boolean getWordWrap()
        Returns:
        whether to wrap words within the bounding rectangle
      • setWordWrap

        void setWordWrap​(boolean wrap)
        Parameters:
        wrap - whether to wrap words within the bounding rectangle
      • setTextDirection

        void setTextDirection​(TextShape.TextDirection orientation)
        sets the vertical orientation
        Parameters:
        orientation - vertical orientation of the text
      • getTextRotation

        java.lang.Double getTextRotation()
        The text rotation can be independent specified from the shape rotation. For XSLF this can be an arbitrary degree, for HSLF the degree is given in steps of 90 degrees
        Returns:
        text rotation in degrees, returns null if no rotation is given
      • setTextRotation

        void setTextRotation​(java.lang.Double rotation)
        Sets the text rotation. For XSLF this can ben an arbitrary degree, for HSLF the rotation is rounded to next 90 degree step
        Parameters:
        rotation - the text rotation, or null to unset the rotation
      • resizeToFitText

        java.awt.geom.Rectangle2D resizeToFitText()
        Adjust the size of the shape so it encompasses the text inside it.
        Returns:
        a Rectangle2D that is the bounds of this shape.
        Since:
        POI 3.17-beta2
      • resizeToFitText

        java.awt.geom.Rectangle2D resizeToFitText​(java.awt.Graphics2D graphics)
        Adjust the size of the shape so it encompasses the text inside it.
        Parameters:
        graphics - a customized graphics context, e.g. which contains font mappings
        Returns:
        a Rectangle2D that is the bounds of this shape.
        Since:
        POI 3.17-beta2