private PowerPoint.Shape ConvertToSpotlightPicture(List <PowerPoint.Shape> spotlightShapes) { Globals.ThisAddIn.Application.ActiveWindow.View.GotoSlide(this.Index); List <String> shapeNames = new List <String>(); shapeNames.Add("SpotlightShape1"); foreach (PowerPoint.Shape sh in spotlightShapes) { shapeNames.Add(sh.Name); } String[] shapeNamesArray = shapeNames.ToArray(); PowerPoint.ShapeRange newRange = this.Shapes.Range(shapeNamesArray); newRange.Select(); PowerPoint.Selection currentSelection = Globals.ThisAddIn.Application.ActiveWindow.Selection; // Save the original dimensions because ppPastePNG is resized in PowerPoint 2016 float originalWidth = currentSelection.ShapeRange[1].Width; float originalHeight = currentSelection.ShapeRange[1].Height; currentSelection.Cut(); PowerPoint.Shape spotlightPicture = this.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1]; spotlightPicture.Width = originalWidth; spotlightPicture.Height = originalHeight; return(spotlightPicture); }
private PowerPoint.Shape ConvertToSpotlightPicture(List <PowerPoint.Shape> spotlightShapes) { Globals.ThisAddIn.Application.ActiveWindow.View.GotoSlide(this.Index); List <String> shapeNames = new List <String>(); shapeNames.Add("SpotlightShape1"); foreach (PowerPoint.Shape sh in spotlightShapes) { shapeNames.Add(sh.Name); } String[] shapeNamesArray = shapeNames.ToArray(); PowerPoint.ShapeRange newRange = this.Shapes.Range(shapeNamesArray); newRange.Select(); PowerPoint.Selection currentSelection = Globals.ThisAddIn.Application.ActiveWindow.Selection; currentSelection.Cut(); PowerPoint.Shape spotlightPicture = this.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1]; return(spotlightPicture); }