public final class SlideCollection extends DomObject<Presentation> implements ISlideCollection
Represents a collection of a slides.
| Modifier and Type | Method and Description |
|---|---|
ISlide |
addClone(ISlide sourceSlide)
Adds a copy of a specified slide to the end of the collection.
|
ISlide |
addClone(ISlide sourceSlide,
ILayoutSlide destLayout)
Adds a copy of a specified slide to the end of the collection.
|
ISlide |
addClone(ISlide sourceSlide,
IMasterSlide destMaster,
boolean allowCloneMissingLayout)
Adds a copy of a specified source slide to the end of the collection.
|
ISlide |
addClone(ISlide sourceSlide,
ISection section)
Adds a copy of a specified slide to the end of the specified section.
|
ISlide |
addEmptySlide(ILayoutSlide layout)
Adds a new empty slide to the end of the collection.
|
ISlide[] |
addFromHtml(java.io.InputStream htmlStream)
Creates slides from HTML text and adds them to the end of the collection.
|
ISlide[] |
addFromHtml(java.io.InputStream htmlStream,
IExternalResourceResolver resolver,
java.lang.String uri)
Creates slides from HTML text and adds them to the end of the collection.
|
ISlide[] |
addFromHtml(java.lang.String htmlText)
Creates slides from HTML text and adds them to the end of the collection.
|
ISlide[] |
addFromHtml(java.lang.String htmlText,
IExternalResourceResolver resolver,
java.lang.String uri)
Creates slides from HTML text and adds them to the end of the collection.
|
ISlide[] |
addFromPdf(java.io.InputStream pdfStream)
Creates slides from the PDF document and adds them to the end of the collection.
|
ISlide[] |
addFromPdf(java.io.InputStream pdfStream,
PdfImportOptions pdfImportOptions)
Creates slides from the PDF document and adds them to the end of the collection.
|
ISlide[] |
addFromPdf(java.lang.String path)
Creates slides from the PDF document and adds them to the end of the collection.
|
ISlide[] |
addFromPdf(java.lang.String path,
PdfImportOptions pdfImportOptions)
Creates slides from the PDF document and adds them to the end of the collection considering the pdf import options.
|
void |
copyTo(com.aspose.ms.System.Array array,
int index)
Copies all elements from the collection to the specified array.
|
ISlide |
get_Item(int index)
Gets the element at the specified index.
|
java.lang.Object |
getSyncRoot()
Returns a synchronization root.
|
int |
indexOf(ISlide slide)
Returns an index of the specified slide in the collection.
|
ISlide |
insertClone(int index,
ISlide sourceSlide)
Inserts a copy of a specified slide to specified position of the collection.
|
ISlide |
insertClone(int index,
ISlide sourceSlide,
ILayoutSlide destLayout)
Inserts a copy of a specified slide to specified position of the collection.
|
ISlide |
insertClone(int index,
ISlide sourceSlide,
IMasterSlide destMaster,
boolean allowCloneMissingLayout)
Inserts a copy of a specified source slide to specified position of the collection.
|
ISlide |
insertEmptySlide(int index,
ILayoutSlide layout)
Inserts a copy of a specified slide to specified position of the collection.
|
ISlide[] |
insertFromHtml(int index,
java.io.InputStream htmlStream)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
ISlide[] |
insertFromHtml(int index,
java.io.InputStream htmlStream,
boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
ISlide[] |
insertFromHtml(int index,
java.io.InputStream htmlStream,
IExternalResourceResolver resolver,
java.lang.String uri)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
ISlide[] |
insertFromHtml(int index,
java.io.InputStream htmlStream,
IExternalResourceResolver resolver,
java.lang.String uri,
boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
ISlide[] |
insertFromHtml(int index,
java.lang.String htmlText)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
ISlide[] |
insertFromHtml(int index,
java.lang.String htmlText,
boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
ISlide[] |
insertFromHtml(int index,
java.lang.String htmlText,
IExternalResourceResolver resolver,
java.lang.String uri)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
ISlide[] |
insertFromHtml(int index,
java.lang.String htmlText,
IExternalResourceResolver resolver,
java.lang.String uri,
boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
|
boolean |
isSynchronized()
Returns a value indicating whether access to the collection is synchronized (thread-safe).
|
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<ISlide> |
iterator()
Returns an enumerator that iterates through the collection.
|
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<ISlide> |
iteratorJava()
Returns a java iterator for the entire collection.
|
void |
remove(ISlide 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 |
reorder(int index,
ISlide... slides)
Moves slides from the collection to the specified position.
|
void |
reorder(int index,
ISlide slide)
Moves slide from the collection to the specified position.
|
int |
size()
Gets the number of elements actually contained in the collection.
|
ISlide[] |
toArray()
Creates and returns an array with all slides in it.
|
ISlide[] |
toArray(int startIndex,
int count)
Creates and returns an array with all slides from the specified range in it.
|
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<ISlide>public final ISlide get_Item(int index)
Gets the element at the specified index.
Read-only Slide.
get_Item in interface ISlideCollectionpublic final ISlide addClone(ISlide sourceSlide)
Adds a copy of a specified slide to the end of the collection.
addClone in interface ISlideCollectionsourceSlide - Slide to clone.
addClone(ISlide,ILayoutSlide) or
addClone(ISlide,IMasterSlide,boolean) for cloning slides,
IGlobalLayoutSlideCollection.addClone(ILayoutSlide) or
IGlobalLayoutSlideCollection.addClone(ILayoutSlide,IMasterSlide) for cloning layouts and
IMasterSlideCollection.addClone(IMasterSlide) for cloning masters.
public final ISlide addClone(ISlide sourceSlide, ISection section)
Adds a copy of a specified slide to the end of the specified section.
IPresentation presentation = new Presentation(); try { presentation.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 200, 50, 300, 100); presentation.getSections().addSection("Section 1", presentation.getSlides().get_Item(0)); ISection section2 = presentation.getSections().appendEmptySection("Section 2"); presentation.getSlides().addClone(presentation.getSlides().get_Item(0), section2); // Now the second section contains a copy of the first slide. } finally { if (presentation != null) presentation.dispose(); }
addClone in interface ISlideCollectionsourceSlide - Slide to clone.section - Section for a new slide.com.aspose.ms.System.ArgumentNullException - When sourceSlide or section parameter is null.PptxEditException - When section parameter contains wrong or invalid value.public final ISlide insertClone(int index, ISlide sourceSlide)
Inserts a copy of a specified slide to specified position of the collection.
The following example shows how to clone at another position within Presentation.// Instantiate Presentation class that represents a presentation file Presentation pres = new Presentation("CloneWithInSamePresentation.pptx"); try { // Clone the desired slide to the end of the collection of slides in the same presentation ISlideCollection slds = pres.getSlides(); // Clone the desired slide to the specified index in the same presentation slds.insertClone(2, pres.getSlides().get_Item(1)); // Write the modified presentation to disk pres.save("Aspose_CloneWithInSamePresentation_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }The following example shows how to clone at another position within Presentation.// Instantiate Presentation class to load the source presentation file Presentation srcPres = new Presentation("CloneAtEndOfAnother.pptx"); try { // Instantiate Presentation class for destination PPTX (where slide is to be cloned) Presentation destPres = new Presentation(); try { ISlideCollection slds = destPres.getSlides(); slds.insertClone(2, srcPres.getSlides().get_Item(0)); // Write the destination presentation to disk destPres.save("Aspose2_out.pptx", SaveFormat.Pptx); } finally { if (destPres != null) destPres.dispose(); } } finally { if (srcPres != null) srcPres.dispose(); }
insertClone in interface ISlideCollectionindex - Index of new slide.sourceSlide - Slide to clone.
insertClone(int,ISlide,ILayoutSlide) or
insertClone(int,ISlide,IMasterSlide,boolean) for cloning slides and
IMasterSlideCollection.addClone(IMasterSlide) for cloning masters.
public final ISlide addEmptySlide(ILayoutSlide layout)
Adds a new empty slide to the end of the collection.
addEmptySlide in interface ISlideCollectionlayout - Layout for a slide.public final ISlide insertEmptySlide(int index, ILayoutSlide layout)
Inserts a copy of a specified slide to specified position of the collection.
insertEmptySlide in interface ISlideCollectionindex - Index of a new slide.layout - Layout for a slide.public final ISlide addClone(ISlide sourceSlide, ILayoutSlide destLayout)
Adds a copy of a specified slide to the end of the collection.
addClone in interface ISlideCollectionsourceSlide - Slide to clone.destLayout - Layout slide for a new slide.public final ISlide insertClone(int index, ISlide sourceSlide, ILayoutSlide destLayout)
Inserts a copy of a specified slide to specified position of the collection.
insertClone in interface ISlideCollectionindex - Index of new slide.sourceSlide - Slide to clone.destLayout - Layout slide for a new slide.public final ISlide addClone(ISlide sourceSlide, IMasterSlide destMaster, boolean allowCloneMissingLayout)
Adds a copy of a specified source slide to the end of the collection. Appropriate layout will be selected automatically from the specified master (appropriate layout is the layout with the same Type or Name as of layout of the source slide). If there is no appropriate layout then layout of the source slide will be cloned (if allowCloneMissingLayout is true) or PptxEditException will be thrown (if allowCloneMissingLayout is false).
addClone in interface ISlideCollectionsourceSlide - Slide to clone.destMaster - Master slide for a new slide.allowCloneMissingLayout - If there is no appropriate layout in specified master then layout of the
source slide will be cloned (if allowCloneMissingLayout is true) or
PptxEditException will be thrown (if allowCloneMissingLayout is false).PptxEditException - Thrown if there is no appropriate layout in specified master and
allowCloneMissingLayout is false.public final ISlide insertClone(int index, ISlide sourceSlide, IMasterSlide destMaster, boolean allowCloneMissingLayout)
Inserts a copy of a specified source slide to specified position of the collection. Appropriate layout will be selected automatically from the specified master (appropriate layout is the layout with the same Type or Name as of layout of the source slide). If there is no appropriate layout then layout of the source slide will be cloned (if allowCloneMissingLayout is true) or PptxEditException will be thrown (if allowCloneMissingLayout is false).
insertClone in interface ISlideCollectionindex - Index of new slide.sourceSlide - Slide to clone.destMaster - Master slide for a new slide.allowCloneMissingLayout - If there is no appropriate layout in specified master then layout of the
source slide will be cloned (if allowCloneMissingLayout is true) or
PptxEditException will be thrown (if allowCloneMissingLayout is false).PptxEditException - Thrown if there is no appropriate layout in specified master and
allowCloneMissingLayout is false.public final void remove(ISlide value)
Removes the first occurrence of a specific object from the collection.
remove in interface ISlideCollectionvalue - The 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 ISlideCollectionindex - The zero-based index of the element to remove.com.aspose.ms.System.ArgumentOutOfRangeException - When index parameter contains wrong section number.public final com.aspose.ms.System.Collections.Generic.IGenericEnumerator<ISlide> iterator()
Returns an enumerator that iterates through the collection.
iterator in interface com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide>iterator in interface com.aspose.ms.System.Collections.IEnumerable<ISlide>iterator in interface java.lang.Iterable<ISlide>IGenericEnumerator that can be used to iterate through the collection.public final com.aspose.ms.System.Collections.Generic.IGenericEnumerator<ISlide> iteratorJava()
Returns a java iterator for the entire collection.
iteratorJava in interface IGenericCollection<ISlide>Iterator for the entire collection.public final ISlide[] toArray()
Creates and returns an array with all slides in it.
toArray in interface ISlideCollectionSlidepublic final ISlide[] toArray(int startIndex, int count)
Creates and returns an array with all slides from the specified range in it.
toArray in interface ISlideCollectionstartIndex - An index of a first slide to add.count - A number of slides to add.Slidepublic final void reorder(int index,
ISlide slide)
Moves slide from the collection to the specified position.
reorder in interface ISlideCollectionindex - Target index.slide - Slide to move.public final void reorder(int index,
ISlide... slides)
Moves slides from the collection to the specified position. Slides will be placed starting from index in order they appear in list.
reorder in interface ISlideCollectionindex - Target index.slides - Slides to move.public final int indexOf(ISlide slide)
Returns an index of the specified slide in the collection.
indexOf in interface ISlideCollectionslide - Slide to find.public final ISlide[] addFromPdf(java.lang.String path)
Creates slides from the PDF document and adds them to the end of the collection.
Example:Presentation pres = new Presentation(); try { pres.getSlides().addFromPdf("document.pdf"); pres.save("fromPdfDocument.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addFromPdf in interface ISlideCollectionpath - A path to the PDF documentpublic final ISlide[] addFromPdf(java.lang.String path, PdfImportOptions pdfImportOptions)
Creates slides from the PDF document and adds them to the end of the collection considering the pdf import options.
Example:Presentation pres = new Presentation(); try { PdfImportOptions pdfImportOptions = new PdfImportOptions(); pdfImportOptions.setDetectTables(true); pres.getSlides().addFromPdf("document.pdf", pdfImportOptions); pres.save("fromPdfDocument.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addFromPdf in interface ISlideCollectionpath - A path to the PDF documentpdfImportOptions - Options for pdf importpublic final ISlide[] addFromPdf(java.io.InputStream pdfStream)
Creates slides from the PDF document and adds them to the end of the collection.
Example:Presentation pres = new Presentation(); try { FileInputStream stream = new FileInputStream("document.pdf"); pres.getSlides().addFromPdf(stream); pres.save("fromPdfDocument.pptx", SaveFormat.Pptx); } catch (IOException e) { } finally { if (pres != null) pres.dispose(); }
addFromPdf in interface ISlideCollectionpdfStream - A stream which will be used as a source of the PDF documentpublic final ISlide[] addFromPdf(java.io.InputStream pdfStream, PdfImportOptions pdfImportOptions)
Creates slides from the PDF document and adds them to the end of the collection.
Example:Presentation pres = new Presentation(); try { PdfImportOptions pdfImportOptions = new PdfImportOptions(); pdfImportOptions.setDetectTables(true); FileInputStream stream = new FileInputStream("document.pdf"); pres.getSlides().addFromPdf(stream, pdfImportOptions); pres.save("fromPdfDocument.pptx", SaveFormat.Pptx); } catch (IOException e) { } finally { if (pres != null) pres.dispose(); }
addFromPdf in interface ISlideCollectionpdfStream - A stream which will be used as a source of the PDF documentpdfImportOptions - Options for pdf importpublic final ISlide[] addFromHtml(java.lang.String htmlText, IExternalResourceResolver resolver, java.lang.String uri)
Creates slides from HTML text and adds them to the end of the collection.
addFromHtml in interface ISlideCollectionhtmlText - Html to add.resolver - A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.uri - An URI of the specified HTML. Used to resolve relative links.public final ISlide[] addFromHtml(java.lang.String htmlText)
Creates slides from HTML text and adds them to the end of the collection.
addFromHtml in interface ISlideCollectionhtmlText - Html to add.public final ISlide[] addFromHtml(java.io.InputStream htmlStream, IExternalResourceResolver resolver, java.lang.String uri)
Creates slides from HTML text and adds them to the end of the collection.
addFromHtml in interface ISlideCollectionhtmlStream - A Stream object which will be used as a source of a HTML file.resolver - A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.uri - An URI of the specified HTML. Used to resolve relative links.public final ISlide[] addFromHtml(java.io.InputStream htmlStream)
Creates slides from HTML text and adds them to the end of the collection.
// Create an instance of the Presentation class. Presentation pres = new Presentation(); try { String html = new String(Files.readAllBytes(Paths.get("file.html"))); // Call the AddFromHtml method and pass the HTML file. pres.getSlides().addFromHtml(html); // Use the Save method to save the file as a PowerPoint document. pres.save("MyPresentation.pptx", SaveFormat.Pptx); } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }
addFromHtml in interface ISlideCollectionhtmlStream - A Stream object which will be used as a source of a HTML file.public final ISlide[] insertFromHtml(int index, java.lang.String htmlText, IExternalResourceResolver resolver, java.lang.String uri)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlText - Html to add.resolver - A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.uri - An URI of the specified HTML. Used to resolve relative links.public final ISlide[] insertFromHtml(int index, java.lang.String htmlText, IExternalResourceResolver resolver, java.lang.String uri, boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlText - Html to add.resolver - A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.uri - An URI of the specified HTML. Used to resolve relative links.useSlideWithIndexAsStart - This flag determines how to start insertion: from a new slide or from the slide with the specified index.
If true, then data insertion will start from an empty space on the slide with the specified index.
If false, then data will be added to the created slides.public final ISlide[] insertFromHtml(int index, java.lang.String htmlText)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlText - Html to add.public final ISlide[] insertFromHtml(int index, java.lang.String htmlText, boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlText - Html to add.useSlideWithIndexAsStart - This flag determines how to start insertion: from a new slide or from the slide with the specified index.
If true, then data insertion will start from an empty space on the slide with the specified index.
If false, then data will be added to the created slides.public final ISlide[] insertFromHtml(int index, java.io.InputStream htmlStream, IExternalResourceResolver resolver, java.lang.String uri)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlStream - A Stream object which will be used as a source of a HTML file.resolver - A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.uri - An URI of the specified HTML. Used to resolve relative links.public final ISlide[] insertFromHtml(int index, java.io.InputStream htmlStream, IExternalResourceResolver resolver, java.lang.String uri, boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlStream - A Stream object which will be used as a source of a HTML file.resolver - A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.uri - An URI of the specified HTML. Used to resolve relative links.useSlideWithIndexAsStart - This flag determines how to start insertion: from a new slide or from the slide with the specified index.
If true, then data insertion will start from an empty space on the slide with the specified index.
If false, then data will be added to the created slides.public final ISlide[] insertFromHtml(int index, java.io.InputStream htmlStream)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlStream - A Stream object which will be used as a source of a HTML file.public final ISlide[] insertFromHtml(int index, java.io.InputStream htmlStream, boolean useSlideWithIndexAsStart)
Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml in interface ISlideCollectionindex - Position to insert.htmlStream - A Stream object which will be used as a source of a HTML file.useSlideWithIndexAsStart - This flag determines how to start insertion: from a new slide or from the slide with the specified index.
If true, then data insertion will start from an empty space on the slide with the specified index.
If false, then data will be added to the created slides.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<ISlide>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<ISlide>public final java.lang.Object getSyncRoot()
Returns a synchronization root.
Read-only Object.
getSyncRoot in interface com.aspose.ms.System.Collections.ICollection<ISlide>Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.