Skip to content

Instantly share code, notes, and snippets.

View openize-com-gists's full-sized avatar

openize-com-gists

View GitHub Profile
@openize-com-gists
openize-com-gists / save-all-images-from-powerpoint-presentation-in-c-sharp.cs
Created February 21, 2025 12:39
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");
@openize-com-gists
openize-com-gists / how-to-edit-an-existing-ppt-or-pptx-programmatically-using-free-csharp-fileformat-slides-api.cs
Created February 21, 2025 12:40
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();
@openize-com-gists
openize-com-gists / create-a-table-in-powerpoint-ppt-pptx-programmatically-using-csharp.cs
Created February 21, 2025 12:41
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);
@openize-com-gists
openize-com-gists / how-to-remove-pictures-from-powerpoint-slides.cs
Created February 21, 2025 12:42
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();
@openize-com-gists
openize-com-gists / how-to-draw-rectangles-on-powerpoint-slides.cs
Created February 21, 2025 12:43
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";
@openize-com-gists
openize-com-gists / how-to-draw-lines-on-powerpoint-slides.cs
Created February 21, 2025 12:44
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);
@openize-com-gists
openize-com-gists / how-to-draw-circles-on-powerpoint-slides.cs
Created February 21, 2025 12:45
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);
@openize-com-gists
openize-com-gists / how-to-draw-arrow-on-powerpoint-slides.cs
Created February 21, 2025 12:46
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;
@openize-com-gists
openize-com-gists / draw-a-pentagon-in-powerpoint-slides.cs
Created February 21, 2025 12:47
Draw a Pentagon in PowerPoint Slides using C# | FileFormat.Slides
// Open an existing presentation
Presentation presentation = Presentation.Open("D:\\AsposeSampleData\\draw.pptx");
// Create a new slide
Slide slide = new Slide();
// Initialize a trapezoid shape with properties
Trapezoid trapezoid = new Trapezoid
{
Animation = FileFormat.Slides.Common.Enumerations.AnimationType.FlyIn,
@openize-com-gists
openize-com-gists / draw-a-Trapezoid-in-powerpoint-slides.cs
Created February 21, 2025 12:51
Draw a Trapezoid in PowerPoint Slides using C# | FileFormat.Slides
// Open an existing presentation
Presentation presentation = Presentation.Open("D:\\AsposeSampleData\\draw.pptx");
// Create a new slide
Slide slide = new Slide();
// Initialize a trapezoid shape with properties
Trapezoid trapezoid = new Trapezoid
{
Animation = FileFormat.Slides.Common.Enumerations.AnimationType.FlyIn,