ISlideCollection

All Implemented Interfaces: com.aspose.slides.IGenericCollection

public interface ISlideCollection extends IGenericCollection<ISlide>

Represents a collection of a slides.

Methods

MethodDescription
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(String path, PdfImportOptions pdfImportOptions)Creates slides from the PDF document and adds them to the end of the collection considering the pdf import options.
addFromPdf(InputStream pdfStream, PdfImportOptions pdfImportOptions)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:

ParameterTypeDescription
indexint

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:

ParameterTypeDescription
sourceSlideISlideSlide 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).addClone(ISlide,ILayoutSlide) or #addClone(ISlide,IMasterSlide,boolean).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:

ParameterTypeDescription
sourceSlideISlideSlide to clone.
sectionISectionSection 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:

ParameterTypeDescription
indexintIndex of new slide.
sourceSlideISlideSlide 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).insertClone(int,ISlide,ILayoutSlide) or #insertClone(int,ISlide,IMasterSlide,boolean).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:

ParameterTypeDescription
layoutILayoutSlideLayout 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:

ParameterTypeDescription
indexintIndex of a new slide.
layoutILayoutSlideLayout 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:

ParameterTypeDescription
sourceSlideISlideSlide to clone.
destLayoutILayoutSlideLayout 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:

ParameterTypeDescription
indexintIndex of new slide.
sourceSlideISlideSlide to clone.
destLayoutILayoutSlideLayout 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:

ParameterTypeDescription
sourceSlideISlideSlide to clone.
destMasterIMasterSlideMaster slide for a new slide.
allowCloneMissingLayoutbooleanIf 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:

ParameterTypeDescription
indexintIndex of new slide.
sourceSlideISlideSlide to clone.
destMasterIMasterSlideMaster slide for a new slide.
allowCloneMissingLayoutbooleanIf 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:

ParameterTypeDescription
valueISlideThe 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:

ParameterTypeDescription
indexintThe 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:

ParameterTypeDescription
startIndexintAn index of a first slide to add.
countintA 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:

ParameterTypeDescription
indexintTarget index.
slideISlideSlide 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:

ParameterTypeDescription
indexintTarget index.
slidesISlide[]Slides to move.

indexOf(ISlide slide)

public abstract int indexOf(ISlide slide)

Returns an index of the specified slide in the collection.

Parameters:

ParameterTypeDescription
slideISlideSlide 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:

ParameterTypeDescription
pathjava.lang.StringA path to the PDF document

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

addFromPdf(String path, PdfImportOptions pdfImportOptions)

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

Parameters:

ParameterTypeDescription
pathjava.lang.StringA path to the PDF document
pdfImportOptionsPdfImportOptionsOptions for pdf import

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

addFromPdf(InputStream pdfStream, PdfImportOptions pdfImportOptions)

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

Parameters:

ParameterTypeDescription
pdfStreamjava.io.InputStreamA stream which will be used as a source of the PDF document
pdfImportOptionsPdfImportOptionsOptions for pdf import

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:

ParameterTypeDescription
pdfStreamjava.io.InputStreamA 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:

ParameterTypeDescription
htmlTextjava.lang.StringHtml to add.
resolverIExternalResourceResolverA callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
urijava.lang.StringAn 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:

ParameterTypeDescription
htmlTextjava.lang.StringHtml 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:

ParameterTypeDescription
htmlStreamjava.io.InputStreamA Stream object which will be used as a source of a HTML file.
resolverIExternalResourceResolverA callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
urijava.lang.StringAn 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:

ParameterTypeDescription
htmlStreamjava.io.InputStreamA 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:

ParameterTypeDescription
indexintPosition to insert.
htmlTextjava.lang.StringHtml to add.
resolverIExternalResourceResolverA callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
urijava.lang.StringAn 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:

ParameterTypeDescription
indexintPosition to insert.
htmlTextjava.lang.StringHtml 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:

ParameterTypeDescription
indexintPosition to insert.
htmlStreamjava.io.InputStreamA Stream object which will be used as a source of a HTML file.
resolverIExternalResourceResolverA callback object used to fetch external objects. If this parameter is null all external objects will be ignored.
urijava.lang.StringAn 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:

ParameterTypeDescription
indexintPosition to insert.
htmlStreamjava.io.InputStreamA Stream object which will be used as a source of a HTML file.

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