Create Presentation - C++ PowerPoint API

Create PowerPoint Presentation

To add a simple plain line to a selected slide of the presentation, please follow the steps below:

  1. Create an instance of Presentation class.
  2. Obtain the reference of a slide by using its Index.
  3. Add an AutoShape of Line type using the AddAutoShape method exposed by Shapes object.
  4. 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.

For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/SampleChartresult.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add an autoshape of type line
slide->get_Shapes()->AddAutoShape(Aspose::Slides::ShapeType::Line, 50.0, 150.0, 300.0, 0.0);
//Saving presentation
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);