title: Adding image to word document using OpenXML
body: <p>I developed an app that is supposed to add an image to a word document. It takes a copy from the word document and adds the picture to the copy. I tried to add text and it worked just fine but by adding images the word document wants to open a file, by giving an error (the file "name" cannot be opened because there are problems with the content.) </p>
  
  <p>My code looks like this :</p>
  
  <pre><code>File.Copy(file, newFile, true);
       WordprocessingDocument wordFile = WordprocessingDocument.Open(newFile, true);
       Body body = wordFile.MainDocumentPart.Document.Body;
  
       var picture = new Picture();
       var shape = new Shape() { Style = "width: 20px; height: 20px" };
       var imageData = new ImageData() { RelationshipId = "img" };
  
       shape.Append(imageData);
       picture.Append(shape);
       wordFile.MainDocumentPart.AddExternalRelationship(
            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
             new Uri(link_of_image, UriKind.Absolute),"img");
  
       Paragraph para = body.AppendChild(new Paragraph());
       Run run = para.AppendChild(new Run());
       run.AppendChild(new Picture(picture));
  
       wordFile.Close();
  </code></pre>
  
  <p>What could be wrong?</p>