private void EnsureFormatsAreRetainedAfterCopy(Shape placeHolder) { // ensure that each placeholder's copy supports the same or more formats Format[] formatsFromOriginal = ShapeUtil.GetCopyableFormats(placeHolder); Shape copy = ShapeUtil.CopyMsoPlaceHolder(formatsFromOriginal, placeHolder, _templateShapes); Format[] formatsFromCopy = ShapeUtil.GetCopyableFormats(copy); IEnumerable <Format> formatsInBoth = formatsFromCopy.Intersect(formatsFromOriginal); Assert.AreEqual(formatsInBoth.Count(), formatsFromOriginal.Count()); }
// copies placeholder textboxes safely public static Shape SafeCopyPlaceholder(this Shapes shapes, Shape shape) { if (shape.Type != Microsoft.Office.Core.MsoShapeType.msoPlaceholder) { return(shapes.SafeCopy(shape)); } PowerPointLabs.SyncLab.ObjectFormats.Format[] formats = ShapeUtil.GetCopyableFormats(shape); Shape newShape = ShapeUtil.CopyMsoPlaceHolder(formats, shape, shapes); if (newShape == null) { throw new MsoPlaceholderException(shape.PlaceholderFormat.Type); } return(newShape); }