LayoutSlideCollection Class
Represents a collection of layout slides grouped under a specific master slide.
public sealed class LayoutSlideCollection : SlideObjectCollection<LayoutSlide>, IList, ICollection, IList<LayoutSlide>, ICollection<LayoutSlide>, IEnumerable<LayoutSlide>, IEnumerable
Public NotInheritable Class LayoutSlideCollection
Inherits SlideObjectCollection(Of LayoutSlide)
Implements IList, ICollection, IList(Of LayoutSlide), ICollection(Of LayoutSlide), IEnumerable(Of LayoutSlide), IEnumerable
- Inheritance:
- System.ObjectLayoutSlideCollection
Implements
Properties
Count
Gets the number of LayoutSlides contained in the collection.
Property Value
- System.Int32
The number of LayoutSlides contained in the collection.
Item[SlideLayoutType]
Gets the LayoutSlide with the specified type of layout, if found; otherwise, null.
public LayoutSlide this[SlideLayoutType layoutType] { get; }
Public ReadOnly Property Item(layoutType As SlideLayoutType) As LayoutSlide
Parameters
layoutType
- SlideLayoutType
Type of the layout of the LayoutSlide.
Property Value
The LayoutSlide with the specified type of layout, if found; otherwise, null.
Item[Int32]
Gets or sets the LayoutSlide at the specified index.
public LayoutSlide this[int index] { get; set; }
Public Property Item(index As Integer) As LayoutSlide
Parameters
index
- System.Int32
The zero-based index of the LayoutSlide to get or set.
Property Value
The LayoutSlide at the specified index.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or index
is equal to or greater than Count.
- System.ArgumentNullException
value
is null.
- System.ArgumentException
value
is already contained in another LayoutSlideCollection or it belongs to another PresentationDocument.
Item[String]
Gets the LayoutSlide with the specified name, if found; otherwise, null.
public LayoutSlide this[string name] { get; }
Public ReadOnly Property Item(name As String) As LayoutSlide
Parameters
name
- System.String
Name of the LayoutSlide.
Property Value
The LayoutSlide with the specified name, if found; otherwise, null.
Methods
Add(LayoutSlide)
Adds a LayoutSlide to the end of the collection.
Parameters
item
- LayoutSlide
The LayoutSlide to be added to the end of the collection.
Exceptions
- System.ArgumentNullException
item
is null.
- System.ArgumentException
item
is already contained in another LayoutSlideCollection or it belongs to another PresentationDocument.
AddClone(LayoutSlide)
Adds a clone of the source
LayoutSlide to the end of the collection. Clone will be formatted using the destination theme.
public LayoutSlide AddClone(LayoutSlide source)
Public Function AddClone(source As LayoutSlide) As LayoutSlide
Parameters
source
- LayoutSlide
The source LayoutSlide that will be cloned.
Returns
A clone of the source
LayoutSlide added to the collection.
Remarks
Cloning is a process when one or more objects from a presentation are duplicated. Objects can be duplicated to the same or another presentation and to the same or another location (for example, to another slide).
Cloning methods are available on collection types, such as SlideCollection, DrawingCollection, TextParagraphCollection or TextElementCollection. Exception is the PresentationDocument type that has a Clone() method used to make a deep clone of the entire presentation. Cloning methods available on the collection types have two forms: AddClone(Slide) and InsertClone(Int32, Slide) to append the duplicate to the collection or insert it into a specific location in the collection.
Objects contained in the presentation can contain references to other objects. For example, Slide contains a reference to its ParentTemplate, Connector can contain a reference to drawings that it connects (BeginConnection and EndConnection), Action can contain a Target to Slide or CustomSlideShow that should be shown when the action is triggered.
When cloning multiple objects, the desired behavior is to maintain these references in the duplicated objects so that, for example, when Connector is cloned, and later when drawings that it connects are cloned, the duplicated Connector also connects duplicates of the original drawings that are connected.
This reference mapping between an original object and its duplicate is maintained by the instance of the CloneContext type. CloneContext instance is created with Create(PresentationDocument, PresentationDocument) static method. Each object can be cloned exactly once using the same CloneContext instance. If you want to clone the same object multiple times, each time a new CloneContext instance must be used. CloneContext is the most useful when cloning multiple objects one after another or when you want to change a behavior of the cloning operation.
Behavior of the cloning operation can be changed by using Set<T>(T, T) method. With this method you can make an explicit mapping between objects and cloning process will respect that mapping. For example, if you are cloning a Slide instance to another PresentationDocument default behavior would be that its parent template LayoutSlide and MasterSlide would also be cloned to another PresentationDocument. This behavior can be changed by making an explicit mapping from the LayoutSlide that is the ParentTemplate of the Slide that will be cloned to some LayoutSlide in the another PresentationDocument that we wish to be a ParentTemplate of the duplicated Slide. Explicit mapping with Set<T>(T, T) method can currently be made between following type (and their derivatives) instances: SlideObject, Drawing, TableStyle and CustomSlideShow.
Exceptions
- System.ArgumentNullException
source
parameter is null.
AddClone(LayoutSlide, CloneContext)
Adds a clone of the source
LayoutSlide to the end of the collection.
public LayoutSlide AddClone(LayoutSlide source, CloneContext context)
Public Function AddClone(source As LayoutSlide, context As CloneContext) As LayoutSlide
Parameters
source
- LayoutSlide
The source LayoutSlide that will be cloned.
context
- CloneContext
The context used to maintain reference mapping in multiple cloning operations.
Returns
A clone of the source
LayoutSlide added to the collection.
Remarks
Cloning is a process when one or more objects from a presentation are duplicated. Objects can be duplicated to the same or another presentation and to the same or another location (for example, to another slide).
Cloning methods are available on collection types, such as SlideCollection, DrawingCollection, TextParagraphCollection or TextElementCollection. Exception is the PresentationDocument type that has a Clone() method used to make a deep clone of the entire presentation. Cloning methods available on the collection types have two forms: AddClone(Slide) and InsertClone(Int32, Slide) to append the duplicate to the collection or insert it into a specific location in the collection.
Objects contained in the presentation can contain references to other objects. For example, Slide contains a reference to its ParentTemplate, Connector can contain a reference to drawings that it connects (BeginConnection and EndConnection), Action can contain a Target to Slide or CustomSlideShow that should be shown when the action is triggered.
When cloning multiple objects, the desired behavior is to maintain these references in the duplicated objects so that, for example, when Connector is cloned, and later when drawings that it connects are cloned, the duplicated Connector also connects duplicates of the original drawings that are connected.
This reference mapping between an original object and its duplicate is maintained by the instance of the CloneContext type. CloneContext instance is created with Create(PresentationDocument, PresentationDocument) static method. Each object can be cloned exactly once using the same CloneContext instance. If you want to clone the same object multiple times, each time a new CloneContext instance must be used. CloneContext is the most useful when cloning multiple objects one after another or when you want to change a behavior of the cloning operation.
Behavior of the cloning operation can be changed by using Set<T>(T, T) method. With this method you can make an explicit mapping between objects and cloning process will respect that mapping. For example, if you are cloning a Slide instance to another PresentationDocument default behavior would be that its parent template LayoutSlide and MasterSlide would also be cloned to another PresentationDocument. This behavior can be changed by making an explicit mapping from the LayoutSlide that is the ParentTemplate of the Slide that will be cloned to some LayoutSlide in the another PresentationDocument that we wish to be a ParentTemplate of the duplicated Slide. Explicit mapping with Set<T>(T, T) method can currently be made between following type (and their derivatives) instances: SlideObject, Drawing, TableStyle and CustomSlideShow.
Exceptions
- System.ArgumentNullException
source
or context
parameter is null.
- System.ArgumentException
source
is not associated with the SourcePresentation or the current collection is not associated with the DestinationPresentation of the context
.
AddNew(SlideLayoutType)
Adds a new LayoutSlide with the specified type of layout to the end of the collection.
public LayoutSlide AddNew(SlideLayoutType layoutType)
Public Function AddNew(layoutType As SlideLayoutType) As LayoutSlide
Parameters
layoutType
- SlideLayoutType
The type of layout of a new LayoutSlide.
Returns
A new LayoutSlide with the specified type of layout added to the collection.
Clear()
Removes all LayoutSlides from the collection.
Contains(LayoutSlide)
Determines whether a LayoutSlide is in the collection.
public bool Contains(LayoutSlide item)
Public Function Contains(item As LayoutSlide) As Boolean
Parameters
item
- LayoutSlide
The LayoutSlide to locate in the collection.
Returns
- System.Boolean
true if item
is found in the collection; otherwise, false.
Exceptions
- System.ArgumentNullException
item
is null.
GetEnumerator()
Returns an enumerator that iterates through the LayoutSlideCollection.
public IEnumerator<LayoutSlide> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of LayoutSlide)
Returns
- System.Collections.Generic.IEnumerator<LayoutSlide>
An System.Collections.Generic.IEnumerator<T> for the collection.
IndexOf(LayoutSlide)
Searches for the specified LayoutSlide and returns the zero-based index of the first occurrence within the entire collection.
Parameters
item
- LayoutSlide
The LayoutSlide to locate in the collection.
Returns
- System.Int32
The zero-based index of the first occurrence of item
within the entire collection, if found; otherwise, -1.
Insert(Int32, LayoutSlide)
Inserts a LayoutSlide to the collection at the specified index.
public void Insert(int index, LayoutSlide item)
Public Sub Insert(index As Integer, item As LayoutSlide)
Parameters
index
- System.Int32
The zero-based index at which LayoutSlide should be inserted.
item
- LayoutSlide
The LayoutSlide to insert into the collection.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or index
is equal to or greater than Count.
- System.ArgumentNullException
item
is null.
- System.ArgumentException
item
is already contained in another LayoutSlideCollection or it belongs to another PresentationDocument.
InsertClone(Int32, LayoutSlide)
Inserts a clone of the source
LayoutSlide to the collection at the specified index. Clone will be formatted using the destination theme.
public LayoutSlide InsertClone(int index, LayoutSlide source)
Public Function InsertClone(index As Integer, source As LayoutSlide) As LayoutSlide
Parameters
index
- System.Int32
The zero-based index at which clone of the source
LayoutSlide should be inserted.
source
- LayoutSlide
The source LayoutSlide that will be cloned.
Returns
A clone of the source
LayoutSlide inserted to the collection.
Remarks
Cloning is a process when one or more objects from a presentation are duplicated. Objects can be duplicated to the same or another presentation and to the same or another location (for example, to another slide).
Cloning methods are available on collection types, such as SlideCollection, DrawingCollection, TextParagraphCollection or TextElementCollection. Exception is the PresentationDocument type that has a Clone() method used to make a deep clone of the entire presentation. Cloning methods available on the collection types have two forms: AddClone(Slide) and InsertClone(Int32, Slide) to append the duplicate to the collection or insert it into a specific location in the collection.
Objects contained in the presentation can contain references to other objects. For example, Slide contains a reference to its ParentTemplate, Connector can contain a reference to drawings that it connects (BeginConnection and EndConnection), Action can contain a Target to Slide or CustomSlideShow that should be shown when the action is triggered.
When cloning multiple objects, the desired behavior is to maintain these references in the duplicated objects so that, for example, when Connector is cloned, and later when drawings that it connects are cloned, the duplicated Connector also connects duplicates of the original drawings that are connected.
This reference mapping between an original object and its duplicate is maintained by the instance of the CloneContext type. CloneContext instance is created with Create(PresentationDocument, PresentationDocument) static method. Each object can be cloned exactly once using the same CloneContext instance. If you want to clone the same object multiple times, each time a new CloneContext instance must be used. CloneContext is the most useful when cloning multiple objects one after another or when you want to change a behavior of the cloning operation.
Behavior of the cloning operation can be changed by using Set<T>(T, T) method. With this method you can make an explicit mapping between objects and cloning process will respect that mapping. For example, if you are cloning a Slide instance to another PresentationDocument default behavior would be that its parent template LayoutSlide and MasterSlide would also be cloned to another PresentationDocument. This behavior can be changed by making an explicit mapping from the LayoutSlide that is the ParentTemplate of the Slide that will be cloned to some LayoutSlide in the another PresentationDocument that we wish to be a ParentTemplate of the duplicated Slide. Explicit mapping with Set<T>(T, T) method can currently be made between following type (and their derivatives) instances: SlideObject, Drawing, TableStyle and CustomSlideShow.
Exceptions
- System.ArgumentNullException
source
parameter is null.
InsertClone(Int32, LayoutSlide, CloneContext)
Inserts a clone of the source
LayoutSlide to the collection at the specified index.
public LayoutSlide InsertClone(int index, LayoutSlide source, CloneContext context)
Public Function InsertClone(index As Integer, source As LayoutSlide, context As CloneContext) As LayoutSlide
Parameters
index
- System.Int32
The zero-based index at which clone of the source
LayoutSlide should be inserted.
source
- LayoutSlide
The source LayoutSlide that will be cloned.
context
- CloneContext
The context used to maintain reference mapping in multiple cloning operations.
Returns
A clone of the source
LayoutSlide inserted to the collection.
Remarks
Cloning is a process when one or more objects from a presentation are duplicated. Objects can be duplicated to the same or another presentation and to the same or another location (for example, to another slide).
Cloning methods are available on collection types, such as SlideCollection, DrawingCollection, TextParagraphCollection or TextElementCollection. Exception is the PresentationDocument type that has a Clone() method used to make a deep clone of the entire presentation. Cloning methods available on the collection types have two forms: AddClone(Slide) and InsertClone(Int32, Slide) to append the duplicate to the collection or insert it into a specific location in the collection.
Objects contained in the presentation can contain references to other objects. For example, Slide contains a reference to its ParentTemplate, Connector can contain a reference to drawings that it connects (BeginConnection and EndConnection), Action can contain a Target to Slide or CustomSlideShow that should be shown when the action is triggered.
When cloning multiple objects, the desired behavior is to maintain these references in the duplicated objects so that, for example, when Connector is cloned, and later when drawings that it connects are cloned, the duplicated Connector also connects duplicates of the original drawings that are connected.
This reference mapping between an original object and its duplicate is maintained by the instance of the CloneContext type. CloneContext instance is created with Create(PresentationDocument, PresentationDocument) static method. Each object can be cloned exactly once using the same CloneContext instance. If you want to clone the same object multiple times, each time a new CloneContext instance must be used. CloneContext is the most useful when cloning multiple objects one after another or when you want to change a behavior of the cloning operation.
Behavior of the cloning operation can be changed by using Set<T>(T, T) method. With this method you can make an explicit mapping between objects and cloning process will respect that mapping. For example, if you are cloning a Slide instance to another PresentationDocument default behavior would be that its parent template LayoutSlide and MasterSlide would also be cloned to another PresentationDocument. This behavior can be changed by making an explicit mapping from the LayoutSlide that is the ParentTemplate of the Slide that will be cloned to some LayoutSlide in the another PresentationDocument that we wish to be a ParentTemplate of the duplicated Slide. Explicit mapping with Set<T>(T, T) method can currently be made between following type (and their derivatives) instances: SlideObject, Drawing, TableStyle and CustomSlideShow.
Exceptions
- System.ArgumentNullException
source
or context
parameter is null.
- System.ArgumentException
source
is not associated with the SourcePresentation or the current collection is not associated with the DestinationPresentation of the context
.
InsertNew(Int32, SlideLayoutType)
Inserts a new LayoutSlide with the specified type of layout to the collection at the specified index.
public LayoutSlide InsertNew(int index, SlideLayoutType layoutType)
Public Function InsertNew(index As Integer, layoutType As SlideLayoutType) As LayoutSlide
Parameters
index
- System.Int32
The zero-based index at which new LayoutSlide should be inserted.
layoutType
- SlideLayoutType
The type of layout of a new LayoutSlide.
Returns
A new LayoutSlide with the specified type of layout inserted to the collection.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or index
is equal to or greater than Count.
Remove(LayoutSlide)
Removes the first occurrence of a specific LayoutSlide from the collection.
Parameters
item
- LayoutSlide
The LayoutSlide to remove from the collection.
Returns
- System.Boolean
true if item
is successfully removed; otherwise, false. This method also returns false if item
was not found in the original collection.
RemoveAt(Int32)
Removes the LayoutSlide at the specified index of the collection.
Parameters
index
- System.Int32
The zero-based index of the LayoutSlide to remove.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or index
is equal to or greater than Count.