Shapes

Collect.Shapes method

Recopila todas las instancias de Shape en la Presentation.

public static IEnumerable<Shape> Shapes(Presentation pres)
ParámetroTipoDescripción
presPresentationPresentación para recopilar formas

Valor de retorno

Colección de todas las formas que contiene la presentación

Ejemplos

using (Presentation pres = new Presentation("pres.pptx"))
{
    foreach (Shape shape in Collect.Shapes(pres))
    {
        // si la forma es AutoShape, añade un borde sólido negro
        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);
}        

Ver también