title: Word Interop - How to Place an Image at Very Top of Document Using C#
body: <p>I have tried removing headers and footers and setting margins to zero, but my image is never at the very top of the page.</p>
  
  <p>Here is my latest attempt:</p>
  
  <pre><code>    Microsoft.Office.Interop.Word.Application winword = new Microsoft.Office.Interop.Word.Application();
  
  //Set status for word application is to be visible or not.
  winword.Visible = false;
  
  //Create a missing variable for missing value
  object missing = System.Reflection.Missing.Value;
  
  //Create a new document
  Document document = winword.Documents.Add(ref missing, ref missing, ref missing, ref missing);
  // Get the Logo file name
  var eFaxLogo = String.Format(@"{0}\PSILogo.jpg", ConfigurationManager.AppSettings["logo"]);
  
  foreach (Section section in document.Sections)
  {
      Range headerRange = section.Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
      headerRange.Delete();
      Range footerRange = section.Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
      footerRange.Delete();
  }
  
  //adding text to document
  document.PageSetup.LeftMargin = 0F;
  document.PageSetup.TopMargin = 0F;
  document.Content.SetRange(0, 0);
  document.Content.Font.Size = 54;
  document.Content.Font.Name = "Arial Black";
  document.Content.Text = "Fax " + Environment.NewLine;
  
  ...
  
  // Add a picture
  object docRange = document.Range();
  string imagePath = "C:\\Temp\\6clubs.png";
  
  Microsoft.Office.Interop.Word.InlineShape pic = document.InlineShapes.AddPicture(imagePath, ref missing, ref missing, ref docRange);
  Microsoft.Office.Interop.Word.Shape shape = pic.ConvertToShape();
  shape.WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapBehind;
  </code></pre>
  
  <p>I have noticed that if I drop the picture in last that the wdWrapBehind works just fine.  However, if I insert the picture first, not so much.</p>
  
  <p>It is a requirement that the picture be placed at the very top (i.e. zero margin) of the page.  Does anyone know how to do this?</p>