.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

PictureCollection Interface

A collection of Picture objects.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.2.Core.dll

Declaration

public interface PictureCollection :
    ISimpleCollection<Picture>,
    IEnumerable<Picture>,
    IEnumerable,
    ICollection
Public Interface PictureCollection
    Inherits ISimpleCollection(Of Picture),
             IEnumerable(Of Picture),
             IEnumerable,
             ICollection
public interface PictureCollection :
    ISimpleCollection<Picture>,
    IEnumerable<Picture>,
    IEnumerable,
    ICollection
Public Interface PictureCollection
    Inherits ISimpleCollection(Of Picture),
             IEnumerable(Of Picture),
             IEnumerable,
             ICollection
public interface PictureCollection :
    ISimpleCollection<Picture>,
    IEnumerable<Picture>,
    IEnumerable,
    ICollection
Public Interface PictureCollection
    Inherits ISimpleCollection(Of Picture),
             IEnumerable(Of Picture),
             IEnumerable,
             ICollection

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