Getting Started with IronPPT
IronPowerPoint: PowerPoint Library for .NET
IronPPT is a PowerPoint library developed by Iron Software. It excels in providing robust functionality for working with PowerPoint presentations in .NET applications.
- Load, Manipulate, and Save PowerPoint Presentations. Easily work with .pptx and .ppt files.
- SlideSetup: Configure slide size, orientation, background color, and layout.
- Text: Handle text content, styles, splitting, appending text, and adding text boxes.
- TextStyle: Manage font family, size, color, bold, italic, underline, and alignment.
- Shapes: Add and manipulate shapes, including setting size, position, type, and rotation.
- Images: Insert images into slides with options for scaling, alignment, and positioning.
PowerPoint Presentation C# Library for .NET
- Download the C# library for handling PowerPoint Presentation
- Create and modify .pptx or .ppt documents
- Manage slide properties such as order, visibility, content rotation
- Add slide elements such as text, images, and shapes
- Style the content with ease
Installation
IronPPT Library
Installing IronPPT is quick and straightforward. Add the package using the following method:
Install-Package IronPPT
Alternatively, you can download it directly from the official IronPPT NuGet website.
After installation, simply include using IronPPT;
at the top of your C# code to get started.
Applying License Key
To use IronPPT, apply a valid license or trial key by setting the LicenseKey property. Add the following code immediately after the import statement and before calling any IronPPT methods:
:path=/static-assets/ppt/content-code-examples/get-started/get-started-license.cs
IronPPT.License.LicenseKey = "IRONPPT.MYLICENSE.KEY.1EF01";
IronPPT.License.LicenseKey = "IRONPPT.MYLICENSE.KEY.1EF01"
Code Examples
Let’s explore some code examples and the features available.
Create PowerPoint File
Create the PowerPoint presentation by instantiating the PresentationDocument
class using one of its constructors. Use the AddSlide and AddText methods to add slide and text respectively. After that, use the Save
method to export the PowerPoint presentation.
:path=/static-assets/ppt/content-code-examples/get-started/get-started-1.cs
using IronPPT;
// Create new PowerPoint presentation
var document = new PresentationDocument();
// Add empty slide
document.AddSlide();
// Add slide object
Slide slide = new Slide();
slide.AddText("Hello!");
document.AddSlide(slide);
// Export PowerPoint presentation
document.Save("output.pptx");
Imports IronPPT
' Create new PowerPoint presentation
Private document = New PresentationDocument()
' Add empty slide
document.AddSlide()
' Add slide object
Dim slide As New Slide()
slide.AddText("Hello!")
document.AddSlide(slide)
' Export PowerPoint presentation
document.Save("output.pptx")
Add Shape
You can use the AddShape
method from a slide object to add shapes. Various shape properties can be configured, such as fill color, outline color, position, angle, type, and more.
:path=/static-assets/ppt/content-code-examples/get-started/get-started-2.cs
using IronPPT;
// Load a PowerPoint presentation
var document = new PresentationDocument("output.pptx");
// Configure new shape
Shape shape = new Shape();
shape.Name = "triangle";
shape.Type = IronPPT.Enums.ShapeType.Triangle;
shape.Width = 100;
shape.FillColor = new Color("#444444");
shape.OutlineColor = Color.Black;
shape.Position = (200, 200);
// Add shape
document.Slides[0].AddShape(shape);
// Export PowerPoint presentation
document.Save("addShape.pptx");
Imports IronPPT
' Load a PowerPoint presentation
Private document = New PresentationDocument("output.pptx")
' Configure new shape
Private shape As New Shape()
shape.Name = "triangle"
shape.Type = IronPPT.Enums.ShapeType.Triangle
shape.Width = 100
shape.FillColor = New Color("#444444")
shape.OutlineColor = Color.Black
shape.Position = (200, 200)
' Add shape
document.Slides(0).AddShape(shape)
' Export PowerPoint presentation
document.Save("addShape.pptx")
Add Image
Adding an image to any slide is also a simple task. The code example below adds an image to the first slide, modifies the image's properties such as position, angle, name, width, and height, and then saves the updated presentation as a .pptx file.
:path=/static-assets/ppt/content-code-examples/get-started/get-started-3.cs
using IronPPT;
// Create new PowerPoint presentation
var document = new PresentationDocument();
// Add image
Image image = new Image();
image.LoadFromFile("sample.png");
var newImage = document.Slides[0].AddImage(image);
// Edit image's properties
newImage.Position = (200, 200);
newImage.Angle = 45;
newImage.Name = "new image";
newImage.Width = 150;
newImage.Height = 150;
// Export PowerPoint presentation
document.Save("addImage.pptx");
Imports IronPPT
' Create new PowerPoint presentation
Private document = New PresentationDocument()
' Add image
Private image As New Image()
image.LoadFromFile("sample.png")
Dim newImage = document.Slides(0).AddImage(image)
' Edit image's properties
newImage.Position = (200, 200)
newImage.Angle = 45
newImage.Name = "new image"
newImage.Width = 150
newImage.Height = 150
' Export PowerPoint presentation
document.Save("addImage.pptx")
Licensing & Support Available
IronPPT is a commercial library, but free trial licenses are available here.
For more details about Iron Software, visit our website at: https://ironsoftware.com/. If you need support or have any inquiries, please contact our team.
Iron Software Support
For general assistance and technical questions, feel free to email us at: support@ironsoftware.com