public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Shapes();
// Instantiate Presentation class that represents the PPTX
Presentation pres = new Presentation();
// Get the first slide
ISlide sld = pres.Slides[0];
// Add autoshape of rectangle type
IShape shp1 = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 40, 150, 50);
IShape shp2 = sld.Shapes.AddAutoShape(ShapeType.Moon, 160, 40, 150, 50);
shp2.FillFormat.FillType = FillType.Solid;
shp2.FillFormat.SolidFillColor.Color = Color.Gray;
for (int i = 0; i < sld.Shapes.Count; i++)
{
var shape = sld.Shapes[i] as AutoShape;
if (shape != null)
{
AutoShape ashp = shape;
ashp.AlternativeText = "User Defined";
}
}
// Save presentation to disk
pres.Save(dataDir + "Set_AlternativeText_out.pptx", SaveFormat.Pptx);
}
}