Shape — Aspose.Slides FOSS for .NET API Reference

The Shape class is the base class for all shapes on a slide, including AutoShape, GeometryShape, GroupShape, Connector, PictureFrame, and GraphicalObject. It provides position, size, fill, line, effect, and 3-D formatting.

Package: Aspose.Slides.Foss (net9.0)

using Aspose.Slides.Foss;
public class Shape : PVIObject, IShape

Inheritance

PVIObjectShape

Subclasses: GeometryShapeAutoShape, Connector, PictureFrame; GraphicalObjectTable; GroupShape


Properties

PropertyTypeAccessDescription
NamestringReadShape name.
UniqueIdintReadUnique shape identifier within the presentation.
XfloatReadHorizontal position in points.
YfloatReadVertical position in points.
WidthfloatReadWidth in points.
HeightfloatReadHeight in points.
RotationfloatReadRotation angle in degrees.
HiddenboolReadWhether the shape is hidden.
ZOrderPositionintReadZ-order stacking position.
FillFormatIFillFormatReadFill settings (solid, gradient, pattern, picture).
LineFormatILineFormatReadLine/border settings.
EffectFormatIEffectFormatReadVisual effect settings (shadow, glow, etc.).
ThreeDFormatIThreeDFormatRead3-D formatting (bevel, extrusion, camera).
FrameIShapeFrameReadPosition and size as a ShapeFrame object.
RawFrameIShapeFrameReadRaw (unadjusted) frame from the XML.
PlaceholderIPlaceholder?ReadPlaceholder metadata, if any.
IsTextHolderboolReadWhether the shape can hold text.
IsGroupedboolReadWhether the shape belongs to a group.
IsDecorativeboolReadWhether the shape is marked as decorative.
AlternativeTextstringReadAlt text for accessibility.
AlternativeTextTitlestringReadAlt text title.
ConnectionSiteCountintReadNumber of connection sites on the shape.
CustomDataICustomData?ReadCustom data attached to the shape.
OfficeInteropShapeIdintReadShape ID used by Office interop.

Usage Examples

Read Shape Properties

using Aspose.Slides.Foss;

using var prs = new Presentation("deck.pptx");
foreach (var slide in prs.Slides)
{
    foreach (var shape in slide.Shapes)
    {
        Console.WriteLine($"{shape.Name}: {shape.Width}x{shape.Height} at ({shape.X},{shape.Y})");
    }
}

Check Fill Type

using Aspose.Slides.Foss;

using var prs = new Presentation("deck.pptx");
var shape = prs.Slides[0].Shapes[0];
Console.WriteLine($"Fill type: {shape.FillFormat.FillType}");
if (shape.FillFormat.FillType == FillType.Solid)
{
    Console.WriteLine($"Color: {shape.FillFormat.SolidFillColor.Color}");
}

See Also