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-lines-on-powerpoint-slides.cs
Created September 27, 2024 06:15
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
Line line = new Line();
line.Width = 500.0;
line.X = rectangle.Width / 2;
line.Y = rectangle.Height / 2;
line.BackgroundColor = "5f7200";
slide.DrawRectangle(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;
@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();