Adding Shapes to Presentation
Contents
[
Hide
]
VSTO
Below is the code snippet for adding line shape:
Slide slide = Application.ActivePresentation.Slides[1];
slide.Shapes.AddLine(10, 10, 100, 10);
Aspose.Slides
To add a simple plain line to a selected slide of the presentation, please follow the steps below:
- Create an instance of Presentation class
- Obtain the reference of a slide by using its Index
- Add an AutoShape of Line type using AddAutoShape method exposed by Shapes object
- Write the modified presentation as a PPTX file
In the example given below, we have added a line to the first slide of the presentation.
//Instantiate Prseetation class that represents the PPTX
Presentation pres = new Presentation();
//Get the first slide
ISlide slide = pres.Slides[0];
//Add an autoshape of type line
slide.Shapes.AddAutoShape(ShapeType.Line, 50, 150, 300, 0);
Download Running Code
Download Sample Code
- [Codeplex](https://asposevsto.codeplex.com/SourceControl/latest#Aspose.Slides Vs VSTO Slides/Adding Shape to Presentation/)
- Github