Create Presentations in .NET
Create PowerPoint Presentation
To add a simple plain line to a selected slide of the presentation, please follow the steps below:
- Create an instance of Presentation class.
- Obtain the reference of a slide by using its Index.
- Add an AutoShape of Line type using AddAutoShape method exposed by Shapes object.
- Write the modified presentation as a PPTX file.
In the example given below, we have added a line to the first slide of the presentation.
// 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);
presentation.Save("NewPresentation_out.pptx", SaveFormat.Pptx);
}
Create and Save Presentation
Steps: Create and Save Presentation in C#
- Create an instance of Presentation class.
- Save Presentation to any format supported by SaveFormat
Presentation presentation = new Presentation();
presentation.Save("OutputPresenation.pptx", SaveFormat.Pptx);
Open and Save Presentation
Steps: Open and Save Presentation in C#
- Create an instance of Presentation class with any format i.e. PPT, PPTX, ODP etc.
- Save Presentation to any format supported by SaveFormat
// Load any supported file in Presentation e.g. ppt, pptx, odp etc.
Presentation presentation = new Presentation("Sample.odp");
presentation.Save("OutputPresenation.pptx", SaveFormat.Pptx);
FAQ
What formats can I save a new presentation to?
You can save to PPTX, PPT, and ODP, and export to PDF, XPS, HTML, SVG, and images, among others.
Can I start from a template (POTX/POTM) and save as a regular PPTX?
Yes. Load the template and save to the desired format; POTX/POTM/PPTM and similar formats are supported.
How do I control slide size/aspect ratio when creating a presentation?
Set the slide size (including presets like 4:3 and 16:9 or custom dimensions) and choose how content should scale.
In what units are sizes and coordinates measured?
In points: 1 inch equals 72 units.
How do I handle very large presentations (with many media files) to reduce memory usage?
Use BLOB management strategies, limit in-memory storage by leveraging temporary files, and prefer file-based workflows over purely in-memory streams.
Can I create/save presentations in parallel?
You cannot operate on the same Presentation instance from multiple threads. Run separate, isolated instances per thread or process.
How do I remove the trial watermark and limitations?
Apply a license once per process. The license XML must remain unmodified, and the license setup should be synchronized if multiple threads are involved.
Can I digitally sign the PPTX I create?
Yes. Digital signatures (adding and verifying) are supported for presentations.
Are macros (VBA) supported in created presentations?
Yes. You can create/edit VBA projects and save macro-enabled files such as PPTM/PPSM.