PPT File Viewer for .NET
View presentation files such as PPT without Microsoft PowerPoint or Office Automation
View PPT File Using C#
In order to view PPT file, we’ll use
API which is a feature-rich, powerful and easy to use API for C# platform to be used with any Viewer. Open
package manager, search for Aspose.Slides and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Slides.NET
How to View PPT via C#
Aspose.Slides makes it easy for the developers to view the PPT file with just few lines of code.
Instantiate a Presentation object & load the PPT file
Create an instance of ResponsiveHtmlController for formatting
Create an instance of HtmlOptions and set HtmlFormatter property
Save the PPT presentation in HTML format
Call Process.Start with path to resultant HTML to load PPT content in default browser
System Requirements
Aspose.Slides for .NET is supported on all major operating systems. Just make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms
- Development environment like Microsoft Visual Studio
- Aspose.Slides for .NET referenced in your project
C# example code to view PPT file
string output = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".html";
// instantiate a Presentation object & load the PPT file
using (var presentation = new Aspose.Slides.Presentation("templateppt"))
{
// create HTML export controller
var controller = new Aspose.Slides.Export.ResponsiveHtmlController();
// create an instance of HtmlOptions and set HtmlFormatter property
var htmlOptions = new Aspose.Slides.Export.HtmlOptions
{
HtmlFormatter = Aspose.Slides.Export.HtmlFormatter.CreateCustomFormatter(controller)
};
// save the presentation in HTML
presentation.Save(output, Aspose.Slides.Export.SaveFormat.Html, htmlOptions);
}
// load HTML to view the presentation content
System.Diagnostics.Process.Start(output);
About Aspose.Slides for .NET API
Aspose.Slides API can be used to read, write, manipulate and convert Microsoft PowerPoint documents to PDF, XPS, HTML, TIFF, ODP and various other formats. One can create new files from scratch and save those in the relevant supported formats. Aspose.Slides is a standalone API for creating, parsing or manipulating presentations, slides and elements and it does not depend on any software like Microsoft or OpenOffice.Free App to View PPT
Other Supported Viewer Formats
Using C#, One can also view many other file formats including.