C#: Online Guide
How To: powerpoint SDK
File: Create, Load a PowerPoint File
File: Create, Load a PowerPoint File
  |  
Home ›› XDoc.PowerPoint ›› C# PowerPoint: Create, Load a PowerPoint File

C# PowerPoint - PowerPoint Creating in C#.NET


Tell Users How to Create New PowerPoint File and Load PowerPoint from Other Files




Overview



C#.NET PowerPoint document file creating library control, RasterEdge XDoc.PowerPoint SDK for .NET, is a robust & thread-safe .NET solution which provides a reliable and quick approach for C# developers to create a highly-secure and industry-standard PowerPoint document file. The PowerPoint document file created by RasterEdge C# PowerPoint document creator library is searchable and can be fully populated with editable text and graphics programmatically.


Related .net document control helps:
asp.net doc document viewer: ASP.NET Office Word Document Viewer: view MS Office Word files online using C# in ASP.NET web applications
asp.net webforms pdf editor control: ASP.NET WebForms PDF Editor: create, view, edit, annotate, redact PDF file in ASP.NET WebForms application
asp.net mvc file viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net iis file viewer: C# HTML5 Viewer: Deployment on IIS
asp.net webforms file viewer: ASP.NET WebForms application document viewer control: view, annotate, redact, convert files online in ASP.NET
asp.net text file viewer: C# HTML5 Viewer: Load, View, Convert, Annotate and Edit OpenOffice, CSV and Text file
asp.net pdf editor control: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents


This Visual C# .NET PowerPoint document creation control toolkit can not only allow developers to generate standard PowerPoint document file but also offer them the ability to count the page numbers of generated PowerPoint document by simple C# programming code. As this PowerPoint document creator library is built in .NET Framework 2.0 and designed specifically for .NET applications, C# developers can easily use this professional PowerPoint document generating SDK in all .NET developing applications, including ASP.NET web services and Windows Forms application.


After creating a PowerPoint document in C#.NET using this PowerPoint document creating toolkit, if you need to add some text and draw some graphics on created PowerPoint document file, you can also use this C#.NET PowerPoint document drawing library control.




C# DLLs: Create, Load PowerPoint File



Add necessary XDoc.PowerPoint DLL libraries into your created C# application as references.


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.PowerPoint.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PowerPoint;




Create New PowerPoint Document With One Blank Page in C# Project



In C# class programming, you can use specific APIs to create PowerPoint file. And the PowerPoint document can contain one empty page or multiple empty pages. The following example will tell you how to create a PowerPoint document with one empty page.




String outputFile = Program.RootPath + "\\" + "output.pptx";

//  Create a new PowerPoint Document object with one blank page
PPTXDocument doc = PPTXDocument.Create(outputFile);

//  Save the new created PowerPoint document into file
doc.Save(outputFile);





Create PowerPoint Document From Existing PowerPoint File Using C#



You may also load or create a PowerPoint document object from existing PowerPoint file in C#.net.




//  Load from a file
String inputFilePath1 = Program.RootPath + "\\" + "1.pptx";
PPTXDocument doc1 = new PPTXDocument(inputFilePath1);
if (doc1 == null) throw new Exception("fail to load the file");
//  ...





Load PowerPoint From Stream Object in C# Project



PowerPoint document can be loaded from a stream object in C# programming.




//  Load from a stream
String inputFilePath = Program.RootPath + "\\" + "2.pptx";
using (FileStream fileStream = File.Open(inputFilePath, FileMode.Open, FileAccess.Read))
{
    PPTXDocument doc = new PPTXDocument(fileStream);
    if (doc == null) throw new Exception("fail to load PowerPoint document from the stream");
    //  ...
}