Shape / GeometryShape / AutoShape — Aspose.Slides FOSS for Java API Reference
GeometryShape is the base class for shapes with geometry, backed by an OOXML shape element. AutoShape extends it with text frame support. Both implement IGeometryShape / IAutoShape.
Package: org.aspose.slides.foss
import org.aspose.slides.foss.*;public class GeometryShape implements IGeometryShape
public class AutoShape extends GeometryShape implements IAutoShapeInheritance
IGeometryShape -> GeometryShape -> AutoShape
GeometryShape Properties
| Property | Type | Access | Description |
|---|---|---|---|
getX() / setX(double) | double | Read/Write | X position in points. |
getY() / setY(double) | double | Read/Write | Y position in points. |
getWidth() / setWidth(double) | double | Read/Write | Width in points. |
getHeight() / setHeight(double) | double | Read/Write | Height in points. |
getRotation() / setRotation(double) | double | Read/Write | Rotation angle in degrees. |
getShapeType() / setShapeType(ShapeType) | ShapeType | Read/Write | Preset geometry type. |
getName() / setName(String) | String | Read/Write | Shape name. |
getAlternativeText() / setAlternativeText(String) | String | Read/Write | Alt text for accessibility. |
getAlternativeTextTitle() / setAlternativeTextTitle(String) | String | Read/Write | Alt text title. |
isHidden() / setHidden(boolean) | boolean | Read/Write | Whether the shape is hidden. |
getZOrderPosition() | int | Read | Z-order position. |
getFillFormat() | IFillFormat | Read | Fill formatting. |
getLineFormat() | ILineFormat | Read | Line formatting. |
getEffectFormat() | IEffectFormat | Read | Effect formatting. |
getThreeDFormat() | IThreeDFormat | Read | 3-D formatting. |
getShapeStyle() | IShapeStyle | Read | Shape style. |
getPlaceholder() | IPlaceholder | Read | Placeholder info (if applicable). |
getFrame() / setFrame(IShapeFrame) | IShapeFrame | Read/Write | Shape frame (position and size). |
getAdjustments() | IAdjustValueCollection | Read | Geometry adjustment values. |
AutoShape Properties & Methods
| Property / Method | Type | Description |
|---|---|---|
getTextFrame() | ITextFrame | Text frame associated with this shape. |
isTextBox() | boolean | Whether this shape is a text box. |
addTextFrame(String text) | ITextFrame | Add a text frame with the given text. |
getFillFormat() | IFillFormat | Fill formatting (overrides base). |
Usage Examples
Create a Rectangle Shape
import org.aspose.slides.foss.*;
Presentation prs = new Presentation();
ISlide slide = prs.getSlides().get(0);
IAutoShape rect = slide.getShapes().addAutoShape(
ShapeType.RECTANGLE, 100, 100, 200, 80);
rect.addTextFrame("Hello!");
prs.save("shape.pptx", SaveFormat.PPTX);Set Shape Properties
IAutoShape shape = slide.getShapes().addAutoShape(
ShapeType.ELLIPSE, 50, 50, 150, 150);
shape.setName("MyCircle");
shape.setAlternativeText("A circle shape");
shape.setRotation(45.0);