Skip to content

Instantly share code, notes, and snippets.

View fileformat-slides-gists's full-sized avatar

fileformat-slides-gists

View GitHub Profile
@fileformat-slides-gists
fileformat-slides-gists / add-text-to-a-slide-programmatically-using-c-sharp.cs
Created April 16, 2024 15:52
How to Add Text to a Slide Programmatically using C# Open-Source API | FileFormat.Slides
// Create an instance of new presentation
Presentation presentation = Presentation.Create($"{documentDirectory}/{filename}");
// Create an instance of TextShape
TextShape shape = new TextShape();
// Set text of the TextShape
shape.Text = "FileFormat.Slides Text Shape Example";
// Create Slide
Slide slide = new Slide();
// Add text shapes.
slide.AddTextShapes(shape);
@fileformat-slides-gists
fileformat-slides-gists / how-to-add-pictures-to-powerpoint-slides.cs
Created April 5, 2024 07:52
How to Add Pictures to PowerPoint PPT PPTX Slides | FileFormat.Slides
Presentation presentation = Presentation.Open($"{documentDirectory}/{filename}");
// Get Slides
var slides = presentation.GetSlides();
var slide = slides[1];
// Get Images from slide
List<Image> images = slide.Images;
// Choose desired image
var image = slide.Images[0];
// Set xAxis
image.X = xAxis;
@fileformat-slides-gists
fileformat-slides-gists / create-ppt-pptx-programmatically.cs
Created April 1, 2024 12:55
Generate Powerpoint PPT/PPTX Programmatically using Free C# Open-Source API | FileFormat.Slides
// Create instance of presentation
Presentation presentation = Presentation.Create($"{documentDirectory}/{filename}");
// Create slide
Slide slide = new Slide();
// Set background color of slide because default background color is black.
slide.BackgroundColor = Colors.Silver;
// Adding slides
presentation.AppendSlide(slide);
// Save presentation
presentation.Save();