title: Editing Word images within Autoshapes using C#
body: <p>Ok, this has had me stumped for a while - One of our clients would like to have all of their images replaced in a list of a word document.  Finding images themselves is fine, with example code as follows:</p>
  
  <pre><code>    Microsoft.Office.Interop.Word.Application wordDoc;
      wordDoc = new Microsoft.Office.Interop.Word.Application();
      object docName = @"c:\temp\Client.doc";
  
  
      object objBool = false;
      object objBoolTrue = true;
      object objNull = System.Reflection.Missing.Value;
  
      Document openDoc = null;
  
      openDoc = wordDoc.Documents.Open(ref docName, ref objBool, ref objBool, ref objBool, ref objNull,ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull);
  
      List&lt;Microsoft.Office.Interop.Word.Range&gt; ranges = new List&lt;Microsoft.Office.Interop.Word.Range&gt;();
      foreach (Microsoft.Office.Interop.Word.Shape s in openDoc.Shapes)
      {
        // do stuff here with comparing and replacing images
      }
  </code></pre>
  
  <p>However I noticed that it wasn't recognising some images (irrespective of where they were, this is not a header or footer issue).  On further research it appears that the image itself is not a normal imbedded image, but rather an Autoshape.</p>
  
  <p>My code must therefore also be able to inspect the autoshapes in the document and change them if required as well.  However for the life of me, I cannot determine how to inspect the image in an autoshape.</p>
  
  <p>Finding the autoshapes themselves is fairly straightforward, as follows:</p>
  
  <pre><code>ranges = new List&lt;Microsoft.Office.Interop.Word.Range&gt;();
  foreach (Microsoft.Office.Interop.Word.Shape s in openDoc.Shapes)
  {
  ...
  }
  </code></pre>
  
  <p>However once I identify the autoshape, I cannot determine how I find information about the enclosed image.</p>
  
  <p>Does anyone know how I would go about doing this?</p>