Interface IPictures
Represents a collection of IPicture in a slide.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IPictures : IEnumerable<IPicture>, IEnumerable
Properties
Count
Returns the number of pictures present in the picture collection.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total count of the picture. |
Examples
//Create an instance for PowerPoint
IPresentation presentation = Presentation.Create();
//Add a blank slide to presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold picture collection
IPictures pictures = slide.Pictures;
//Create an instance for image as stream
Stream imageStream = File.Open("Image.gif", FileMode.Open);
//Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100);
//Create an instance for image as stream
Stream stream = File.Open("pptxtoimage.png", FileMode.Open);
//Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300);
//Get the count of picture collection
int count = pictures.Count;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create an instance for PowerPoint
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold picture collection
Dim pictures As IPictures = slide.Pictures
'Create an instance for image as stream
Dim imageStream As Stream = File.Open("Image.gif", FileMode.Open)
'Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100)
'Create an instance for image as stream
Dim stream As Stream = File.Open("pptxtoimage.png", FileMode.Open)
'Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300)
'Get the count of picture collection
Dim count As Integer = pictures.Count
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets the picture at the specified index.
Declaration
IPicture this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index value of the picture collection. |
Property Value
Type | Description |
---|---|
IPicture | Specified index value of picture from the picture collection. |
Examples
//Create an instance for PowerPoint
IPresentation presentation = Presentation.Create();
//Add a blank slide to presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold picture collection
IPictures pictures = slide.Pictures;
//Create an instance for image as stream
Stream imageStream = File.Open("Image.gif", FileMode.Open);
//Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100);
//Create an instance for image as stream
Stream stream = File.Open("pptxtoimage.png", FileMode.Open);
//Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300);
//Retrieve a specific picture from the collection, read only
IPicture picture = pictures[0];
//Set the description
picture.Description = "My picture";
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create an instance for PowerPoint
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold picture collection
Dim pictures As IPictures = slide.Pictures
'Create an instance for image as stream
Dim imageStream As Stream = File.Open("Image.gif", FileMode.Open)
'Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100)
'Create an instance for image as stream
Dim stream As Stream = File.Open("pptxtoimage.png", FileMode.Open)
'Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300)
'Retrieve a specific picture from the collection, read only
Dim picture As IPicture = pictures(0)
'Set the description
picture.Description = "My picture"
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Methods
AddPicture(Stream, Double, Double, Double, Double)
Declaration
IPicture AddPicture(Stream stream, double left, double top, double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Double | left | Represents the left position, in points. The Left value ranges from -169056 to 169056. |
System.Double | top | Represents the top position, in points. The Top value ranges from -169056 to 169056. |
System.Double | width | Represents the width, in points. The Width value ranges from 0 to 169056. |
System.Double | height | Represents the height, in points. The Height value ranges from 0 to 169056. |
Returns
Type | Description |
---|---|
IPicture | Returns an IPicture instance. |
Examples
//Create an instance for PowerPoint
IPresentation presentation = Presentation.Create();
//Add a blank slide to presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold picture collection
IPictures pictures = slide.Pictures;
//Create an instance for image as stream
Stream imageStream = File.Open("Image.gif", FileMode.Open);
//Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100);
//Create an instance for image as stream
Stream stream = File.Open("pptxtoimage.png", FileMode.Open);
//Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create an instance for PowerPoint
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold picture collection
Dim pictures As IPictures = slide.Pictures
'Create an instance for image as stream
Dim imageStream As Stream = File.Open("Image.gif", FileMode.Open)
'Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100)
'Create an instance for image as stream
Dim stream As Stream = File.Open("pptxtoimage.png", FileMode.Open)
'Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
AddPicture(Stream, Stream, Double, Double, Double, Double)
Creates a picture from the specified svg, its fallback image stream and adds the picture to the picture collection.
Declaration
IPicture AddPicture(Stream svgStream, Stream imageStream, double left, double top, double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | svgStream | The System.IO.Stream instance of SVG image. |
System.IO.Stream | imageStream | The System.IO.Stream instance of fallback image. |
System.Double | left | Represents the left position, in points. The Left value ranges from -169056 to 169056. |
System.Double | top | Represents the top position, in points. The Top value ranges from -169056 to 169056. |
System.Double | width | Represents the width, in points. The Width value ranges from 0 to 169056. |
System.Double | height | Represents the height, in points. The Height value ranges from 0 to 169056. |
Returns
Type | Description |
---|---|
IPicture | Returns an IPicture instance. |
Examples
//Create an instance for PowerPoint
IPresentation presDoc = Presentation.Create();
//Add a blank slide to presentation
ISlide slide = presDoc.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold picture collection
IPictures pictures = slide.Pictures;
//Create an instance for fallback image as stream
Stream imageStream = File.Open("Image.gif", FileMode.Open);
//Create an instance for vector image as stream
Stream svgStream = File.Open("Image.svg", FileMode.Open);
//Add picture to the picture collection
pictures.AddPicture(svgStream, imageStream, 373, 83, 200, 100);
//Save the presentation
presDoc.Save("Sample.pptx");
//Close the presentation
presDoc.Close();
'Create an instance for PowerPoint
Dim presDoc As IPresentation = Presentation.Create()
'Add a blank slide to presentation
Dim slide As ISlide = presDoc.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold picture collection
Dim pictures As IPictures = slide.Pictures
'Create an instance for fallback image as stream
Dim imageStream As Stream = File.Open("Image.gif", FileMode.Open)
'Create an instance for vector image as stream
Dim svgStream As Stream = File.Open("Image.svg", FileMode.Open)
'Add picture to the picture collection
pictures.AddPicture(svgStream, imageStream, 373, 83, 200, 100)
'Save the presentation
presDoc.Save("Sample.pptx")
'Close the presentation
presDoc.Close()
IndexOf(IPicture)
Returns the index of first occurrence of the specified picture instance from the collection.
Declaration
int IndexOf(IPicture picture)
Parameters
Type | Name | Description |
---|---|---|
IPicture | picture | Represents the picture from the collection. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first occurrence of picture within the picture collection, if found; otherwise, –1. |
Examples
//Create an instance for PowerPoint
IPresentation presentation = Presentation.Create();
//Add a blank slide to presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold picture collection
IPictures pictures = slide.Pictures;
//Create an instance for image as stream
Stream imageStream = File.Open("Image.gif", FileMode.Open);
//Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100);
//Create an instance for image as stream
Stream stream = File.Open("pptxtoimage.png", FileMode.Open);
//Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300);
//Retrieve a specific picture from the collection, read only
IPicture picture = pictures[0];
//Get the index of specific picture instance
int index = pictures.IndexOf(picture);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create an instance for PowerPoint
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold picture collection
Dim pictures As IPictures = slide.Pictures
'Create an instance for image as stream
Dim imageStream As Stream = File.Open("Image.gif", FileMode.Open)
'Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100)
'Create an instance for image as stream
Dim stream As Stream = File.Open("pptxtoimage.png", FileMode.Open)
'Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300)
'Retrieve a specific picture from the collection, read only
Dim picture As IPicture = pictures(0)
'Get the index of specific picture instance
Dim index As Integer = pictures.IndexOf(picture)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Remove(IPicture)
Removes the first occurrence of the specified picture object from the picture collection
Declaration
void Remove(IPicture picture)
Parameters
Type | Name | Description |
---|---|---|
IPicture | picture | Represents the picture to be removed from the collection. |
Examples
//Create an instance for PowerPoint
IPresentation presentation = Presentation.Create();
//Add a blank slide to presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold picture collection
IPictures pictures = slide.Pictures;
//Create an instance for image as stream
Stream imageStream = File.Open("Image.gif", FileMode.Open);
//Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100);
//Create an instance for image as stream
Stream stream = File.Open("pptxtoimage.png", FileMode.Open);
//Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300);
//Retrieve a specific picture from the collection, read only
IPicture picture = pictures[0];
//Remove a specific picture from collection
pictures.Remove(picture);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create an instance for PowerPoint
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold picture collection
Dim pictures As IPictures = slide.Pictures
'Create an instance for image as stream
Dim imageStream As Stream = File.Open("Image.gif", FileMode.Open)
'Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100)
'Create an instance for image as stream
Dim stream As Stream = File.Open("pptxtoimage.png", FileMode.Open)
'Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300)
'Retrieve a specific picture from the collection, read only
Dim picture As IPicture = pictures(0)
'Remove a specific picture from collection
pictures.Remove(picture)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
RemoveAt(Int32)
Removes the picture from the collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the first occurrence of the picture within the picture collection, if found; otherwise, –1. |
Examples
//Create an instance for PowerPoint
IPresentation presentation = Presentation.Create();
//Add a blank slide to presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Create instance to hold picture collection
IPictures pictures = slide.Pictures;
//Create an instance for image as stream
Stream imageStream = File.Open("Image.gif", FileMode.Open);
//Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100);
//Create an instance for image as stream
Stream stream = File.Open("pptxtoimage.png", FileMode.Open);
//Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300);
//Remove a picture using index position
pictures.RemoveAt(0);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create an instance for PowerPoint
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Create instance to hold picture collection
Dim pictures As IPictures = slide.Pictures
'Create an instance for image as stream
Dim imageStream As Stream = File.Open("Image.gif", FileMode.Open)
'Add picture to the picture collection
pictures.AddPicture(imageStream, 373, 83, 200, 100)
'Create an instance for image as stream
Dim stream As Stream = File.Open("pptxtoimage.png", FileMode.Open)
'Add picture to the shape collection
pictures.AddPicture(stream, 100, 20, 200, 300)
'Remove a picture using index position
pictures.RemoveAt(0)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()