title: how to Convert byte[] to Word of interop object(to a word document)?
body: <p>i want to save a word document in data base and i do that in this way: </p>
  
  <pre><code>  FileStream st = new FileStream(filePath, FileMode.Open);
    byte[] buffer = new byte[st.Length];
    st.Read(buffer, 0, (int)st.Length);
    st.Close();
    //save Buffer into DB
    //myentityobject.FileContent = buffer;
    //save it
  </code></pre>
  
  <p>but when i want to read it ,i don't how to make a word document from the stream that i get from DB.i tried something like this:</p>
  
  <pre><code> var doc = myentityobject.FileContent;
   MemoryStream stream = new MemoryStream(doc as byte[]);
   letterPatternDoc = new Document(stream);
   filePath = @"D:\LetterPatternDocument001.doc";
   object oMissing = System.Reflection.Missing.Value;
   currentApp = new wd.Application();
   currentApp.Visible = true;
   currentDoc = currentApp.Documents.Add(Type.Missing, Type.Missing);
   currentDoc = doc;
   currentDoc.SaveAs(ref path, oMissing, oMissing, oMissing, oMissing, oMissing, false
                 , oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,      oMissing, oMissing);
  </code></pre>
  
  <p>but it dosen't work.</p>
  
  <p>EDIT:</p>
  
  <p>i change the code and it work's now,i saved file by filestream,then read it.but i don't know is it a good solution?</p>
  
  <pre><code>FileStream fileSream = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite);
          BinaryWriter bw = new BinaryWriter(fileSream);
          bw.Write(FileContent);//filecontent is a byte[]
          fileSream.Close();
  
         // WordDoc.OpenDocument(filePath);
  </code></pre>