Shapes

Collect.Shapes méthode

Collecte toutes les instances de Shape dans la Presentation.

public static IEnumerable<Shape> Shapes(Presentation pres)
ParamètreTypeDescription
presPresentationPrésentation pour collecter des formes

Valeur de retour

Collection de toutes les formes contenues dans la présentation

Exemples

using (Presentation pres = new Presentation("pres.pptx"))
{
    foreach (Shape shape in Collect.Shapes(pres))
    {
        // si la forme est AutoShape, ajouter une bordure noire solide
        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);
}        

Voir aussi