The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

PictureCollection.GetPicturesByName(String) Method

Gets picture(s) by name.

Namespace: DevExpress.Spreadsheet

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

Declaration

IList<Picture> GetPicturesByName(string pictureName)
Function GetPicturesByName(pictureName As String) As IList(Of Picture)
IList<Picture> GetPicturesByName(string pictureName)
Function GetPicturesByName(pictureName As String) As IList(Of Picture)

Parameters

Name Type Description
pictureName String

A string that is the name of a picture.

Parameters

Name Type Description
pictureName String

A string that is the name of a picture.

Returns

Type Description
IList<Picture>

A collection of pictures with the same name.

Returns

Type Description
IList<Picture>

A collection of pictures with the same name.

Remarks

A picture name is specified by the Shape.Name property. A worksheet may contain more than one picture with the same name. In this situation, the IList<T><Picture,> collection returned by the GetPicturesByName method contains several items.

If a picture with the specified name is not found, the method returns an empty list.

Examples

Dim imageStream As Stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Pictures.x-spreadsheet.png")
Dim imageSource As SpreadsheetImageSource = SpreadsheetImageSource.FromStream(imageStream)
workbook.BeginUpdate()
' Set the measurement unit to Millimeter.
workbook.Unit = DevExpress.Office.DocumentUnit.Millimeter
Try
    Dim worksheet As Worksheet = workbook.Worksheets(0)
    ' Insert a picture from a file so that its top left corner is in the specified cell.
    ' By default the picture is named Picture1.. PictureNN.
    worksheet.Pictures.AddPicture("Pictures\x-docserver.png", worksheet.Cells("D5"))
    ' Insert a picture to fit in the specified range.
    worksheet.Pictures.AddPicture("Pictures\x-docserver.png", worksheet.Range("B2"))
    ' Insert a picture from the SpreadsheetImageSource at 120 mm from the left, 80 mm from the top, 
    ' and resize it to a width of 70 mm and a height of 20 mm, locking the aspect ratio.
    worksheet.Pictures.AddPicture(imageSource, 120, 80, 70, 20, True)
    ' Insert the picture to be removed.
    worksheet.Pictures.AddPicture("Pictures\x-docserver.png", 0, 0)
    ' Remove the last inserted picture.
    ' Find the Picture by its name. The method returns a collection of Pictures with the same name.
    Dim pic As Picture = worksheet.Pictures.GetPicturesByName("Picture 4")(0)
    pic.Delete()
Finally
    workbook.EndUpdate()
End Try
See Also