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 / how-to-draw-arrow-on-powerpoint-slides.cs
Created November 8, 2024 10:36
How to Draw an Arrow in PowerPoint Slides using C# | FileFormat.Slides
Presentation presentation = Presentation.Open($"{documentDirectory}/{filename}");
// Create an instance of Arrow
Arrow Arrow = new Arrow();
// Set height and widt
Arrow.Height = 400.0;
// Set Y position
Arrow.Y = 100.0;
@fileformat-slides-gists
fileformat-slides-gists / how-to-draw-circles-on-powerpoint-slides.cs
Created October 11, 2024 12:11
How to Draw Circle in PowerPoint PPT PPTX Slides | FileFormat.Slides
Presentation presentation = Presentation.Open("D:\\AsposeSampleData\\draw.pptx");
// Create slide
Slide slide = new Slide();
// Create circle object and set it's properties
Circle circle = new Circle();
circle.Width = 500.0;
circle.X = circle.Width / 2;
circle.Y = circle.Height / 2;
circle.BackgroundColor = "5f7200";
slide.DrawCircle(circle);
@fileformat-slides-gists
fileformat-slides-gists / how-to-draw-lines-on-powerpoint-slides.cs
Last active October 11, 2024 12:10
How to Draw Line in PowerPoint PPT PPTX Slides | FileFormat.Slides
Presentation presentation = Presentation.Open("D:\\AsposeSampleData\\draw.pptx");
// Create slide
Slide slide = new Slide();
// Create Rectangle object and set it's properties
Line line = new Line();
line.Width = 500.0;
line.X = line.Width / 2;
line.Y = line.Height / 2;
line.BackgroundColor = "5f7200";
slide.DrawLine(line);
@fileformat-slides-gists
fileformat-slides-gists / how-to-draw-rectangles-on-powerpoint-slides.cs
Created September 10, 2024 11:23
How to Draw Rectangle in PowerPoint PPT PPTX Slides | FileFormat.Slides
Presentation presentation = Presentation.Open("D:\\AsposeSampleData\\draw.pptx");
// Create slide
Slide slide = new Slide();
// Create Rectangle object and set it's properties
Rectangle rectangle = new Rectangle();
rectangle.Width = 500.0;
rectangle.Height =300.0;
rectangle.X = rectangle.Width / 2;
rectangle.Y = rectangle.Height / 2;
rectangle.BackgroundColor = "5f7200";
@fileformat-slides-gists
fileformat-slides-gists / how-to-remove-pictures-from-powerpoint-slides.cs
Created July 19, 2024 11:22
How to Remove Pictures from PowerPoint PPT PPTX Slides
Presentation presentation = Presentation.Open("File_Path");
// 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];
// Remove image
image.Remove();
@fileformat-slides-gists
fileformat-slides-gists / create-a-table-in-powerpoint-ppt-pptx-programmatically-using-csharp.cs
Created May 9, 2024 13:30
Create a Table in PowerPoint PPT, PPTX Programmatically using C# | Openize Slide API
// Create instance of presentation
Presentation presentation = Presentation.Open($"{documentDirectory}/{filename}");
// Get desired slide
Slide slide = presentation.GetSlides()[0];
// Create a new table
Table table = new Table();
// Define table columns
TableColumn col1 = new TableColumn();
col1.Name = "ID";
table.Columns.Add(col1);
@fileformat-slides-gists
fileformat-slides-gists / how-to-edit-an-existing-ppt-or-pptx-programmatically-using-free-csharp-fileformat-slides-api.cs
Created May 2, 2024 15:13
Edit an Exisiting PPT or PPTX Programmatically using C# Open-Source API | FileFormat.Slides
// Create instance of presentation
Presentation presentation = Presentation.Open($"{documentDirectory}/{filename}");
// Get desired slide
Slide slide = presentation.GetSlides()[0];
// Set background color
slide.BackgroundColor = Colors.Fuchsia;
// Update slide
slide.Update();
// Save presentation
presentation.Save();
@fileformat-slides-gists
fileformat-slides-gists / save-all-images-from-powerpoint-presentation-in-c-sharp.cs
Created April 23, 2024 14:03
Save All Images from PowerPoint Presentation in C# | .NET Open-Source API
// Open presentation
Presentation presentation = Presentation.Open("D:\\AsposeSampleData\\sample.pptx");
// Extract images and save it at specified path.
presentation.ExtractAndSaveImages("directory_path"); */
@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;