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 IAutoShape

Inheritance

IGeometryShape -> GeometryShape -> AutoShape


GeometryShape Properties

PropertyTypeAccessDescription
getX() / setX(double)doubleRead/WriteX position in points.
getY() / setY(double)doubleRead/WriteY position in points.
getWidth() / setWidth(double)doubleRead/WriteWidth in points.
getHeight() / setHeight(double)doubleRead/WriteHeight in points.
getRotation() / setRotation(double)doubleRead/WriteRotation angle in degrees.
getShapeType() / setShapeType(ShapeType)ShapeTypeRead/WritePreset geometry type.
getName() / setName(String)StringRead/WriteShape name.
getAlternativeText() / setAlternativeText(String)StringRead/WriteAlt text for accessibility.
getAlternativeTextTitle() / setAlternativeTextTitle(String)StringRead/WriteAlt text title.
isHidden() / setHidden(boolean)booleanRead/WriteWhether the shape is hidden.
getZOrderPosition()intReadZ-order position.
getFillFormat()IFillFormatReadFill formatting.
getLineFormat()ILineFormatReadLine formatting.
getEffectFormat()IEffectFormatReadEffect formatting.
getThreeDFormat()IThreeDFormatRead3-D formatting.
getShapeStyle()IShapeStyleReadShape style.
getPlaceholder()IPlaceholderReadPlaceholder info (if applicable).
getFrame() / setFrame(IShapeFrame)IShapeFrameRead/WriteShape frame (position and size).
getAdjustments()IAdjustValueCollectionReadGeometry adjustment values.

AutoShape Properties & Methods

Property / MethodTypeDescription
getTextFrame()ITextFrameText frame associated with this shape.
isTextBox()booleanWhether this shape is a text box.
addTextFrame(String text)ITextFrameAdd a text frame with the given text.
getFillFormat()IFillFormatFill 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);

See Also