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, IShapeInheritance
PVIObject → Shape
Subclasses: GeometryShape → AutoShape, Connector, PictureFrame; GraphicalObject → Table; GroupShape
Properties
| Property | Type | Access | Description |
|---|---|---|---|
Name | string | Read | Shape name. |
UniqueId | int | Read | Unique shape identifier within the presentation. |
X | float | Read | Horizontal position in points. |
Y | float | Read | Vertical position in points. |
Width | float | Read | Width in points. |
Height | float | Read | Height in points. |
Rotation | float | Read | Rotation angle in degrees. |
Hidden | bool | Read | Whether the shape is hidden. |
ZOrderPosition | int | Read | Z-order stacking position. |
FillFormat | IFillFormat | Read | Fill settings (solid, gradient, pattern, picture). |
LineFormat | ILineFormat | Read | Line/border settings. |
EffectFormat | IEffectFormat | Read | Visual effect settings (shadow, glow, etc.). |
ThreeDFormat | IThreeDFormat | Read | 3-D formatting (bevel, extrusion, camera). |
Frame | IShapeFrame | Read | Position and size as a ShapeFrame object. |
RawFrame | IShapeFrame | Read | Raw (unadjusted) frame from the XML. |
Placeholder | IPlaceholder? | Read | Placeholder metadata, if any. |
IsTextHolder | bool | Read | Whether the shape can hold text. |
IsGrouped | bool | Read | Whether the shape belongs to a group. |
IsDecorative | bool | Read | Whether the shape is marked as decorative. |
AlternativeText | string | Read | Alt text for accessibility. |
AlternativeTextTitle | string | Read | Alt text title. |
ConnectionSiteCount | int | Read | Number of connection sites on the shape. |
CustomData | ICustomData? | Read | Custom data attached to the shape. |
OfficeInteropShapeId | int | Read | Shape 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}");
}