PresentationDocument Class
Represents a presentation.
This is the root object in the GemBox.Presentation object model.
- Inheritance:
- System.ObjectPresentationDocument
Constructors
PresentationDocument()
Initializes a new instance of the PresentationDocument class.
Properties
CustomXmlParts
Gets the custom XML parts contained in this document.
public CustomXmlPartCollection CustomXmlParts { get; }
Public ReadOnly Property CustomXmlParts As CustomXmlPartCollection
Property Value
The custom XML parts contained in this document.
DocumentProperties
Gets the document properties.
public DocumentProperties DocumentProperties { get; }
Public ReadOnly Property DocumentProperties As DocumentProperties
Property Value
The document properties.
MasterNotes
Gets or sets the master notes slide that is used as a template for all notes slides.
This value is automatically instantiated when the first notes slide is created with the AddNotes() method.
This value can be set only to null. Setting this value to null will remove the master notes and all the notes from the presentation.
public MasterNotesSlide MasterNotes { get; set; }
Public Property MasterNotes As MasterNotesSlide
Property Value
The master notes slide that is used as a template for all notes slides.
Exceptions
- System.ArgumentException
Argument is not null.
MasterSlides
Gets the master slides.
public MasterSlideCollection MasterSlides { get; }
Public ReadOnly Property MasterSlides As MasterSlideCollection
Property Value
The master slides.
ModifyProtection
Gets the modification protection settings.
public ModifyProtection ModifyProtection { get; }
Public ReadOnly Property ModifyProtection As ModifyProtection
Property Value
The modification protection settings.
Sections
Gets the sections.
public SectionCollection Sections { get; }
Public ReadOnly Property Sections As SectionCollection
Property Value
The sections.
Slides
Gets the slides.
Property Value
The slides.
SlideShow
Gets the slide show settings.
public SlideShowSettings SlideShow { get; }
Public ReadOnly Property SlideShow As SlideShowSettings
Property Value
The slide show settings.
SlideSize
Gets the slide size settings.
Property Value
The slide size settings.
TableStyles
Gets the table styles.
public TableStyleCollection TableStyles { get; }
Public ReadOnly Property TableStyles As TableStyleCollection
Property Value
The table styles.
TextContent
Gets the content range of the current PresentationDocument.
Property Value
The content range of the current PresentationDocument.
Remarks
For more information, see Find and Replace example.
Thumbnail
Gets or sets the image used to help end-users identify the presentation document.
Property Value
The image used to help end-users identify the presentation document.
VbaProject
Represents the VbaProject contained in the PresentationDocument.
If the PresentationDocument does not have VbaProject contained, it will be created on accessing this property.
Property Value
ViewProperties
Gets the presentation-wide view properties.
public ViewProperties ViewProperties { get; }
Public ReadOnly Property ViewProperties As ViewProperties
Property Value
The presentation-wide view properties.
Methods
Clone()
Makes a deep clone of this PresentationDocument instance.
Returns
A deep clone of this PresentationDocument instance.
Remarks
Cloning is a process when one or more objects from a presentation are duplicated. Objects can be duplicated to the same or another presentation and to the same or another location (for example, to another slide).
Cloning methods are available on collection types, such as SlideCollection, DrawingCollection, TextParagraphCollection or TextElementCollection. Exception is the PresentationDocument type that has a Clone() method used to make a deep clone of the entire presentation. Cloning methods available on the collection types have two forms: AddClone(Slide) and InsertClone(Int32, Slide) to append the duplicate to the collection or insert it into a specific location in the collection.
Objects contained in the presentation can contain references to other objects. For example, Slide contains a reference to its ParentTemplate, Connector can contain a reference to drawings that it connects (BeginConnection and EndConnection), Action can contain a Target to Slide or CustomSlideShow that should be shown when the action is triggered.
When cloning multiple objects, the desired behavior is to maintain these references in the duplicated objects so that, for example, when Connector is cloned, and later when drawings that it connects are cloned, the duplicated Connector also connects duplicates of the original drawings that are connected.
This reference mapping between an original object and its duplicate is maintained by the instance of the CloneContext type. CloneContext instance is created with Create(PresentationDocument, PresentationDocument) static method. Each object can be cloned exactly once using the same CloneContext instance. If you want to clone the same object multiple times, each time a new CloneContext instance must be used. CloneContext is the most useful when cloning multiple objects one after another or when you want to change a behavior of the cloning operation.
Behavior of the cloning operation can be changed by using Set<T>(T, T) method. With this method you can make an explicit mapping between objects and cloning process will respect that mapping. For example, if you are cloning a Slide instance to another PresentationDocument default behavior would be that its parent template LayoutSlide and MasterSlide would also be cloned to another PresentationDocument. This behavior can be changed by making an explicit mapping from the LayoutSlide that is the ParentTemplate of the Slide that will be cloned to some LayoutSlide in the another PresentationDocument that we wish to be a ParentTemplate of the duplicated Slide. Explicit mapping with Set<T>(T, T) method can currently be made between following type (and their derivatives) instances: SlideObject, Drawing, TableStyle and CustomSlideShow.
ConvertToImageSource(ImageSaveOptions)
Converts single slide specified in options
of this PresentationDocument instance to an System.Windows.Media.ImageSource instance.
public ImageSource ConvertToImageSource(ImageSaveOptions options)
Public Function ConvertToImageSource(options As ImageSaveOptions) As ImageSource
Parameters
options
- ImageSaveOptions
The options used when converting a single presentation's slide to an image.
Returns
- System.Windows.Media.ImageSource
A new System.Windows.Media.ImageSource instance created from a single presentation's slide specified in options
.
Remarks
For more information, see Export PowerPoint in WPF.
See Also
ConvertToXpsDocument(XpsSaveOptions)
Converts this PresentationDocument instance to an System.Windows.Xps.Packaging.XpsDocument instance.
public XpsDocument ConvertToXpsDocument(XpsSaveOptions options)
Public Function ConvertToXpsDocument(options As XpsSaveOptions) As XpsDocument
Parameters
options
- XpsSaveOptions
The options used when converting to XML Paper Specification (XPS) document.
Returns
- System.Windows.Xps.Packaging.XpsDocument
A New System.Windows.Xps.Packaging.XpsDocument instance created from this PresentationDocument instance.
See Also
GetPaginator()
Gets the presentation paginator.
public PresentationDocumentPaginator GetPaginator()
Public Function GetPaginator As PresentationDocumentPaginator
Returns
The presentation paginator.
GetPaginator(PaginatorOptions)
Gets the presentation paginator and updates the presentation based on the specified options
.
public PresentationDocumentPaginator GetPaginator(PaginatorOptions options)
Public Function GetPaginator(options As PaginatorOptions) As PresentationDocumentPaginator
Parameters
options
- PaginatorOptions
The paginator options used to specify which parts of the presentation to update while paginating it.
Returns
The presentation paginator.
Load(Stream, LoadOptions)
Loads a presentation from the specified stream.
public static PresentationDocument Load(Stream stream, LoadOptions options)
Public Shared Function Load(stream As Stream, options As LoadOptions) As PresentationDocument
Parameters
stream
- System.IO.Stream
The stream from which to load a presentation.
options
- LoadOptions
The loading options which can be used to define settings for load operation.
Returns
A loaded presentation.
Load(String)
Loads a presentation from a file with the specified path.
public static PresentationDocument Load(string path)
Public Shared Function Load(path As String) As PresentationDocument
Parameters
path
- System.String
The path from which to load a presentation.
Returns
A loaded presentation.
Load(String, LoadOptions)
Loads a presentation from a file with the specified path.
public static PresentationDocument Load(string path, LoadOptions options)
Public Shared Function Load(path As String, options As LoadOptions) As PresentationDocument
Parameters
path
- System.String
The path from which to load a presentation.
options
- LoadOptions
The loading options which can be used to define settings for load operation.
Returns
A loaded presentation.
Print()
Prints the presentation to the default printer.
Remarks
For more information, see Print example.
Print(String)
Prints the presentation to the specified printer.
Parameters
printerName
- System.String
Printer name.
Remarks
For more information, see Print example.
Print(String, PrintOptions)
Prints the presentation to the specified printer according to specified options.
public void Print(string printerName, PrintOptions options)
Public Sub Print(printerName As String, options As PrintOptions)
Parameters
printerName
- System.String
Printer name.
options
- PrintOptions
Print options.
Remarks
For more information, see Print example.
Save(Stream, SaveOptions)
Saves the presentation in the specified stream.
[ComVisible(false)]
public void Save(Stream stream, SaveOptions options)
<ComVisible(False)>
Public Sub Save(stream As Stream, options As SaveOptions)
Parameters
stream
- System.IO.Stream
The stream in which to save the presentation.
options
- SaveOptions
The saving options which can be used to define settings for save operation.
Save(Object, String)
Saves the presentation to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition).
[ComVisible(false)]
public void Save(object httpResponse, string fileName)
<ComVisible(False)>
Public Sub Save(httpResponse As Object, fileName As String)
Parameters
httpResponse
- System.Object
System.Web.HttpResponse object that can be retrieved through the Response property of the System.Web.HttpApplication, System.Web.HttpContext, System.Web.UI.Page or System.Web.UI.UserControl classes or System.Web.HttpResponseBase object or System.Net.Http.HttpResponseMessage object.
fileName
- System.String
File name that will be presented in client browser when downloading a file.
Remarks
note
Supported only if updating the whole page with a postback and not if doing partial-page updates (when you use UpdatePanel controls to update selected regions of a page).
This method accepts System.Object rather than HttpResponse, HttpResponseBase or HttpResponseMessage because otherwise GemBox.Document assembly would have a dependency on System.Web or System.Net.Http assemblies and could not be used in applications which target Client Profile .NET Framework.
HttpResponse can be retrieved through the Response property of the HttpApplication, HttpContext, Page or UserControl classes.
For supported file extensions, see remarks for Save(String) method.
Exceptions
- System.InvalidOperationException
If file extension is not specified or not supported. If file extension is not recognized, use Save(Object, String, SaveOptions) method overload instead.
Save(Object, String, SaveOptions)
Saves the presentation to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition).
[ComVisible(false)]
public void Save(object httpResponse, string fileName, SaveOptions options)
<ComVisible(False)>
Public Sub Save(httpResponse As Object, fileName As String, options As SaveOptions)
Parameters
httpResponse
- System.Object
System.Web.HttpResponse object that can be retrieved through the Response property of the System.Web.HttpApplication, System.Web.HttpContext, System.Web.UI.Page or System.Web.UI.UserControl classes or System.Web.HttpResponseBase object or System.Net.Http.HttpResponseMessage object.
fileName
- System.String
File name that will be presented in client browser when downloading a file.
options
- SaveOptions
The saving options which can be used to define settings for save operation.
Remarks
note
Supported only if updating the whole page with a postback and not if doing partial-page updates (when you use UpdatePanel controls to update selected regions of a page).
This method accepts System.Object rather than HttpResponse, HttpResponseBase or HttpResponseMessage because otherwise GemBox.Document assembly would have a dependency on System.Web or System.Net.Http assemblies and could not be used in applications which target Client Profile .NET Framework.
HttpResponse can be retrieved through the Response property of the HttpApplication, HttpContext, Page or UserControl classes.
Save(String)
Saves the presentation to a file with the specified path. Path must include file extension.
[ComVisible(true)]
public void Save(string path)
<ComVisible(True)>
Public Sub Save(path As String)
Parameters
path
- System.String
The path to which to save the presentation.
Remarks
File extension that is extracted from the path
is used to create the appropriate SaveOptions derived class instance that is then passed to the Save(String, SaveOptions) method.
Following file extensions are supported:
- Microsoft PowerPoint: .pptx, pptm, .ppsx, .ppsm, .potx, .potm
- Portable Document Format: .pdf
- XML Paper Specification: .xps
- Image: .bmp, .gif, .jpg, .jpeg, .png, .tif, .tiff, .wdp
Exceptions
- System.InvalidOperationException
If file extension is not specified or not supported. If file extension is not recognized, use Save(String, SaveOptions) method overload instead.
- System.PlatformNotSupportedException
File extension is not supported on the current platform.
Save(String, SaveOptions)
Saves the presentation to a file with the specified path.
[ComVisible(false)]
public void Save(string path, SaveOptions options)
<ComVisible(False)>
Public Sub Save(path As String, options As SaveOptions)
Parameters
path
- System.String
The path to which to save the presentation.
options
- SaveOptions
The saving options which can be used to define settings for save operation.
SetThumbnail(PictureContentType, Stream)
Sets the image used to help end-users identify the presentation document.
public PictureContent SetThumbnail(PictureContentType contentType, Stream stream)
Public Function SetThumbnail(contentType As PictureContentType, stream As Stream) As PictureContent
Parameters
contentType
- PictureContentType
Content-type of the image.
stream
- System.IO.Stream
The image stream.
Returns
The image used to help end-users identify the presentation document.
SetThumbnail(String, Stream)
Sets the image used to help end-users identify the presentation document.
public PictureContent SetThumbnail(string contentType, Stream stream)
Public Function SetThumbnail(contentType As String, stream As Stream) As PictureContent
Parameters
contentType
- System.String
Content-type of the image.
stream
- System.IO.Stream
The image stream.
Returns
The image used to help end-users identify the presentation document.
Exceptions
- System.ArgumentException
contentType
is either System.String.Empty or null.