Skip to main content
Row

PictureCollection Interface

A collection of Picture objects.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public interface PictureCollection :
    ISimpleCollection<Picture>,
    IEnumerable<Picture>,
    IEnumerable,
    ICollection

The following members return PictureCollection objects:

Remarks

The Worksheet.Pictures property returns a PictureCollection object. To add an image to a worksheet, use the PictureCollection.AddPicture method.

The PictureCollection.GetPicturesByName method allows you to obtain all pictures with the specified name in the collection. To find a picture by its unique ID, use the PictureCollection.GetPictureById method.

If a picture belongs to a shape group, it doesn’t appear in the PictureCollection. To obtain such pictures, you can use the ShapeCollection.Flatten method of the Worksheet.Shapes collection. This method returns a collection of all drawing objects contained in a worksheet, including items of shape groups. Use the ShapeType property to filter this collection by type, as shown in the example below.

using System.Linq;
// ...

var pictures = worksheet.Shapes.Flatten()
    .Where(x => x.ShapeType == ShapeType.Picture)
    .Cast<Picture>();

To delete a picture from a worksheet, use the PictureCollection.RemoveAt or Picture.Delete method.

See Also