com.aspose.slides
Class Presentation

java.lang.Object
  extended by com.aspose.slides.Presentation

public final class Presentation
extends java.lang.Object

Represents a Microsoft PowerPoint presentation.


  
  [C#]
  FileStream fis = new FileStream("demo.ppt", FileMode.Open, FileAccess.Read);
  Presentation pres = new Presentation(fis);
  fis.Close();
  Slide sl = pres.CloneSlide(pres.Slides[0], 1);
  pres.Slides.RemoveAt(0);
  int i = 1;
  foreach (Slide slide in pres.Slides)
  {
      slide.GetThumbnail().Save("thumb" + i.ToString() + ".bmp");
      i++;
  }
  FileStream fout = new FileStream("demo.ppt", FileMode.Create, FileAccess.Write);
  pres.Write(fout);
  fout.Flush();
  fout.Close();
  [Visual Basic]
  Dim fis As FileStream = New FileStream("demo.ppt", FileMode.Open, FileAccess.Read)
  Dim pres As Presentation = New Presentation(fis)
  fis.Close()
  Dim sl as Slide = pres.CloneSlide(pres.Slides(0), 1)
  pres.Slides.RemoveAt(0)
  Dim i as Integer = 1
  For Each slide In pres.Slides
      slide.GetThumbnail().Save("thumb" & i.ToString() & ".bmp")
      i = i + 1
  Next
  Dim fout As FileStream = New FileStream("demo.ppt", FileMode.Create, FileAccess.Write)
  pres.Write(fout)
  fout.Flush()
  fout.Close()
  


Constructor Summary
Presentation()
           This constructor creates new presentation from scratch.
Presentation(java.io.InputStream stream)
           
Presentation(java.io.InputStream stream, LoadOptions loadOptions)
           
Presentation(LoadOptions loadOptions)
           This constructor creates new presentation from scratch.
Presentation(java.lang.String file)
           This constructor gets a source file path from which the contents of the Presentation are read.
Presentation(java.lang.String file, LoadOptions loadOptions)
           This constructor gets a source file path from which the contents of the Presentation are read.
 
Method Summary
 Slide addBodySlide()
           Adds the new Slide with header and body placeholders to a presentation.
 Slide addDoubleBodySlide()
           Adds the new Slide with header and two body placeholders to a presentation.
 Slide addEmptySlide()
           Adds the new empty Slide to a presentation.
 Slide addHeaderSlide()
           Adds the new Slide with header placeholder to a presentation.
 Slide addTitleSlide()
           Adds the new Slide with header and subheader placeholders to a presentation.
 void cleanAnimations()
           Remove XP+ animations from slides.
 Slide cloneSlide(Slide srcSlide, int position)
           Makes a copy of a slide.
 Slide cloneSlide(Slide srcSlide, int position, Presentation pres, com.aspose.ms.System.Collections.SortedList idList)
           Makes a copy of a slide with master slides and inserts it to another presentation.
 void deleteHandout()
           Deletes Handout object from a presentation.
 void deleteUnusedMasters()
           Deletes all unused masters from a presentation.
 long getActiveSlideId()
           Returns or sets the Id of the active slide in a presentation.
 java.lang.String getAuthor()
          Deprecated. 
 java.lang.String getCategory()
          Deprecated. 
 CommentAuthorCollection getCommentAuthors()
           Returns the list of authors of comments in a presentation.
 java.lang.String getComments()
          Deprecated. 
 java.lang.String getCompany()
          Deprecated. 
 java.util.Date getCreateTime()
           
 DocumentProperties getDocumentProperties()
           Returns the custom properties of a presentation.
 double getEditTime()
          Deprecated. 
 boolean getEncryptDocumentProperties()
           This property makes sense, if presentation is password protected.
 short getFirstSlideNumber()
           Returns or sets the number of the first slide in a presentation.
 FontCollection getFonts()
           Returns a list of all fonts that are used in the presentation.
 java.lang.String getKeywords()
          Deprecated. 
 java.lang.String getLastAuthor()
          Deprecated. 
 java.util.Date getLastPrintTime()
           
 java.util.Date getLastSaveTime()
           
 MainMaster getMainMaster()
           Returns a main master defined in the presentation.
 java.lang.String getManager()
          Deprecated. 
 SlideCollection getMasters()
           Returns a list of all masters that are defined in the presentation.
 NamedSlideShowCollection getNamedSlideShows()
           Returns a collection with named slideshows for this presentations.
 java.awt.Dimension getNotesSize()
           
 java.lang.String getPassword()
           Gets or sets the password to open.
 PictureBulletCollection getPictureBullets()
           Returns a list of all pictures used for a bullets that are defined in the presentation.
 PictureCollection getPictures()
           Returns a list of all pictures that are defined in the presentation.
 Slide getSlideById(long id)
           Returns a slide by Id.
 Slide getSlideByPosition(int position)
           Returns a slide by SlidePosition.
 SlideCollection getSlides()
           Returns a list of all slides that are defined in the presentation.
 SlideShowSettings getSlideShowSettings()
           Returns the settings of a slide show in a presentation.
 java.awt.Dimension getSlideSize()
           
 int getSlideSizeType()
           Gets or sets the SizeType of a slides in a presentation.
 int getSlideViewType()
           Returns or sets the way how the presentation will be opened.
 java.lang.String getSubject()
          Deprecated. 
 TagCollection getTags()
           Returns the tags of a presentation.
 java.lang.String getTitle()
          Deprecated. 
 boolean hasVBAMacros()
           Determines whether the presentation has any VBA macros.
 boolean isOnlyDocumentPropertiesLoaded()
           This property makes sense, if presentation file is password protected and document properties of this file are public.
 boolean isWriteProtected()
           Gets a value indicating whether this presentation is write protected.
 void print()
           Prints the whole presentation to the default printer.
 void print(com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
           Prints the presentation according to the specified printer settings, using the standard (no User Interface) print controller.
 void print(com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings, java.lang.String presName)
           Prints the document according to the specified printer settings, using the standard (no User Interface) print controller and a presentation name.
 void print(java.lang.String printerName)
           Print the whole presentation to the specified printer, using the standard (no User Interface) print controller.
 void removeVBAMacros()
           Removes all VBA macros from the presentation.
 void removeWriteProtection()
           Removes write protection for this presentation.
 void save(java.io.OutputStream stream, int format)
           
 void save(java.io.OutputStream stream, int format, SaveOptions options)
           
 void save(java.lang.String fname, int format)
           Saves all slides of a presentation to a file with the specified format.
 void save(java.lang.String fname, int format, SaveOptions options)
           Saves all slides of a presentation to a file with the specified format and with additional options.
 void saveToPdf(java.io.OutputStream stream)
           
 void saveToPdf(java.io.OutputStream stream, int[] slides)
           
 void saveToPdf(java.lang.String fname)
          Deprecated. 
 void saveToPdf(java.lang.String fname, int[] slides)
          Deprecated. 
 void setActiveSlideId(long value)
           
 void setAuthor(java.lang.String value)
          Deprecated. 
 void setCategory(java.lang.String value)
          Deprecated. 
 void setComments(java.lang.String value)
          Deprecated. 
 void setCompany(java.lang.String value)
          Deprecated. 
 void setCreateTime(java.util.Date value)
           
 void setEditTime(double value)
          Deprecated. 
 void setEncryptDocumentProperties(boolean value)
           
 void setFirstSlideNumber(short value)
           
 void setKeywords(java.lang.String value)
          Deprecated. 
 void setLastAuthor(java.lang.String value)
          Deprecated. 
 void setLastPrintTime(java.util.Date value)
           
 void setLastSaveTime(java.util.Date value)
           
 void setManager(java.lang.String value)
          Deprecated. 
 void setPassword(java.lang.String value)
           
 void setSlideSize(java.awt.Dimension value)
           
 void setSlideSizeType(int value)
           
 void setSlideViewType(int value)
           
 void setSubject(java.lang.String value)
          Deprecated. 
 void setTitle(java.lang.String value)
          Deprecated. 
 void setWriteProtection(java.lang.String password)
           Set write protection for this presentation with specified password.
 void write(java.io.OutputStream stream)
           
 void write(java.lang.String file)
           Writes the contents of the Presentation to a file specified by the file name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Presentation

public Presentation()

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


Presentation

public Presentation(LoadOptions loadOptions)

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

Parameters:
loadOptions - Additional load options.

Presentation

public Presentation(java.io.InputStream stream)

Presentation

public Presentation(java.io.InputStream stream,
                    LoadOptions loadOptions)

Presentation

public Presentation(java.lang.String file)

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


  
  [C#]
  Presentation pres = new Presentation("demo.ppt");
  [Visual Basic]
  Dim pres As Presentation = New Presentation("demo.ppt")
  

Parameters:
file - Input file.

Presentation

public Presentation(java.lang.String file,
                    LoadOptions loadOptions)

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

Parameters:
file - Input file.
loadOptions - Additional load options.
Method Detail

write

public void write(java.lang.String file)

Writes the contents of the Presentation to a file specified by the file name.


  
  [C#]
  pres.Write("demo.ppt");
  [Visual Basic]
  pres.Write("demo.ppt")
  

Parameters:
file - Output file.

write

public void write(java.io.OutputStream stream)

cleanAnimations

public void cleanAnimations()

Remove XP+ animations from slides.


deleteHandout

public void deleteHandout()

Deletes Handout object from a presentation.


deleteUnusedMasters

public void deleteUnusedMasters()

Deletes all unused masters from a presentation.


getSlides

public SlideCollection getSlides()

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


getMasters

public SlideCollection getMasters()

Returns a list of all masters that are defined in the presentation. Read-only Aspose.Slides.SlideCollection.


getMainMaster

public MainMaster getMainMaster()

Returns a main master defined in the presentation. Read-only Aspose.Slides.MainMaster.


getSlideById

public Slide getSlideById(long id)

Returns a slide by Id.

Parameters:
id - Id of a slide.
Returns:
Slide object.

getSlideByPosition

public Slide getSlideByPosition(int position)

Returns a slide by SlidePosition.

Parameters:
position - Position of a slide.
Returns:
Slide object.

cloneSlide

public Slide cloneSlide(Slide srcSlide,
                        int position)

Makes a copy of a slide.

Parameters:
srcSlide - Source slide.
position - Position of a new slide.
Returns:
New slide object.

cloneSlide

public Slide cloneSlide(Slide srcSlide,
                        int position,
                        Presentation pres,
                        com.aspose.ms.System.Collections.SortedList idList)

Makes a copy of a slide with master slides and inserts it to another presentation.

Parameters:
srcSlide - Source slide.
position - Position of a new slide.
pres - Presentation where new slide will be placed.
idList - SortedList object to store temporary information about ppt's masters.
Returns:
New slide object.

addEmptySlide

public Slide addEmptySlide()

Adds the new empty Slide to a presentation.

Returns:
Slide object.

addBodySlide

public Slide addBodySlide()

Adds the new Slide with header and body placeholders to a presentation.

Returns:
Slide object.

addDoubleBodySlide

public Slide addDoubleBodySlide()

Adds the new Slide with header and two body placeholders to a presentation.

Returns:
Slide object.

addTitleSlide

public Slide addTitleSlide()

Adds the new Slide with header and subheader placeholders to a presentation.

Returns:
Slide object.

addHeaderSlide

public Slide addHeaderSlide()

Adds the new Slide with header placeholder to a presentation.

Returns:
Slide object.

getPictures

public PictureCollection getPictures()

Returns a list of all pictures that are defined in the presentation. Read-only Aspose.Slides.PictureCollection.


getFonts

public FontCollection getFonts()

Returns a list of all fonts that are used in the presentation. Read-only Aspose.Slides.FontCollection.


getSlideSize

public java.awt.Dimension getSlideSize()

setSlideSize

public void setSlideSize(java.awt.Dimension value)

getNotesSize

public java.awt.Dimension getNotesSize()

getSlideSizeType

public int getSlideSizeType()

Gets or sets the SizeType of a slides in a presentation. Read/write Aspose.Slides.SlideSizeType.


setSlideSizeType

public void setSlideSizeType(int value)

getSlideViewType

public int getSlideViewType()

Returns or sets the way how the presentation will be opened. Read/write Aspose.Slides.SlideViewType.


setSlideViewType

public void setSlideViewType(int value)

getTitle

@Deprecated
public java.lang.String getTitle()
Deprecated. 

Title property. Read/write string.


setTitle

@Deprecated
public void setTitle(java.lang.String value)
Deprecated. 


getSubject

@Deprecated
public java.lang.String getSubject()
Deprecated. 

Subject property. Read/write string.


setSubject

@Deprecated
public void setSubject(java.lang.String value)
Deprecated. 


getAuthor

@Deprecated
public java.lang.String getAuthor()
Deprecated. 

Author property. Read/write string.


setAuthor

@Deprecated
public void setAuthor(java.lang.String value)
Deprecated. 


getKeywords

@Deprecated
public java.lang.String getKeywords()
Deprecated. 

Keywords property. Read/write string.


setKeywords

@Deprecated
public void setKeywords(java.lang.String value)
Deprecated. 


getComments

@Deprecated
public java.lang.String getComments()
Deprecated. 

Comments property. Read/write string.


setComments

@Deprecated
public void setComments(java.lang.String value)
Deprecated. 


getLastAuthor

@Deprecated
public java.lang.String getLastAuthor()
Deprecated. 

Last author property. Read/write string.


setLastAuthor

@Deprecated
public void setLastAuthor(java.lang.String value)
Deprecated. 


getLastPrintTime

public java.util.Date getLastPrintTime()

setLastPrintTime

public void setLastPrintTime(java.util.Date value)

getEditTime

@Deprecated
public double getEditTime()
Deprecated. 

Edit time of a presentation in seconds. Read/write System.TimeSpan.


Returns TimeSpan.MinValue if edit time is unknown.


setEditTime

@Deprecated
public void setEditTime(double value)
Deprecated. 


getCreateTime

public java.util.Date getCreateTime()

setCreateTime

public void setCreateTime(java.util.Date value)

getLastSaveTime

public java.util.Date getLastSaveTime()

setLastSaveTime

public void setLastSaveTime(java.util.Date value)

getManager

@Deprecated
public java.lang.String getManager()
Deprecated. 

Manager property. Read/write string.


setManager

@Deprecated
public void setManager(java.lang.String value)
Deprecated. 


getCompany

@Deprecated
public java.lang.String getCompany()
Deprecated. 

Company property. Read/write string.


setCompany

@Deprecated
public void setCompany(java.lang.String value)
Deprecated. 


getCategory

@Deprecated
public java.lang.String getCategory()
Deprecated. 

Category property. Read/write string.


setCategory

@Deprecated
public void setCategory(java.lang.String value)
Deprecated. 


getDocumentProperties

public DocumentProperties getDocumentProperties()

Returns the custom properties of a presentation. Read-only Aspose.Slides.DocumentProperties.


getFirstSlideNumber

public short getFirstSlideNumber()

Returns or sets the number of the first slide in a presentation. Read/write short.


setFirstSlideNumber

public void setFirstSlideNumber(short value)

getActiveSlideId

public long getActiveSlideId()

Returns or sets the Id of the active slide in a presentation. Read/write uint.


setActiveSlideId

public void setActiveSlideId(long value)

hasVBAMacros

public boolean hasVBAMacros()

Determines whether the presentation has any VBA macros. Read-only bool.


removeVBAMacros

public void removeVBAMacros()

Removes all VBA macros from the presentation.


getSlideShowSettings

public SlideShowSettings getSlideShowSettings()

Returns the settings of a slide show in a presentation. Read-only Aspose.Slides.SlideShowSettings.


getTags

public TagCollection getTags()

Returns the tags of a presentation. Read-only Aspose.Slides.TagCollection.


getCommentAuthors

public CommentAuthorCollection getCommentAuthors()

Returns the list of authors of comments in a presentation. Read-only Aspose.Slides.CommentAuthorCollection.


getPictureBullets

public PictureBulletCollection getPictureBullets()

Returns a list of all pictures used for a bullets that are defined in the presentation. Read-only Aspose.Slides.PictureBulletCollection.


getNamedSlideShows

public NamedSlideShowCollection getNamedSlideShows()

Returns a collection with named slideshows for this presentations. Read-only NamedSlideShowCollection.


getPassword

public java.lang.String getPassword()

Gets or sets the password to open.

Value: The password.


setPassword

public void setPassword(java.lang.String value)

getEncryptDocumentProperties

public boolean getEncryptDocumentProperties()

This property makes sense, if presentation is password protected. If true then document properties is encrypted in presentation file. If false then document properties is public while presentation is encrypted.


setEncryptDocumentProperties

public void setEncryptDocumentProperties(boolean value)

isOnlyDocumentPropertiesLoaded

public boolean isOnlyDocumentPropertiesLoaded()

This property makes sense, if presentation file is password protected and document properties of this file are public. Value of true means that only document properties are loaded from an encrypted presentation file without use of password. Value of false means that entire encrypted presentation is loaded with use of right password, not only document properties are loaded. If presentation isn't encrypted then property value is always false. If document properties of an encrypted file aren't public then property value is always false. If Presentation.EncryptDocumentProperties is true than IsOnlyDocumentPropertiesLoaded property value is always false.


isWriteProtected

public boolean isWriteProtected()

Gets a value indicating whether this presentation is write protected.


setWriteProtection

public void setWriteProtection(java.lang.String password)

Set write protection for this presentation with specified password.

Parameters:
password - The password.

removeWriteProtection

public void removeWriteProtection()

Removes write protection for this presentation.


save

public void save(java.lang.String fname,
                 int format)

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

Parameters:
fname - Path to the created file.
format - Format of the exported data.

save

public void save(java.io.OutputStream stream,
                 int format)

save

public void save(java.lang.String fname,
                 int format,
                 SaveOptions options)

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

Parameters:
fname - Path to the created file.
format - Format of the exported data.
options - Additional format options.

save

public void save(java.io.OutputStream stream,
                 int format,
                 SaveOptions options)

saveToPdf

@Deprecated
public void saveToPdf(java.lang.String fname)
Deprecated. 

Saves all slides of a presentation to PDF file.

Parameters:
fname - Path to a new PDF file.

saveToPdf

@Deprecated
public void saveToPdf(java.lang.String fname,
                                 int[] slides)
Deprecated. 

Saves specified slides of a presentation to PDF file.

Parameters:
fname - Path to a new PDF file.
slides - Array of int values with slide positions to write to PDF.

saveToPdf

public void saveToPdf(java.io.OutputStream stream)

saveToPdf

public void saveToPdf(java.io.OutputStream stream,
                      int[] slides)

print

public void print()

Prints the whole presentation to the default printer.


print

public void print(com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)

Prints the presentation according to the specified printer settings, using the standard (no User Interface) print controller.

Parameters:
printerSettings - The .NET printer settings to use.

print

public void print(java.lang.String printerName)

Print the whole presentation to the specified printer, using the standard (no User Interface) print controller.

Parameters:
printerName - The name of the printer.

print

public void print(com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings,
                  java.lang.String presName)

Prints the document according to the specified printer settings, using the standard (no User Interface) print controller and a presentation name.

Parameters:
printerSettings - The .NET printer settings to use.
presName - The presentation name to display (for example, in a print status dialog box or printer queue) while printing the presentation.