org.apache.poi.xssf.usermodel

## Class XSSFSimpleShape

- java.lang.Object
- - org.apache.poi.xssf.usermodel.XSSFShape
  - - org.apache.poi.xssf.usermodel.XSSFSimpleShape

- All Implemented Interfaces:
    java.lang.Iterable<XSSFTextParagraph>, Shape, SimpleShape, TextContainer
  Direct Known Subclasses:
    XSSFObjectData, XSSFTextBox

      public class XSSFSimpleShape
      extends XSSFShape
      implements java.lang.Iterable<XSSFTextParagraph>, SimpleShape, TextContainer

  Represents a shape with a predefined geometry in a SpreadsheetML drawing. Possible shape types are defined in `ShapeTypes`

- - ### Field Summary

    - ### Fields inherited from class org.apache.poi.xssf.usermodel.XSSFShape

      `anchor, drawing, parent`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `XSSFSimpleShape(XSSFDrawing drawing, org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape ctShape)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `XSSFTextParagraph` | `addNewTextParagraph()` Add a new paragraph run to this shape
    `XSSFTextParagraph` | `addNewTextParagraph(java.lang.String text)` Add a new paragraph run to this shape, set to the provided string
    `XSSFTextParagraph` | `addNewTextParagraph(XSSFRichTextString str)` Add a new paragraph run to this shape, set to the provided rich text string
    `void` | `clearText()` Clear all text from this shape
    `<R> java.util.Optional<R>` | `findDefinedParagraphProperty(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,java.lang.Boolean> isSet, java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,R> getter)`
    `<R> java.util.Optional<R>` | `findDefinedRunProperty(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,java.lang.Boolean> isSet, java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,R> getter)`
    `double` | `getBottomInset()` Returns the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text.
    `org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape` | `getCTShape()`
    `double` | `getLeftInset()` Returns the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text.
    `double` | `getRightInset()` Returns the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text.
    `int` | `getShapeId()`
    `java.lang.String` | `getShapeName()`
    `protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties` | `getShapeProperties()` Returns xml bean with shape properties.
    `int` | `getShapeType()` Gets the shape type, one of the constants defined in `ShapeTypes`.
    `java.lang.String` | `getText()` Returns the text from all paragraphs in the shape.
    `TextAutofit` | `getTextAutofit()`
    `XDDFTextBody` | `getTextBody()`
    `TextDirection` | `getTextDirection()` Gets the vertical orientation of the text
    `TextHorizontalOverflow` | `getTextHorizontalOverflow()` Returns the type of horizontal overflow for the text.
    `java.util.List<XSSFTextParagraph>` | `getTextParagraphs()` Returns a collection of the XSSFTextParagraphs that are attached to this shape
    `TextVerticalOverflow` | `getTextVerticalOverflow()` Returns the type of vertical overflow for the text.
    `double` | `getTopInset()` Returns the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text.
    `VerticalAlignment` | `getVerticalAlignment()` Returns the type of vertical alignment for the text within the shape.
    `boolean` | `getWordWrap()`
    `java.util.Iterator<XSSFTextParagraph>` | `iterator()`
    `protected static org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape` | `prototype()` Prototype with the default structure of a new auto-shape.
    `void` | `setBottomInset(double margin)` Sets the bottom inset.
    `void` | `setLeftInset(double margin)` Sets the left inset.
    `void` | `setRightInset(double margin)` Sets the right inset.
    `void` | `setShapeType(int type)` Sets the shape types.
    `void` | `setText(java.lang.String text)` Set a single paragraph of text on the shape.
    `void` | `setText(XSSFRichTextString str)` Set a single paragraph of text on the shape.
    `void` | `setTextAutofit(TextAutofit value)` Specifies that a shape should be auto-fit to fully contain the text described within it.
    `void` | `setTextDirection(TextDirection orientation)` Sets the vertical orientation of the text
    `void` | `setTextHorizontalOverflow(TextHorizontalOverflow overflow)` Sets the type of horizontal overflow for the text.
    `void` | `setTextVerticalOverflow(TextVerticalOverflow overflow)` Sets the type of vertical overflow for the text.
    `void` | `setTopInset(double margin)` Sets the top inset.
    `void` | `setVerticalAlignment(VerticalAlignment anchor)` Sets the type of vertical alignment for the text within the shape.
    `void` | `setWordWrap(boolean wrap)`
    `protected void` | `setXfrm(org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D t2d)`

    - ### Methods inherited from class org.apache.poi.xssf.usermodel.XSSFShape

      `getAnchor, getDrawing, getParent, isNoFill, setFillColor, setLineStyle, setLineStyleColor, setLineWidth, setNoFill`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

    - ### Methods inherited from interface org.apache.poi.ss.usermodel.Shape

      `getAnchor, getParent, isNoFill, setFillColor, setLineStyleColor, setNoFill`

- - ### Constructor Detail

    - #### XSSFSimpleShape

          protected XSSFSimpleShape(XSSFDrawing drawing,
                                    org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape ctShape)

  - ### Method Detail

    - #### prototype

          protected static org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape prototype()

      Prototype with the default structure of a new auto-shape.

    - #### getCTShape

          @Internal
          public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape getCTShape()

    - #### getTextBody

          @Beta
          public XDDFTextBody getTextBody()

    - #### setXfrm

          protected void setXfrm(org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D t2d)

    - #### iterator

          public java.util.Iterator<XSSFTextParagraph> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<XSSFTextParagraph>`

    - #### getText

          public java.lang.String getText()

      Returns the text from all paragraphs in the shape. Paragraphs are separated by new lines.
      Returns:
        text contained within this shape or empty string

    - #### clearText

          public void clearText()

      Clear all text from this shape

    - #### setText

          public void setText(java.lang.String text)

      Set a single paragraph of text on the shape. Note this will replace all existing paragraphs created on the shape.
      Parameters:
        `text` - string representing the paragraph text

    - #### setText

          public void setText(XSSFRichTextString str)

      Set a single paragraph of text on the shape. Note this will replace all existing paragraphs created on the shape.
      Parameters:
        `str` - rich text string representing the paragraph text

    - #### getTextParagraphs

          public java.util.List<XSSFTextParagraph> getTextParagraphs()

      Returns a collection of the XSSFTextParagraphs that are attached to this shape
      Returns:
        text paragraphs in this shape

    - #### addNewTextParagraph

          public XSSFTextParagraph addNewTextParagraph()

      Add a new paragraph run to this shape
      Returns:
        created paragraph run

    - #### addNewTextParagraph

          public XSSFTextParagraph addNewTextParagraph(java.lang.String text)

      Add a new paragraph run to this shape, set to the provided string
      Returns:
        created paragraph run

    - #### addNewTextParagraph

          public XSSFTextParagraph addNewTextParagraph(XSSFRichTextString str)

      Add a new paragraph run to this shape, set to the provided rich text string
      Returns:
        created paragraph run

    - #### setTextHorizontalOverflow

          public void setTextHorizontalOverflow(TextHorizontalOverflow overflow)

      Sets the type of horizontal overflow for the text.
      Parameters:
        `overflow` - - the type of horizontal overflow. A `null` values unsets this property.

    - #### getTextHorizontalOverflow

          public TextHorizontalOverflow getTextHorizontalOverflow()

      Returns the type of horizontal overflow for the text.
      Returns:
        the type of horizontal overflow

    - #### setTextVerticalOverflow

          public void setTextVerticalOverflow(TextVerticalOverflow overflow)

      Sets the type of vertical overflow for the text.
      Parameters:
        `overflow` - - the type of vertical overflow. A `null` values unsets this property.

    - #### getTextVerticalOverflow

          public TextVerticalOverflow getTextVerticalOverflow()

      Returns the type of vertical overflow for the text.
      Returns:
        the type of vertical overflow

    - #### setVerticalAlignment

          public void setVerticalAlignment(VerticalAlignment anchor)

      Sets the type of vertical alignment for the text within the shape.
      Parameters:
        `anchor` - - the type of alignment. A `null` values unsets this property.

    - #### getVerticalAlignment

          public VerticalAlignment getVerticalAlignment()

      Returns the type of vertical alignment for the text within the shape.
      Returns:
        the type of vertical alignment

    - #### setTextDirection

          public void setTextDirection(TextDirection orientation)

      Sets the vertical orientation of the text
      Parameters:
        `orientation` - vertical orientation of the text A `null` values unsets this property.

    - #### getTextDirection

          public TextDirection getTextDirection()

      Gets the vertical orientation of the text
      Returns:
        vertical orientation of the text

    - #### getBottomInset

          public double getBottomInset()

      Returns the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text.
      Returns:
        the bottom inset in points

    - #### getLeftInset

          public double getLeftInset()

      Returns the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text.
      Returns:
        the left inset in points

    - #### getRightInset

          public double getRightInset()

      Returns the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text.
      Returns:
        the right inset in points

    - #### getTopInset

          public double getTopInset()

      Returns the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text.
      Returns:
        the top inset in points

    - #### setBottomInset

          public void setBottomInset(double margin)

      Sets the bottom inset.
      Parameters:
        `margin` - the bottom margin
      See Also:
        `getBottomInset()`

    - #### setLeftInset

          public void setLeftInset(double margin)

      Sets the left inset.
      Parameters:
        `margin` - the left margin
      See Also:
        `getLeftInset()`

    - #### setRightInset

          public void setRightInset(double margin)

      Sets the right inset.
      Parameters:
        `margin` - the right margin
      See Also:
        `getRightInset()`

    - #### setTopInset

          public void setTopInset(double margin)

      Sets the top inset.
      Parameters:
        `margin` - the top margin
      See Also:
        `getTopInset()`

    - #### getWordWrap

          public boolean getWordWrap()

      Returns:
        whether to wrap words within the bounding rectangle

    - #### setWordWrap

          public void setWordWrap(boolean wrap)

      Parameters:
        `wrap` - whether to wrap words within the bounding rectangle

    - #### setTextAutofit

          public void setTextAutofit(TextAutofit value)

      Specifies that a shape should be auto-fit to fully contain the text described within it. Auto-fitting is when text within a shape is scaled in order to contain all the text inside
      Parameters:
        `value` - type of autofit

    - #### getTextAutofit

          public TextAutofit getTextAutofit()

      Returns:
        type of autofit

    - #### getShapeType

          public int getShapeType()

      Gets the shape type, one of the constants defined in `ShapeTypes`.
      Returns:
        the shape type
      See Also:
        `ShapeTypes`

    - #### setShapeType

          public void setShapeType(int type)

      Sets the shape types.
      Parameters:
        `type` - the shape type, one of the constants defined in `ShapeTypes`.
      See Also:
        `ShapeTypes`

    - #### getShapeProperties

          protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getShapeProperties()

      Description copied from class: `XSSFShape`
      Returns xml bean with shape properties.
      Specified by:
        `getShapeProperties` in class `XSSFShape`
      Returns:
        xml bean with shape properties.

    - #### getShapeName

          public java.lang.String getShapeName()

      Specified by:
        `getShapeName` in interface `Shape`
      Returns:
        the name of this shape

    - #### getShapeId

          public int getShapeId()

      Specified by:
        `getShapeId` in interface `SimpleShape`
      Returns:
        the shape id, which is unique within the sheet

    - #### findDefinedParagraphProperty

          public <R> java.util.Optional<R> findDefinedParagraphProperty(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,java.lang.Boolean> isSet,
                                                                        java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,R> getter)

      Specified by:
        `findDefinedParagraphProperty` in interface `TextContainer`

    - #### findDefinedRunProperty

          public <R> java.util.Optional<R> findDefinedRunProperty(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,java.lang.Boolean> isSet,
                                                                  java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,R> getter)

      Specified by:
        `findDefinedRunProperty` in interface `TextContainer`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.