Class PictureCollection
Contents
[
Hide
]PictureCollection class
Encapsulates a collection of Picture objects.
public class PictureCollection : CollectionBase<Picture>
Properties
| Name | Description |
|---|---|
| Capacity { get; set; } | |
| Count { get; } | |
| Item { get; } | Gets the Picture element at the specified index. |
| Item { get; set; } |
Methods
| Name | Description |
|---|---|
| Add(int, int, Stream) | Adds a picture to the collection. |
| Add(int, int, string) | Adds a picture to the collection. |
| Add(int, int, int, int, Stream) | Adds a picture to the collection. |
| Add(int, int, int, int, string) | Adds a picture to the collection. |
| Add(int, int, Stream, int, int) | Adds a picture to the collection. |
| Add(int, int, string, int, int) | Adds a picture to the collection. |
| BinarySearch(Picture) | |
| BinarySearch(Picture, IComparer<Picture>) | |
| BinarySearch(int, int, Picture, IComparer<Picture>) | |
| Camera(int, int, string) | Takes a photo of the range. |
| Clear() | Clear all pictures. (2 methods) |
| Contains(Picture) | |
| CopyTo(Picture[]) | |
| CopyTo(Picture[], int) | |
| CopyTo(int, Picture[], int, int) | |
| Exists(Predicate<Picture>) | |
| Find(Predicate<Picture>) | |
| FindAll(Predicate<Picture>) | |
| FindIndex(Predicate<Picture>) | |
| FindIndex(int, Predicate<Picture>) | |
| FindIndex(int, int, Predicate<Picture>) | |
| FindLast(Predicate<Picture>) | |
| FindLastIndex(Predicate<Picture>) | |
| FindLastIndex(int, Predicate<Picture>) | |
| FindLastIndex(int, int, Predicate<Picture>) | |
| GetEnumerator() | |
| IndexOf(Picture) | |
| IndexOf(Picture, int) | |
| IndexOf(Picture, int, int) | |
| LastIndexOf(Picture) | |
| LastIndexOf(Picture, int) | |
| LastIndexOf(Picture, int, int) | |
| RemoveAt(int) | Remove shapes at the specific index (2 methods) |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Drawing;
using System;
using System.IO;
public class PictureCollectionDemo
{
public static void PictureCollectionExample()
{
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Accessing the first worksheet in the workbook
Worksheet worksheet = workbook.Worksheets[0];
// Accessing the PictureCollection of the worksheet
PictureCollection pictures = worksheet.Pictures;
// Adding a picture using a file path
int pictureIndex1 = pictures.Add(1, 1, 5, 5, "PictureCollectionExample.jpg");
// Adding a picture using a stream
using (FileStream stream = new FileStream("PictureCollectionExample2.jpg", FileMode.Open))
{
int pictureIndex2 = pictures.Add(6, 1, 10, 5, stream);
}
// Adding a picture with scaling
int pictureIndex3 = pictures.Add(11, 1, "PictureCollectionExample3.jpg", 50, 50);
// Accessing a picture from the collection
Picture picture = pictures[pictureIndex1];
// Modifying the picture's properties
picture.Left = 10;
picture.Top = 10;
// Clearing all pictures from the collection
pictures.Clear();
// Saving the workbook
workbook.Save("PictureCollectionExample.xlsx");
}
}
}
See Also
- class CollectionBase<T>
- class Picture
- namespace Aspose.Cells.Drawing
- assembly Aspose.Cells