Class Collect

Class Collect

Namespace: Aspose.Slides.LowCode
Assembly: Aspose.Slides.dll (25.12.0)

Represents a group of methods intended to collect model objects of different types from Aspose.Slides.Presentation.

public static class Collect

Inheritance

object Collect

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    foreach (Shape shape in Collect.Shapes(pres))
    {
        // ... change shape formatting or other properties
    }
}

Methods

Shapes(Presentation)

Collects all instances of Aspose.Slides.Shape in the Aspose.Slides.Presentation.

public static IEnumerable<Shape> Shapes(Presentation pres)

Parameters

pres Presentation

Presentation to collect shapes

Returns

IEnumerable < Shape >

Collection of all shapes that contain in the presentation

Examples

using (Presentation pres = new Presentation("pres.pptx"))
{
    foreach (Shape shape in Collect.Shapes(pres))
    {
        // if the shape is AutoShape, add a black solid border
        if (shape is AutoShape autoShape)
        {
            autoShape.LineFormat.Style = LineStyle.Single;
            autoShape.LineFormat.Width = 10f;
            autoShape.LineFormat.FillFormat.FillType = FillType.Solid;
            autoShape.LineFormat.FillFormat.SolidFillColor.Color = Color.Black;
        }
    }

    pres.Save("pres-out.pptx", SaveFormat.Pptx);
}