ImageGear .NET - Updated
PowerPoint: Loading PowerPoint Documents
User Guide > How to Work with... > Office > How To ... > PowerPoint Documents > PowerPoint: Loading PowerPoint Documents

Loading PowerPoint Documents

The process for loading PowerPoint documents with ImageGear is very similar to that of other document formats. The following steps will enable you to view the first page of a presentation in a PowerPoint document.

Step 1

Add the PowerPoint format to the list of file format filters ImageGear will use to detect formats of loaded content.

C# Example
Copy Code
// Add support for PowerPoint files
ImGearFileFormats.Filters.Add(ImGearOffice.CreatePowerPointFormat());
VB.NET Example
Copy Code
' Add support for PowerPoint  files
ImGearFileFormats.Filters.Add(ImGearOffice.CreatePowerPointFormat())

Step 2

Once the desired PowerPoint file has been opened into a System.IO.Stream, the document can be loaded with the LoadDocument method. The startPageNumber and count parameters of the LoadDocument method can be used to load a select few or all of the slides in the PowerPoint document. The example below will load all available slides.

The GetPageCount method can be used to get the number of slides in a Stream that contains a valid PowerPoint document.

C# Example
Copy Code
// Call the LoadDocument to load the selected sheets from the PowerPoint document.
ImGearDocument imGearDocument = ImGearFileFormats.LoadDocument(fileContent, 0, -1);
VB.NET Example
Copy Code
' Call the LoadDocument to load the selected sheets from the PowerPoint document.
Dim imGearDocument As ImGearDocument = ImGearFileFormats.LoadDocument(fileContent, 0, -1)

Step 3

Once the document is loaded, the ImGearDocument will contain pages, with each one representing an entire slide.

Displaying the first one of the pages you created for the slide is easy using ImageGear’s PageView control. Simply create the control and set the Page property to that of the PowerPoint page. See the Displaying Images topic for more information displaying images with ImageGear.

C# Example
Copy Code
// Display the first page for the sheet.
imGearPageView.Page = imGearDocument.Pages[0];
imGearPageView.Update();
VB.NET Example
Copy Code
' Display the first page for the sheet.
imGearPageView.Page = imGearDocument.Pages(0)
imGearPageView.Update()