Presentation

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.slides.IPresentation, com.aspose.slides.IDOMObject

public final class Presentation implements IPresentation, IDOMObject

Represents a Microsoft PowerPoint presentation.

Constructors

Constructor Description
Presentation() This constructor creates new presentation from scratch.
Presentation(LoadOptions loadOptions) This constructor creates new presentation from scratch.
Presentation(InputStream stream) This constructor is the primary mechanism for reading an existing Presentation.
Presentation(InputStream stream, LoadOptions loadOptions) This constructor is the primary mechanism for reading an existing Presentation.
Presentation(String file) This constructor gets a source file path from which the contents of the Presentation are read.
Presentation(String file, LoadOptions loadOptions) This constructor gets a source file path from which the contents of the Presentation are read.

Methods

Method Description
getCurrentDateTime() Returns or sets date and time which will substitute content of datetime fields.
setCurrentDateTime(Date value) Returns or sets date and time which will substitute content of datetime fields.
getParent_Immediate()
getHeaderFooterManager() Returns actual HeaderFooter manager.
getProtectionManager() Gets manager of the permissions for this presentation.
getSlides() Returns a list of all slides that are defined in the presentation.
getSections() Returns a list of all slides sections that are defined in the presentation.
getSlideSize() Returns slide size object.
getNotesSize() Returns notes slide size object.
getLayoutSlides() Returns a list of all layout slides that are defined in the presentation.
getMasters() Returns a list of all master slides that are defined in the presentation.
getMasterNotesSlideManager() Returns notes master manager.
getMasterHandoutSlideManager() Returns handout master manager.
getFontsManager() Returns fonts manager.
getDefaultTextStyle() Returns default text style for shapes.
getCommentAuthors() Returns the collection of comments autors.
getDocumentProperties() Returns DocumentProperties object which contains standard and custom document properties.
getImages() Returns the collection of all images in the presentation.
getAudios() Returns the collection of all embedded audio files in the presentation.
getVideos() Returns the collection of all embedded video files in the presentation.
getSlideShowSettings() Returns the slide show settings for the presentation.
getDigitalSignatures() Returns the collection of signatures used to sign the presentation.
getCustomData() Returns the presentation’s custom data.
getAllCustomXmlParts() Returns all custom data parts in the presentaion.
getVbaProject() Gets or sets VBA project with presentation macros.
setVbaProject(IVbaProject value) Gets or sets VBA project with presentation macros.
getHyperlinkQueries() Provides easy access to all hyperlinks contained in all presentation slides (not in master, layout, notes slides).
getViewProperties() Gets presentation wide view properties.
getFirstSlideNumber() Represents the first slide number in the presentation
setFirstSlideNumber(int value) Represents the first slide number in the presentation
getSlideById(long id) Returns a Slide, MasterSlide or LayoutSlide by Id.
getSourceFormat() Returns information about from which format presentation was loaded.
getMasterTheme() Returns master theme.
save(String fname, int format) Saves all slides of a presentation to a file with the specified format.
save(OutputStream stream, int format) Saves all slides of a presentation to a stream in the specified format.
save(String fname, int format, ISaveOptions options) Saves all slides of a presentation to a file with the specified format and with additional options.
save(OutputStream stream, int format, ISaveOptions options) Saves all slides of a presentation to a stream in the specified format and with additional options.
save(IXamlOptions options) Saves all slides of a presentation to a set of files representing XAML markup.
getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting) Returns a Thumbnail BufferedImage objects for all slides of a presentation.
getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides) Returns a Thumbnail BufferedImage objects for specified slides of a presentation.
getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, float scaleX, float scaleY) Returns a Thumbnail BufferedImage objects for all slides of a presentation with custom scaling.
getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides, float scaleX, float scaleY) Returns a Thumbnail BufferedImage objects for specified slides of a presentation with custom scaling.
getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, Dimension imageSize) Returns a Thumbnail BufferedImage objects for all slides of a presentation with specified size.
getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides, Dimension imageSize) Returns a Thumbnail BufferedImage objects for specified slides of a presentation with specified size.
getThumbnails(IRenderingOptions options) Returns a Thumbnail BufferedImage objects for all slides of a presentation.
getThumbnails(IRenderingOptions options, int[] slides) Returns a Thumbnail BufferedImage objects for specified slides of a presentation.
getThumbnails(IRenderingOptions options, float scaleX, float scaleY) Returns a Thumbnail BufferedImage objects for all slides of a presentation with custom scaling.
getThumbnails(IRenderingOptions options, int[] slides, float scaleX, float scaleY) Returns a Thumbnail BufferedImage objects for specified slides of a presentation with custom scaling.
getThumbnails(IRenderingOptions options, Dimension imageSize) Returns a Thumbnail BufferedImage objects for all slides of a presentation with specified size.
getThumbnails(IRenderingOptions options, int[] slides, Dimension imageSize) Returns a Thumbnail BufferedImage objects for specified slides of a presentation with specified size.
save(String fname, int[] slides, int format) Saves specified slides of a presentation to a file with the specified format with page number keeping.
save(String fname, int[] slides, int format, ISaveOptions options) Saves specified slides of a presentation to a file with the specified format with page number keeping.
save(OutputStream stream, int[] slides, int format) Saves specified slides of a presentation to a stream in the specified format with page number keeping.
save(OutputStream stream, int[] slides, int format, ISaveOptions options) Saves specified slides of a presentation to a stream in the specified format with page number keeping.
joinPortionsWithSameFormatting() Joins runs with same formatting in all paragraphs in all acceptable shapes in all slides.
dispose() Releases all resources used by this Presentation object.
getPresentation() Returns the parent presentation of a text.

Presentation()

public Presentation()

This constructor creates new presentation from scratch. Created presentation has one empty slide.

Presentation(LoadOptions loadOptions)

public Presentation(LoadOptions loadOptions)

This constructor creates new presentation from scratch. Created presentation has one empty slide.

Parameters:

Parameter Type Description
loadOptions LoadOptions Additional load options.

Presentation(InputStream stream)

public Presentation(InputStream stream)

This constructor is the primary mechanism for reading an existing Presentation.


FileInputStream fis = new FileInputStream("demo.pptx");
 Presentation pres = new Presentation(fis);
 fis.close();

Parameters:

Parameter Type Description
stream java.io.InputStream Input stream.

Presentation(InputStream stream, LoadOptions loadOptions)

public Presentation(InputStream stream, LoadOptions loadOptions)

This constructor is the primary mechanism for reading an existing Presentation.

Parameters:

Parameter Type Description
stream java.io.InputStream Input stream.
loadOptions LoadOptions Additional load options.

Presentation(String file)

public Presentation(String file)

This constructor gets a source file path from which the contents of the Presentation are read.


Presentation pres = new Presentation("demo.pptx");

Parameters:

Parameter Type Description
file java.lang.String Input file.

Presentation(String file, LoadOptions loadOptions)

public Presentation(String file, LoadOptions loadOptions)

This constructor gets a source file path from which the contents of the Presentation are read.

Parameters:

Parameter Type Description
file java.lang.String Input file.
loadOptions LoadOptions Additional load options.

getCurrentDateTime()

public final Date getCurrentDateTime()

Returns or sets date and time which will substitute content of datetime fields. Time of this Presentation object creation by default. Read/write java.util.Date.

Returns: java.util.Date

setCurrentDateTime(Date value)

public final void setCurrentDateTime(Date value)

Returns or sets date and time which will substitute content of datetime fields. Time of this Presentation object creation by default. Read/write java.util.Date.

Parameters:

Parameter Type Description
value java.util.Date

getParent_Immediate()

public final IDOMObject getParent_Immediate()

Returns Parent_Immediate object. Read-only IDOMObject.

Returns: com.aspose.slides.IDOMObject

getHeaderFooterManager()

public final IPresentationHeaderFooterManager getHeaderFooterManager()

Returns actual HeaderFooter manager. Read-only IPresentationHeaderFooterManager.

Returns: IPresentationHeaderFooterManager

getProtectionManager()

public final IProtectionManager getProtectionManager()

Gets manager of the permissions for this presentation. Read-only IProtectionManager.

Returns: IProtectionManager

getSlides()

public final ISlideCollection getSlides()

Returns a list of all slides that are defined in the presentation. Read-only ISlideCollection.

Returns: ISlideCollection

getSections()

public final ISectionCollection getSections()

Returns a list of all slides sections that are defined in the presentation. Read-only ISectionCollection.

Returns: ISectionCollection

getSlideSize()

public final ISlideSize getSlideSize()

Returns slide size object. Read-only ISlideSize.

Returns: ISlideSize

getNotesSize()

public final INotesSize getNotesSize()

Returns notes slide size object. Read-only INotesSize.

Returns: INotesSize

getLayoutSlides()

public final IGlobalLayoutSlideCollection getLayoutSlides()

Returns a list of all layout slides that are defined in the presentation. Read-only IGlobalLayoutSlideCollection.


You can access to alternative API for adding/inserting/removing/cloning layout slides by using IMasterSlide.LayoutSlides property.

Returns: IGlobalLayoutSlideCollection

getMasters()

public final IMasterSlideCollection getMasters()

Returns a list of all master slides that are defined in the presentation. Read-only IMasterSlideCollection.

Returns: IMasterSlideCollection

getMasterNotesSlideManager()

public final IMasterNotesSlideManager getMasterNotesSlideManager()

Returns notes master manager. Read-only IMasterNotesSlideManager.

Returns: IMasterNotesSlideManager

getMasterHandoutSlideManager()

public final IMasterHandoutSlideManager getMasterHandoutSlideManager()

Returns handout master manager. Read-only IMasterHandoutSlideManager.

Returns: IMasterHandoutSlideManager

getFontsManager()

public final IFontsManager getFontsManager()

Returns fonts manager. Read-only IFontsManager.

Returns: IFontsManager

getDefaultTextStyle()

public final ITextStyle getDefaultTextStyle()

Returns default text style for shapes. Read-only ITextStyle.

Returns: ITextStyle

getCommentAuthors()

public final ICommentAuthorCollection getCommentAuthors()

Returns the collection of comments autors. Read-only ICommentAuthorCollection.

Returns: ICommentAuthorCollection

getDocumentProperties()

public final IDocumentProperties getDocumentProperties()

Returns DocumentProperties object which contains standard and custom document properties. Read-only IDocumentProperties.

Returns: IDocumentProperties

getImages()

public final IImageCollection getImages()

Returns the collection of all images in the presentation. Read-only IImageCollection.

Returns: IImageCollection

getAudios()

public final IAudioCollection getAudios()

Returns the collection of all embedded audio files in the presentation. Read-only IAudioCollection.

Returns: IAudioCollection

getVideos()

public final IVideoCollection getVideos()

Returns the collection of all embedded video files in the presentation. Read-only IVideoCollection.

Returns: IVideoCollection

getSlideShowSettings()

public final SlideShowSettings getSlideShowSettings()

Returns the slide show settings for the presentation.

Returns: SlideShowSettings

getDigitalSignatures()

public final IDigitalSignatureCollection getDigitalSignatures()

Returns the collection of signatures used to sign the presentation. Read-only IDigitalSignatureCollection.


Presentation pres = new Presentation("SomePresentationSigned.pptx");
 try
 {
     if (pres.getDigitalSignatures().size() > 0)
     {
         boolean allSignaturesAreValid = true;
         System.out.println("Signatures used to sign the presentation: ");
         for (IDigitalSignature signature : pres.getDigitalSignatures())
         {
            System.out.println(signature.getCertificate().hashCode() + ", "
                  + signature.getSignTime().toString() + " -- " + (signature.isValid() ? "VALID" : "INVALID"));
            allSignaturesAreValid &= signature.isValid();
         }
         if (allSignaturesAreValid)
            System.out.println("Presentation is genuine, all signatures are valid.");
         else
            System.out.println("Presentation has been modified since signing.");
     }
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: IDigitalSignatureCollection

getCustomData()

public final ICustomData getCustomData()

Returns the presentation’s custom data. Read-only ICustomData.

Returns: ICustomData

getAllCustomXmlParts()

public final ICustomXmlPart[] getAllCustomXmlParts()

Returns all custom data parts in the presentaion. Read-only ICustomXmlPart[].

Returns: com.aspose.slides.ICustomXmlPart[]

getVbaProject()

public final IVbaProject getVbaProject()

Gets or sets VBA project with presentation macros. Read/write IVbaProject.

Returns: IVbaProject

setVbaProject(IVbaProject value)

public final void setVbaProject(IVbaProject value)

Gets or sets VBA project with presentation macros. Read/write IVbaProject.

Parameters:

Parameter Type Description
value IVbaProject

getHyperlinkQueries()

public final IHyperlinkQueries getHyperlinkQueries()

Provides easy access to all hyperlinks contained in all presentation slides (not in master, layout, notes slides). Read-only IHyperlinkQueries.

Returns: IHyperlinkQueries

getViewProperties()

public final IViewProperties getViewProperties()

Gets presentation wide view properties. Read-only IViewProperties.

Returns: IViewProperties

getFirstSlideNumber()

public final int getFirstSlideNumber()

Represents the first slide number in the presentation

Returns: int

setFirstSlideNumber(int value)

public final void setFirstSlideNumber(int value)

Represents the first slide number in the presentation

Parameters:

Parameter Type Description
value int

getSlideById(long id)

public final IBaseSlide getSlideById(long id)

Returns a Slide, MasterSlide or LayoutSlide by Id.

Parameters:

Parameter Type Description
id long Id of a slide.

Returns: IBaseSlide - IBaseSlide object.

getSourceFormat()

public final int getSourceFormat()

Returns information about from which format presentation was loaded. Read-only SourceFormat.

Returns: int

getMasterTheme()

public final IMasterTheme getMasterTheme()

Returns master theme. Read-only IMasterTheme.

Returns: IMasterTheme

save(String fname, int format)

public final void save(String fname, int format)

Saves all slides of a presentation to a file with the specified format.

Parameters:

Parameter Type Description
fname java.lang.String Path to the created file.
format int Format of the exported data.

save(OutputStream stream, int format)

public final void save(OutputStream stream, int format)

Saves all slides of a presentation to a stream in the specified format.

Parameters:

Parameter Type Description
stream java.io.OutputStream Output stream.
format int Format of the exported data.

save(String fname, int format, ISaveOptions options)

public final void save(String fname, int format, ISaveOptions options)

Saves all slides of a presentation to a file with the specified format and with additional options.

Parameters:

Parameter Type Description
fname java.lang.String Path to the created file.
format int Format of the exported data.
options ISaveOptions Additional format options.

save(OutputStream stream, int format, ISaveOptions options)

public final void save(OutputStream stream, int format, ISaveOptions options)

Saves all slides of a presentation to a stream in the specified format and with additional options.

Parameters:

Parameter Type Description
stream java.io.OutputStream Output stream.
format int Format of the exported data.
options ISaveOptions Additional format options.

save(IXamlOptions options)

public final void save(IXamlOptions options)

Saves all slides of a presentation to a set of files representing XAML markup.


Presentation pres = new Presentation("pres.pptx");
 try {
     XamlOptions xamlOptions = new XamlOptions();
     xamlOptions.setExportHiddenSlides(true);

     pres.save(xamlOptions);
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

Parameter Type Description
options IXamlOptions The XAML format options.

getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting)

public final BufferedImage[] getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting)

Returns a Thumbnail BufferedImage objects for all slides of a presentation.

Parameters:

Parameter Type Description
notesCommentsLayouting INotesCommentsLayoutingOptions Options for notes and comments layouting.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides)

public final BufferedImage[] getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides)

Returns a Thumbnail BufferedImage objects for specified slides of a presentation.

Parameters:

Parameter Type Description
notesCommentsLayouting INotesCommentsLayoutingOptions Options for notes and comments layouting.
slides int[] Array with slide positions, starting from 1.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, float scaleX, float scaleY)

public final BufferedImage[] getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, float scaleX, float scaleY)

Returns a Thumbnail BufferedImage objects for all slides of a presentation with custom scaling.

Parameters:

Parameter Type Description
notesCommentsLayouting INotesCommentsLayoutingOptions Options for notes and comments layouting.
scaleX float The value by which to scale this Thumbnail in the x-axis direction.
scaleY float The value by which to scale this Thumbnail in the y-axis direction.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides, float scaleX, float scaleY)

public final BufferedImage[] getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides, float scaleX, float scaleY)

Returns a Thumbnail BufferedImage objects for specified slides of a presentation with custom scaling.

Parameters:

Parameter Type Description
notesCommentsLayouting INotesCommentsLayoutingOptions Options for notes and comments layouting.
slides int[] Array with slide positions, starting from 1.
scaleX float The value by which to scale this Thumbnail in the x-axis direction.
scaleY float The value by which to scale this Thumbnail in the y-axis direction.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, Dimension imageSize)

public final BufferedImage[] getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, Dimension imageSize)

Returns a Thumbnail BufferedImage objects for all slides of a presentation with specified size.

Parameters:

Parameter Type Description
notesCommentsLayouting INotesCommentsLayoutingOptions Options for notes and comments layouting.
imageSize java.awt.Dimension Size of the image to create.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides, Dimension imageSize)

public final BufferedImage[] getThumbnails(INotesCommentsLayoutingOptions notesCommentsLayouting, int[] slides, Dimension imageSize)

Returns a Thumbnail BufferedImage objects for specified slides of a presentation with specified size.

Parameters:

Parameter Type Description
notesCommentsLayouting INotesCommentsLayoutingOptions Options for notes and comments layouting.
slides int[] Array with slide positions, starting from 1.
imageSize java.awt.Dimension Size of the image to create.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(IRenderingOptions options)

public final BufferedImage[] getThumbnails(IRenderingOptions options)

Returns a Thumbnail BufferedImage objects for all slides of a presentation.

Parameters:

Parameter Type Description
options IRenderingOptions Tiff options.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(IRenderingOptions options, int[] slides)

public final BufferedImage[] getThumbnails(IRenderingOptions options, int[] slides)

Returns a Thumbnail BufferedImage objects for specified slides of a presentation.

Parameters:

Parameter Type Description
options IRenderingOptions Tiff options.
slides int[] Array with slide positions, starting from 1.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(IRenderingOptions options, float scaleX, float scaleY)

public final BufferedImage[] getThumbnails(IRenderingOptions options, float scaleX, float scaleY)

Returns a Thumbnail BufferedImage objects for all slides of a presentation with custom scaling.

Parameters:

Parameter Type Description
options IRenderingOptions Tiff options.
scaleX float The value by which to scale this Thumbnail in the x-axis direction.
scaleY float The value by which to scale this Thumbnail in the y-axis direction.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(IRenderingOptions options, int[] slides, float scaleX, float scaleY)

public final BufferedImage[] getThumbnails(IRenderingOptions options, int[] slides, float scaleX, float scaleY)

Returns a Thumbnail BufferedImage objects for specified slides of a presentation with custom scaling.

Parameters:

Parameter Type Description
options IRenderingOptions Tiff options.
slides int[] Array with slide positions, starting from 1.
scaleX float The value by which to scale this Thumbnail in the x-axis direction.
scaleY float The value by which to scale this Thumbnail in the y-axis direction.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(IRenderingOptions options, Dimension imageSize)

public final BufferedImage[] getThumbnails(IRenderingOptions options, Dimension imageSize)

Returns a Thumbnail BufferedImage objects for all slides of a presentation with specified size.

Parameters:

Parameter Type Description
options IRenderingOptions Tiff options.
imageSize java.awt.Dimension Size of the image to create.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

getThumbnails(IRenderingOptions options, int[] slides, Dimension imageSize)

public final BufferedImage[] getThumbnails(IRenderingOptions options, int[] slides, Dimension imageSize)

Returns a Thumbnail BufferedImage objects for specified slides of a presentation with specified size.

Parameters:

Parameter Type Description
options IRenderingOptions Tiff options.
slides int[] Array with slide positions, starting from 1.
imageSize java.awt.Dimension Size of the image to create.

Returns: java.awt.image.BufferedImage[] - BufferedImage objects.

save(String fname, int[] slides, int format)

public final void save(String fname, int[] slides, int format)

Saves specified slides of a presentation to a file with the specified format with page number keeping.

Parameters:

Parameter Type Description
fname java.lang.String Path to the created file.
slides int[] Array with slide positions, starting from 1.
format int Format of the exported data.

save(String fname, int[] slides, int format, ISaveOptions options)

public final void save(String fname, int[] slides, int format, ISaveOptions options)

Saves specified slides of a presentation to a file with the specified format with page number keeping.

Parameters:

Parameter Type Description
fname java.lang.String Path to the created file.
slides int[] Array with slide positions, starting from 1.
format int Format of the exported data.
options ISaveOptions Additional format options.

save(OutputStream stream, int[] slides, int format)

public final void save(OutputStream stream, int[] slides, int format)

Saves specified slides of a presentation to a stream in the specified format with page number keeping.

Parameters:

Parameter Type Description
stream java.io.OutputStream Output stream.
slides int[] Array with slide positions, starting from 1.
format int Format of the exported data.

save(OutputStream stream, int[] slides, int format, ISaveOptions options)

public final void save(OutputStream stream, int[] slides, int format, ISaveOptions options)

Saves specified slides of a presentation to a stream in the specified format with page number keeping.

Parameters:

Parameter Type Description
stream java.io.OutputStream Output stream.
slides int[] Array with slide positions, starting from 1.
format int Format of the exported data.
options ISaveOptions Additional format options.

joinPortionsWithSameFormatting()

public final void joinPortionsWithSameFormatting()

Joins runs with same formatting in all paragraphs in all acceptable shapes in all slides.

dispose()

public final void dispose()

Releases all resources used by this Presentation object.

getPresentation()

public final IPresentation getPresentation()

Returns the parent presentation of a text. Read-only IPresentation.

Returns: IPresentation