ISlideCollection

All Implemented Interfaces: com.aspose.slides.IGenericCollection

public interface ISlideCollection extends IGenericCollection<ISlide>

Represents a collection of a slides.

Methods

Method Description
get_Item(int index) Gets the element at the specified index.
addClone(ISlide sourceSlide) Adds a copy of a specified slide to the end of the collection.
addClone(ISlide sourceSlide, ISection section) Adds a copy of a specified slide to the end of the specified section.
insertClone(int index, ISlide sourceSlide) Inserts a copy of a specified slide to specified position of the collection.
addEmptySlide(ILayoutSlide layout) Adds a new empty slide to the end of the collection.
insertEmptySlide(int index, ILayoutSlide layout) Inserts a copy of a specified slide to specified position of the collection.
addClone(ISlide sourceSlide, ILayoutSlide destLayout) Adds a copy of a specified slide to the end of the collection.
insertClone(int index, ISlide sourceSlide, ILayoutSlide destLayout) Inserts a copy of a specified slide to specified position of the collection.
addClone(ISlide sourceSlide, IMasterSlide destMaster, boolean allowCloneMissingLayout) Adds a copy of a specified source slide to the end of the collection.
insertClone(int index, ISlide sourceSlide, IMasterSlide destMaster, boolean allowCloneMissingLayout) Inserts a copy of a specified source slide to specified position of the collection.
remove(ISlide value) Removes the first occurrence of a specific object from the collection.
removeAt(int index) Removes the element at the specified index of the collection.
toArray() Creates and returns an array with all slides in it.
toArray(int startIndex, int count) Creates and returns an array with all slides from the specified range in it.
reorder(int index, ISlide slide) Moves slide from the collection to the specified position.
reorder(int index, ISlide[] slides) Moves slides from the collection to the specified position.
indexOf(ISlide slide) Returns an index of the specified slide in the collection.
addFromPdf(String path) Creates slides from the PDF document and adds them to the end of the collection.
addFromPdf(InputStream pdfStream) Creates slides from the PDF document and adds them to the end of the collection.
addFromHtml(String htmlText, IExternalResourceResolver resolver, String uri) Creates slides from HTML text and adds them to the end of the collection.
addFromHtml(String htmlText) Creates slides from HTML text and adds them to the end of the collection.
addFromHtml(InputStream htmlStream, IExternalResourceResolver resolver, String uri) Creates slides from HTML text and adds them to the end of the collection.
addFromHtml(InputStream htmlStream) Creates slides from HTML text and adds them to the end of the collection.
insertFromHtml(int index, String htmlText, IExternalResourceResolver resolver, String uri) Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml(int index, String htmlText) Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml(int index, InputStream htmlStream, IExternalResourceResolver resolver, String uri) Creates slides from HTML text and inserts them to the collection at the specified position.
insertFromHtml(int index, InputStream htmlStream) Creates slides from HTML text and inserts them to the collection at the specified position.

get_Item(int index)

public abstract ISlide get_Item(int index)

Gets the element at the specified index. Read-only ISlide.

Parameters:

Parameter Type Description
index int

Returns: ISlide

addClone(ISlide sourceSlide)

public abstract ISlide addClone(ISlide sourceSlide)

Adds a copy of a specified slide to the end of the collection.

Parameters:

Parameter Type Description
sourceSlide ISlide Slide to clone.

When cloning a slide between different presentations slide’s master can be cloned too. Internal registry is used to track automatically cloned masters to prevent creation of multiple clones of the same master slide. Manual cloning of master slides will be neither prevented nor registered. If you need more control over cloning process use #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. |

Returns: ISlide - New slide.

addClone(ISlide sourceSlide, ISection section)

public abstract 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();
 }

Parameters:

Parameter Type Description
sourceSlide ISlide Slide to clone.
section ISection Section for a new slide.

Returns: ISlide - New slide.

insertClone(int index, ISlide sourceSlide)

public abstract ISlide insertClone(int index, ISlide sourceSlide)

Inserts a copy of a specified slide to specified position of the collection.

Parameters:

Parameter Type Description
index int Index of new slide.
sourceSlide ISlide Slide to clone.

When cloning a slide between different presentations slide’s master can be cloned too. Internal registry is used to track automatically cloned masters to prevent creation of multiple clones of the same master slide. Manual cloning of master slides will be neither prevented nor registered. If you need more control over cloning process use #insertClone(int,ISlide,ILayoutSlide) or #insertClone(int,ISlide,IMasterSlide,boolean) for cloning slides and IMasterSlideCollection#addClone(IMasterSlide) for cloning masters. |

Returns: ISlide - Inserted slide.

addEmptySlide(ILayoutSlide layout)

public abstract ISlide addEmptySlide(ILayoutSlide layout)

Adds a new empty slide to the end of the collection.

Parameters:

Parameter Type Description
layout ILayoutSlide Layout for a slide.

Returns: ISlide - Added slide.

insertEmptySlide(int index, ILayoutSlide layout)

public abstract ISlide insertEmptySlide(int index, ILayoutSlide layout)

Inserts a copy of a specified slide to specified position of the collection.

Parameters:

Parameter Type Description
index int Index of a new slide.
layout ILayoutSlide Layout for a slide.

Returns: ISlide - Inserted slide.

addClone(ISlide sourceSlide, ILayoutSlide destLayout)

public abstract ISlide addClone(ISlide sourceSlide, ILayoutSlide destLayout)

Adds a copy of a specified slide to the end of the collection.

Parameters:

Parameter Type Description
sourceSlide ISlide Slide to clone.
destLayout ILayoutSlide Layout slide for a new slide.

Returns: ISlide - New slide.

insertClone(int index, ISlide sourceSlide, ILayoutSlide destLayout)

public abstract ISlide insertClone(int index, ISlide sourceSlide, ILayoutSlide destLayout)

Inserts a copy of a specified slide to specified position of the collection.

Parameters:

Parameter Type Description
index int Index of new slide.
sourceSlide ISlide Slide to clone.
destLayout ILayoutSlide Layout slide for a new slide.

Returns: ISlide - Inserted slide.

addClone(ISlide sourceSlide, IMasterSlide destMaster, boolean allowCloneMissingLayout)

public abstract 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).

Parameters:

Parameter Type Description
sourceSlide ISlide Slide to clone.
destMaster IMasterSlide Master slide for a new slide.
allowCloneMissingLayout boolean 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).

Returns: ISlide - New slide.

insertClone(int index, ISlide sourceSlide, IMasterSlide destMaster, boolean allowCloneMissingLayout)

public abstract 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).

Parameters:

Parameter Type Description
index int Index of new slide.
sourceSlide ISlide Slide to clone.
destMaster IMasterSlide Master slide for a new slide.
allowCloneMissingLayout boolean 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).

Returns: ISlide - Inserted slide.

remove(ISlide value)

public abstract void remove(ISlide value)

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

Parameters:

Parameter Type Description
value ISlide The slide to remove from the collection.

removeAt(int index)

public abstract void removeAt(int index)

Removes the element at the specified index of the collection.

Parameters:

Parameter Type Description
index int The zero-based index of the element to remove.

toArray()

public abstract ISlide[] toArray()

Creates and returns an array with all slides in it.

Returns: com.aspose.slides.ISlide[] - Array of ISlide

toArray(int startIndex, int count)

public abstract ISlide[] toArray(int startIndex, int count)

Creates and returns an array with all slides from the specified range in it.

Parameters:

Parameter Type Description
startIndex int An index of a first slide to add.
count int A number of slides to add.

Returns: com.aspose.slides.ISlide[] - Array of ISlide

reorder(int index, ISlide slide)

public abstract void reorder(int index, ISlide slide)

Moves slide from the collection to the specified position.

Parameters:

Parameter Type Description
index int Target index.
slide ISlide Slide to move.

reorder(int index, ISlide[] slides)

public abstract 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.

Parameters:

Parameter Type Description
index int Target index.
slides com.aspose.slides.ISlide[] Slides to move.

indexOf(ISlide slide)

public abstract int indexOf(ISlide slide)

Returns an index of the specified slide in the collection.

Parameters:

Parameter Type Description
slide ISlide Slide to find.

Returns: int - Index of a slide or -1 if slide not from this collection.

addFromPdf(String path)

public abstract ISlide[] addFromPdf(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();
 }

Parameters:

Parameter Type Description
path java.lang.String A path to the PDF document

Returns: com.aspose.slides.ISlide[] - Added slides

addFromPdf(InputStream pdfStream)

public abstract ISlide[] addFromPdf(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();
 }

Parameters:

Parameter Type Description
pdfStream java.io.InputStream A stream which will be used as a source of the PDF document

Returns: com.aspose.slides.ISlide[] - Added slides

addFromHtml(String htmlText, IExternalResourceResolver resolver, String uri)

public abstract ISlide[] addFromHtml(String htmlText, IExternalResourceResolver resolver, String uri)

Creates slides from HTML text and adds them to the end of the collection.

Parameters:

Parameter Type Description
htmlText java.lang.String Html to add.
resolver IExternalResourceResolver A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
uri java.lang.String An URI of the specified HTML. Used to resolve relative links.

Returns: com.aspose.slides.ISlide[] - Added slides.

addFromHtml(String htmlText)

public abstract ISlide[] addFromHtml(String htmlText)

Creates slides from HTML text and adds them to the end of the collection.

Parameters:

Parameter Type Description
htmlText java.lang.String Html to add.

Returns: com.aspose.slides.ISlide[] - Added slides

addFromHtml(InputStream htmlStream, IExternalResourceResolver resolver, String uri)

public abstract ISlide[] addFromHtml(InputStream htmlStream, IExternalResourceResolver resolver, String uri)

Creates slides from HTML text and adds them to the end of the collection.

Parameters:

Parameter Type Description
htmlStream java.io.InputStream A Stream object which will be used as a source of a HTML file.
resolver IExternalResourceResolver A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
uri java.lang.String An URI of the specified HTML. Used to resolve relative links.

Returns: com.aspose.slides.ISlide[] - Added slides.

addFromHtml(InputStream htmlStream)

public abstract ISlide[] addFromHtml(InputStream htmlStream)

Creates slides from HTML text and adds them to the end of the collection.

Parameters:

Parameter Type Description
htmlStream java.io.InputStream A Stream object which will be used as a source of a HTML file.

Returns: com.aspose.slides.ISlide[] - Added slides

insertFromHtml(int index, String htmlText, IExternalResourceResolver resolver, String uri)

public abstract ISlide[] insertFromHtml(int index, String htmlText, IExternalResourceResolver resolver, String uri)

Creates slides from HTML text and inserts them to the collection at the specified position.

Parameters:

Parameter Type Description
index int Position to insert.
htmlText java.lang.String Html to add.
resolver IExternalResourceResolver A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
uri java.lang.String An URI of the specified HTML. Used to resolve relative links.

Returns: com.aspose.slides.ISlide[] - Added slides.

insertFromHtml(int index, String htmlText)

public abstract ISlide[] insertFromHtml(int index, String htmlText)

Creates slides from HTML text and inserts them to the collection at the specified position.

Parameters:

Parameter Type Description
index int Position to insert.
htmlText java.lang.String Html to add.

Returns: com.aspose.slides.ISlide[] - Added slides

insertFromHtml(int index, InputStream htmlStream, IExternalResourceResolver resolver, String uri)

public abstract ISlide[] insertFromHtml(int index, InputStream htmlStream, IExternalResourceResolver resolver, String uri)

Creates slides from HTML text and inserts them to the collection at the specified position.

Parameters:

Parameter Type Description
index int Position to insert.
htmlStream java.io.InputStream A Stream object which will be used as a source of a HTML file.
resolver IExternalResourceResolver A callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
uri java.lang.String An URI of the specified HTML. Used to resolve relative links.

Returns: com.aspose.slides.ISlide[] - Added slides.

insertFromHtml(int index, InputStream htmlStream)

public abstract ISlide[] insertFromHtml(int index, InputStream htmlStream)

Creates slides from HTML text and inserts them to the collection at the specified position.

Parameters:

Parameter Type Description
index int Position to insert.
htmlStream java.io.InputStream A Stream object which will be used as a source of a HTML file.

Returns: com.aspose.slides.ISlide[] - Added slides