public final class MasterSlideCollection extends DomObject<Presentation> implements IMasterSlideCollection
Represents a collection of master slides.
| Modifier and Type | Method and Description |
|---|---|
IMasterSlide |
addClone(IMasterSlide sourceMaster)
Adds a copy of a specified master slide to the end of the collection.
|
void |
copyTo(com.aspose.ms.System.Array array,
int index)
Copies all elements from the collection to the specified array.
|
IMasterSlide |
get_Item(int index)
Gets the element at the specified index.
|
java.lang.Object |
getSyncRoot()
Returns a synchronization root.
|
IMasterSlide |
insertClone(int index,
IMasterSlide sourceMaster)
Inserts a copy of a specified master slide to specified position of the collection.
|
boolean |
isSynchronized()
Returns a value indicating whether access to the collection is synchronized (thread-safe).
|
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IMasterSlide> |
iterator()
Returns an enumerator that iterates through the collection.
|
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IMasterSlide> |
iteratorJava()
Returns a java iterator for the entire collection.
|
void |
remove(IMasterSlide value)
Removes the first occurrence of a specific object from the collection.
|
void |
removeAt(int index)
Removes the element at the specified index of the collection.
|
void |
removeUnused(boolean ignorePreserveField)
Removes unused master slides.
|
int |
size()
Gets the number of elements actually contained in the collection.
|
getParent_Immediatepublic final int size()
Gets the number of elements actually contained in the collection. Read-only int.
size in interface com.aspose.ms.System.Collections.ICollection<IMasterSlide>public final IMasterSlide get_Item(int index)
Gets the element at the specified index.
Read-only MasterSlide.
get_Item in interface IMasterSlideCollectionpublic final void remove(IMasterSlide value)
Removes the first occurrence of a specific object from the collection.
remove in interface IMasterSlideCollectionvalue - The master slide to remove from the collection.public final void removeAt(int index)
Removes the element at the specified index of the collection.
removeAt in interface IMasterSlideCollectionindex - The zero-based index of the element to remove.
PptxEditException - Thrown if the master to remove is used in presentation (its HasDependingSlides property is true).public final void removeUnused(boolean ignorePreserveField)
Removes unused master slides.
removeUnused in interface IMasterSlideCollectionignorePreserveField - Determines, whether this method should remove unused master even if its MasterSlide.getPreserve()/MasterSlide.setPreserve(boolean) property is set to true.public final IMasterSlide addClone(IMasterSlide sourceMaster)
Adds a copy of a specified master slide to the end of the collection. Linked layout slides will be copied too.
addClone in interface IMasterSlideCollectionsourceMaster - Slide to clone.public final IMasterSlide insertClone(int index, IMasterSlide sourceMaster)
Inserts a copy of a specified master slide to specified position of the collection. Linked layout slides will be copied too.
The following example shows how to clone master slide in another PowerPoint Presentation.// Instantiate Presentation class to load the source presentation file Presentation srcPres = new Presentation("CloneToAnotherPresentationWithMaster.pptx"); try { // Instantiate Presentation class for destination presentation (where slide is to be cloned) Presentation destPres = new Presentation(); try { // Instantiate ISlide from the collection of slides in source presentation along with // Master slide ISlide SourceSlide = srcPres.getSlides().get_Item(0); IMasterSlide SourceMaster = SourceSlide.getLayoutSlide().getMasterSlide(); // Get Master Slides of destination presentation IMasterSlideCollection masters = destPres.getMasters(); // Clone the desired master slide from the source presentation to the collection of masters in the // Destination presentation IMasterSlide iSlide = masters.addClone(SourceMaster); // Collection of slides in the destination presentation ISlideCollection slds = destPres.getSlides(); // Clone source slide to destination slides collection. slds.addClone(SourceSlide, iSlide, true); // Save the destination presentation to disk destPres.save("CloneToAnotherPresentationWithMaster_out.pptx", SaveFormat.Pptx); } finally { if (destPres != null) destPres.dispose(); } } finally { if (srcPres != null) srcPres.dispose(); }
insertClone in interface IMasterSlideCollectionindex - Index of new slide.sourceMaster - Slide to clone.public final void copyTo(com.aspose.ms.System.Array array,
int index)
Copies all elements from the collection to the specified array.
copyTo in interface com.aspose.ms.System.Collections.ICollection<IMasterSlide>array - Target array.index - Starting index in the target array.public final boolean isSynchronized()
Returns a value indicating whether access to the collection is synchronized (thread-safe). Read-only boolean.
isSynchronized in interface com.aspose.ms.System.Collections.ICollection<IMasterSlide>public final java.lang.Object getSyncRoot()
Returns a synchronization root.
Read-only Object.
getSyncRoot in interface com.aspose.ms.System.Collections.ICollection<IMasterSlide>public final com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IMasterSlide> iterator()
Returns an enumerator that iterates through the collection.
iterator in interface com.aspose.ms.System.Collections.Generic.IGenericEnumerable<IMasterSlide>iterator in interface com.aspose.ms.System.Collections.IEnumerable<IMasterSlide>iterator in interface java.lang.Iterable<IMasterSlide>IGenericEnumerator that can be used to iterate through the collection.public final com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IMasterSlide> iteratorJava()
Returns a java iterator for the entire collection.
iteratorJava in interface IGenericCollection<IMasterSlide>Iterator for the entire collection.Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.