Category / Section
Write PowerPoint Files in C# and VB.Net
2 mins read
This article explains how to write PowerPoint presentations in C# and VB.NET .
Creating PowerPoint presentation programmatically with Essential Presentation library is easy and straightforward. Essential PowerPoint library supports writing PowerPoint presentations in C# and VB.NET to a file or a stream. This functionality is exposed through the Presentation.Save method overloads.
The following C#/VB example shows how to write PowerPoint files.
using Syncfusion.Presentation; namespace Write PowerPoint file { class Program { static void Main(string[] args) { //Create PowerPoint Presentation using (IPresentation presentation = Presentation.Create()) { //Add slide to the PowerPoint ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank); //Add textbox to the slide IShape textboxShape = slide.AddTextBox(0, 0, 500, 500); //Add paragraph to the textbody of textbox IParagraph paragraph = textboxShape.TextBody.AddParagraph(); //Add a TextPart to the paragraph ITextPart textPart = paragraph.AddTextPart(); //Add text to the TextPart textPart.Text = "AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company." //Save the Presentation presentation.Save("Output.pptx"); } } } }
Imports Syncfusion.Presentation Module Module1 Sub Main() 'Create PowerPoint Presentation Dim presentationDocument As IPresentation = Presentation.Create() 'Add slide to the PowerPoint Dim slide As ISlide = presentationDocument.Slides.Add(SlideLayoutType.Blank) 'Add textbox to the slide Dim textboxShape As IShape = slide.AddTextBox(0, 0, 500, 500) 'Add paragraph to the textbody of textbox Dim paragraph As IParagraph = textboxShape.TextBody.AddParagraph() 'Add a TextPart to the paragraph Dim textPart As ITextPart = paragraph.AddTextPart() 'Add text to the TextPart textPart.Text = "AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company." 'Save the Presentation presentationDocument.Save("Output.pptx") 'Close the Presentation presentationDocument.Close() End Sub End Module