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);
String alttext = "User Defined";
int iCount = sld.Shapes.Count;
for (int i = 0; i < iCount; i++)
{
AutoShape ashp = (AutoShape)sld.Shapes[i];
if (String.Compare(ashp.AlternativeText, alttext, StringComparison.Ordinal) == 0)
{
ashp.Hidden = true;
}
}
// Save presentation to disk
pres.Save(dataDir + "Hiding_Shapes_out.pptx", SaveFormat.Pptx);
}
}