GemBox.Presentation
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    MasterSlideCollection Class

    Namespace:
    GemBox.Presentation
    Assembly:
    GemBox.Presentation.dll

    Represents a collection of master slides contained in the presentation.

    • C#
    • VB.NET
    public sealed class MasterSlideCollection : SlideObjectCollection<MasterSlide>, IList, ICollection, IList<MasterSlide>, ICollection<MasterSlide>, IEnumerable<MasterSlide>, IEnumerable
    Public NotInheritable Class MasterSlideCollection
        Inherits SlideObjectCollection(Of MasterSlide)
        Implements IList, ICollection, IList(Of MasterSlide), ICollection(Of MasterSlide), IEnumerable(Of MasterSlide), IEnumerable
    Inheritance:
    System.Object
    Collection
    Collection<MasterSlide>
    SlideObjectCollection<MasterSlide>
    MasterSlideCollection
    Implements
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<MasterSlide>
    System.Collections.Generic.ICollection<MasterSlide>
    System.Collections.Generic.IEnumerable<MasterSlide>
    System.Collections.IEnumerable

    Properties

    Count

    Gets the number of MasterSlides contained in the collection.

    • C#
    • VB.NET
    public int Count { get; }
    Public ReadOnly Property Count As Integer
    Property Value
    System.Int32

    The number of MasterSlides contained in the collection.

    Item[Int32]

    Gets or sets the MasterSlide at the specified index.

    • C#
    • VB.NET
    public MasterSlide this[int index] { get; set; }
    Public Property Item(index As Integer) As MasterSlide
    Parameters
    index
    System.Int32

    The zero-based index of the MasterSlide to get or set.

    Property Value
    MasterSlide

    The MasterSlide 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 MasterSlideCollection or it belongs to another PresentationDocument.

    Item[String]

    Gets the MasterSlide with the specified name, if found; otherwise, null.

    • C#
    • VB.NET
    public MasterSlide this[string name] { get; }
    Public ReadOnly Property Item(name As String) As MasterSlide
    Parameters
    name
    System.String

    Name of the MasterSlide.

    Property Value
    MasterSlide

    The MasterSlide with the specified name, if found; otherwise, null.

    Methods

    Add(MasterSlide)

    Adds a MasterSlide to the end of the collection.

    • C#
    • VB.NET
    public void Add(MasterSlide item)
    Public Sub Add(item As MasterSlide)
    Parameters
    item
    MasterSlide

    The MasterSlide to be added to the end of the collection.

    Exceptions
    System.ArgumentNullException

    item is null.

    System.ArgumentException

    item is already contained in another MasterSlideCollection or it belongs to another PresentationDocument.

    AddClone(MasterSlide)

    Adds a clone of the source MasterSlide to the end of the collection. Clone will be formatted using the destination theme.

    • C#
    • VB.NET
    public MasterSlide AddClone(MasterSlide source)
    Public Function AddClone(source As MasterSlide) As MasterSlide
    Parameters
    source
    MasterSlide

    The source MasterSlide that will be cloned.

    Returns
    MasterSlide

    A clone of the source MasterSlide 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(MasterSlide, CloneContext)

    Adds a clone of the source MasterSlide to the end of the collection.

    • C#
    • VB.NET
    public MasterSlide AddClone(MasterSlide source, CloneContext context)
    Public Function AddClone(source As MasterSlide, context As CloneContext) As MasterSlide
    Parameters
    source
    MasterSlide

    The source MasterSlide that will be cloned.

    context
    CloneContext

    The context used to maintain reference mapping in multiple cloning operations.

    Returns
    MasterSlide

    A clone of the source MasterSlide 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()

    Adds a new MasterSlide to the end of the collection.

    • C#
    • VB.NET
    public MasterSlide AddNew()
    Public Function AddNew As MasterSlide
    Returns
    MasterSlide

    A new MasterSlide added to the collection.

    Clear()

    Removes all MasterSlides from the collection.

    • C#
    • VB.NET
    public void Clear()
    Public Sub Clear

    Contains(MasterSlide)

    Determines whether a MasterSlide is in the collection.

    • C#
    • VB.NET
    public bool Contains(MasterSlide item)
    Public Function Contains(item As MasterSlide) As Boolean
    Parameters
    item
    MasterSlide

    The MasterSlide 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 MasterSlideCollection.

    • C#
    • VB.NET
    public IEnumerator<MasterSlide> GetEnumerator()
    Public Function GetEnumerator As IEnumerator(Of MasterSlide)
    Returns
    System.Collections.Generic.IEnumerator<MasterSlide>

    An System.Collections.Generic.IEnumerator<T> for the collection.

    IndexOf(MasterSlide)

    Searches for the specified MasterSlide and returns the zero-based index of the first occurrence within the entire collection.

    • C#
    • VB.NET
    public int IndexOf(MasterSlide item)
    Public Function IndexOf(item As MasterSlide) As Integer
    Parameters
    item
    MasterSlide

    The MasterSlide 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, MasterSlide)

    Inserts a MasterSlide to the collection at the specified index.

    • C#
    • VB.NET
    public void Insert(int index, MasterSlide item)
    Public Sub Insert(index As Integer, item As MasterSlide)
    Parameters
    index
    System.Int32

    The zero-based index at which MasterSlide should be inserted.

    item
    MasterSlide

    The MasterSlide 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 MasterSlideCollection or it belongs to another PresentationDocument.

    InsertClone(Int32, MasterSlide)

    Inserts a clone of the source MasterSlide to the collection at the specified index. Clone will be formatted using the destination theme.

    • C#
    • VB.NET
    public MasterSlide InsertClone(int index, MasterSlide source)
    Public Function InsertClone(index As Integer, source As MasterSlide) As MasterSlide
    Parameters
    index
    System.Int32

    The zero-based index at which clone of the source MasterSlide should be inserted.

    source
    MasterSlide

    The source MasterSlide that will be cloned.

    Returns
    MasterSlide

    A clone of the source MasterSlide 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, MasterSlide, CloneContext)

    Inserts a clone of the source MasterSlide to the collection at the specified index.

    • C#
    • VB.NET
    public MasterSlide InsertClone(int index, MasterSlide source, CloneContext context)
    Public Function InsertClone(index As Integer, source As MasterSlide, context As CloneContext) As MasterSlide
    Parameters
    index
    System.Int32

    The zero-based index at which clone of the source MasterSlide should be inserted.

    source
    MasterSlide

    The source MasterSlide that will be cloned.

    context
    CloneContext

    The context used to maintain reference mapping in multiple cloning operations.

    Returns
    MasterSlide

    A clone of the source MasterSlide 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)

    Inserts a new MasterSlide to the collection at the specified index.

    • C#
    • VB.NET
    public MasterSlide InsertNew(int index)
    Public Function InsertNew(index As Integer) As MasterSlide
    Parameters
    index
    System.Int32

    The zero-based index at which new MasterSlide should be inserted.

    Returns
    MasterSlide

    A new MasterSlide inserted to the collection.

    Exceptions
    System.ArgumentOutOfRangeException

    index is less than zero or index is equal to or greater than Count.

    Remove(MasterSlide)

    Removes the first occurrence of a specific MasterSlide from the collection.

    • C#
    • VB.NET
    public bool Remove(MasterSlide item)
    Public Function Remove(item As MasterSlide) As Boolean
    Parameters
    item
    MasterSlide

    The MasterSlide 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 MasterSlide at the specified index of the collection.

    • C#
    • VB.NET
    public void RemoveAt(int index)
    Public Sub RemoveAt(index As Integer)
    Parameters
    index
    System.Int32

    The zero-based index of the MasterSlide to remove.

    Exceptions
    System.ArgumentOutOfRangeException

    index is less than zero or index is equal to or greater than Count.

    Implements

    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable

    Examples

    Slides Example
    Cloning Example

    See Also

    MasterSlides
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.