Skip to content

SlideBuilder Class

Dennis Rosenbaum edited this page Apr 9, 2025 · 1 revision

The SlideBuilder class provides functionality to add and customize PowerPoint slides. It allows you to add text and image elements, apply layout templates, and build slides with various configurations.


Table of Contents

Method Signature
AddText public SlideBuilder AddText(Action<TextBuilder>? action = null)
AddImage public SlideBuilder AddImage(Action<ImageBuilder>? action = null)

AddText

Summary

Adds a text element to the slide. A text element consists of paragraphs with their own properties.

Parameters

Name Type Description
action Action<TextBuilder>? An optional action to configure the TextBuilder.

Code Examples

Code Description Image
.AddText(text => text.AddParagraph("Hello World!")) Adds a single paragraph with the text "Hello World!" image

AddImage

Summary

Adds an image element to the slide.

Parameters

Name Type Description
action Action<ImageBuilder>? An optional action to configure the ImageBuilder.

Code Examples

Code Description Image
.AddImage(image => image.SetImage(imageStream, ".jpg")) Adds an image from a file path
.AddImage(image => image.SetImage("lightbulb.jpg") Adds an image from a stream image

Full working code Example

new PowerPointBuilder("powerpoint.pptx")
   .AddSlide(layout: PowerPoint.Builder.Templates.TitleContentTemplate, slideAction: slide => slide
       .AddText(text => text.AddParagraph("My title"))
       .AddImage(image => image.SetImage("lightbulb.jpg")))
   .Build();

image

Clone this wiki locally