Presentation

Presentation class

Represents a Microsoft PowerPoint presentation.

public sealed class Presentation : IPresentation

Constructors

NameDescription
Presentation()This constructor creates new presentation from scratch. Created presentation has one empty slide.
Presentation(LoadOptions)This constructor creates new presentation from scratch. Created presentation has one empty slide.
Presentation(Stream)This constructor is the primary mechanism for reading an existing Presentation.
Presentation(string)This constructor gets a source file path from which the contents of the Presentation are read.
Presentation(Stream, LoadOptions)This constructor is the primary mechanism for reading an existing Presentation.
Presentation(string, LoadOptions)This constructor gets a source file path from which the contents of the Presentation are read.

Properties

NameDescription
AllCustomXmlParts { get; }Returns all custom data parts in the presentaion. Read-only ICustomXmlPart[].
Audios { get; }Returns the collection of all embedded audio files in the presentation. Read-only IAudioCollection.
CommentAuthors { get; }Returns the collection of comments autors. Read-only ICommentAuthorCollection.
CurrentDateTime { get; set; }Returns or sets date and time which will substitute content of datetime fields. Time of this Presentation object creation by default. Read/write DateTime.
CustomData { get; }Returns the presentation’s custom data. Read-only ICustomData.
DefaultTextStyle { get; }Returns default text style for shapes. Read-only ITextStyle.
DigitalSignatures { get; }Returns the collection of signatures used to sign the presentation. Read-only IDigitalSignatureCollection.
DocumentProperties { get; }Returns DocumentProperties object which contains standard and custom document properties. Read-only IDocumentProperties.
FirstSlideNumber { get; set; }Represents the first slide number in the presentation
FontsManager { get; }Returns fonts manager. Read-only IFontsManager.
HeaderFooterManager { get; }Returns actual HeaderFooter manager. Read-only IPresentationHeaderFooterManager.
HyperlinkQueries { get; }Provides easy access to all hyperlinks contained in all presentation slides (not in master, layout, notes slides). Read-only IHyperlinkQueries.
Images { get; }Returns the collection of all images in the presentation. Read-only IImageCollection.
LayoutSlides { get; }Returns a list of all layout slides that are defined in the presentation. Read-only IGlobalLayoutSlideCollection.
MasterHandoutSlideManager { get; }Returns handout master manager. Read-only IMasterHandoutSlideManager.
MasterNotesSlideManager { get; }Returns notes master manager. Read-only IMasterNotesSlideManager.
Masters { get; }Returns a list of all master slides that are defined in the presentation. Read-only IMasterSlideCollection.
MasterTheme { get; }Returns master theme. Read-only IMasterTheme.
NotesSize { get; }Returns notes slide size object. Read-only INotesSize.
ProtectionManager { get; }Gets manager of the permissions for this presentation. Read-only IProtectionManager.
Sections { get; }Returns a list of all slides sections that are defined in the presentation. Read-only ISectionCollection.
Slides { get; }Returns a list of all slides that are defined in the presentation. Read-only ISlideCollection.
SlideShowSettings { get; }Returns the slide show settings for the presentation.
SlideSize { get; }Returns slide size object. Read-only ISlideSize.
SourceFormat { get; }Returns information about from which format presentation was loaded. Read-only SourceFormat.
VbaProject { get; set; }Gets or sets VBA project with presentation macros. Read/write IVbaProject.
Videos { get; }Returns the collection of all embedded video files in the presentation. Read-only IVideoCollection.
ViewProperties { get; }Gets presentation wide view properties. Read-only IViewProperties.

Methods

NameDescription
Dispose()Releases all resources used by this Presentation object.
GetImages(IRenderingOptions)Returns a Image objects for all slides of a presentation.
GetImages(IRenderingOptions, int[])Returns a Thumbnail Image objects for specified slides of a presentation.
GetImages(IRenderingOptions, Size)Returns a Thumbnail Image objects for all slides of a presentation with specified size.
GetImages(IRenderingOptions, float, float)Returns a Thumbnail Image objects for all slides of a presentation with custom scaling.
GetImages(IRenderingOptions, int[], Size)Returns a Thumbnail Image objects for specified slides of a presentation with specified size.
GetImages(IRenderingOptions, int[], float, float)Returns a Thumbnail Image objects for specified slides of a presentation with custom scaling.
GetSlideById(uint)Returns a Slide, MasterSlide or LayoutSlide by Id.
HighlightRegex(Regex, Color, IFindResultCallback)Highlights all matches of the regular expression with the specified color.
HighlightText(string, Color)Highlights all matches of the sample text with the specified color.
HighlightText(string, Color, ITextSearchOptions, IFindResultCallback)Highlights all matches of the sample text with the specified color.
JoinPortionsWithSameFormatting()Joins runs with same formatting in all paragraphs in all acceptable shapes in all slides.
ReplaceRegex(Regex, string, IFindResultCallback)Replaces all matches of the regular expression with the specified string.
ReplaceText(string, string, ITextSearchOptions, IFindResultCallback)Replaces all occurrences of the specified text with another specified text.
Save(IXamlOptions)Saves all slides of a presentation to a set of files representing XAML markup.
Save(Stream, SaveFormat)Saves all slides of a presentation to a stream in the specified format.
Save(string, SaveFormat)Saves all slides of a presentation to a file with the specified format.
Save(Stream, int[], SaveFormat)Saves specified slides of a presentation to a stream in the specified format with page number keeping.
Save(Stream, SaveFormat, ISaveOptions)Saves all slides of a presentation to a stream in the specified format and with additional options.
Save(string, int[], SaveFormat)Saves specified slides of a presentation to a file with the specified format with page number keeping.
Save(string, SaveFormat, ISaveOptions)
Save(Stream, int[], SaveFormat, ISaveOptions)Saves specified slides of a presentation to a stream in the specified format with page number keeping.
Save(string, int[], SaveFormat, ISaveOptions)Saves specified slides of a presentation to a file with the specified format with page number keeping.

Examples

The following example shows how to create PowerPoint Presentation.

[C#]
// Instantiate a Presentation object that represents a presentation file
using (Presentation presentation = new Presentation())
{
    // Get the first slide
    ISlide slide = presentation.Slides[0];
    // Add an autoshape of type line
    slide.Shapes.AddAutoShape(ShapeType.Line, 50, 150, 300, 0);
	// Save the presentation file.
    presentation.Save("NewPresentation_out.pptx", SaveFormat.Pptx);
}

The following example shows how to open and save Presentation.

[C#]
// Load any supported file in Presentation e.g. ppt, pptx, odp etc.
using (Presentation presentation = new Presentation("Sample.odp"))
{
	// Save the presentation file.
	presentation.Save("OutputPresenation.pptx", SaveFormat.Pptx);
}

See Also