/// <summary> /// Redact an inline shape by replacing it with a 1px image. /// </summary> /// <param name="InlineShape">The InlineShape to redact.</param> private void RedactInlineShape(Word.InlineShape InlineShape) { string ImagePath = RedactCommon.CreateRedactedImage(); float Height = InlineShape.Height; float Width = InlineShape.Width; InlineShape.Range.Select(); Application.Selection.Delete(ref Missing, ref Missing); Word.InlineShape RedactedImage = Application.Selection.InlineShapes.AddPicture(ImagePath, ref Missing, ref Missing, ref Missing); RedactedImage.AlternativeText = string.Empty; RedactedImage.Height = Height; RedactedImage.Width = Width; }
/// <summary> /// Redact a shapes by replacing it with a 1px image. /// </summary> /// <param name="Document">The document containing the shape.</param> /// <param name="ShapeToRedact">The shape to redact.</param> private void RedactShape(Word.Document Document, Word.Shape ShapeToRedact) { string ImagePath = RedactCommon.CreateRedactedImage(); object AnchorRange = ShapeToRedact.Anchor; object Height = ShapeToRedact.Height; object Width = ShapeToRedact.Width; object Top = ShapeToRedact.Top; object Left = ShapeToRedact.Left; object WrapType = ShapeToRedact.WrapFormat.Type; ((Word.Range)AnchorRange).Select(); ShapeToRedact.Delete(); Word.Shape RedactedImage = Document.Shapes.AddPicture(ImagePath, ref Missing, ref Missing, ref Left, ref Top, ref Width, ref Height, ref AnchorRange); RedactedImage.AlternativeText = string.Empty; RedactedImage.WrapFormat.Type = (Word.WdWrapType)WrapType; }