title: Document.Protect is not working
body: <p>Hi I have created one asp.net application, in which i am converting asp:panel to the word document by using the below code snippet.</p>
  
  <pre><code> StringWriter sw = new StringWriter();
              HtmlTextWriter htw = new HtmlTextWriter(sw);
  
              tblMain.RenderControl(htw);
  
              if (strType.Equals("Save"))
              {
                  string filename = DateTime.Now.ToString().Replace("/", "").Replace("-", "").Replace(":", "").Replace(" ", "") + ".doc";
                  string strPath = Server.MapPath("Attachments") + "\\" + filename;
                  StreamWriter sWriter = new StreamWriter(strPath);
                  sWriter.Write(sw.ToString());
                  sWriter.Close();
  </code></pre>
  
  <p>Now the file is saving to the specified folder. after that i am fetching the same file for appending password for the protection. And i used the below code for the same.</p>
  
  <pre><code>Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
                  Microsoft.Office.Interop.Word.Document doc = null;
                  object missing = System.Reflection.Missing.Value;
                  object readOnly = false;
                  object visible = true;
                  object password = "123";
                  object fileToOpen = strPath;
  
                  try
                  {
                      doc = wordApp.Documents.Open(ref fileToOpen, ref missing, ref readOnly, ref missing, ref missing,
                                                      ref missing, ref missing, ref password, ref missing, ref missing, ref missing,
                                                      ref visible, ref visible, ref missing, ref missing, ref missing);
                      doc.Activate();
  
                      doc.Protect(WdProtectionType.wdAllowOnlyComments,ref missing, ref password, ref missing, ref missing);
                      doc.SaveAs(ref fileToOpen, ref missing, ref missing, ref password, ref missing, ref password, ref missing, ref missing,
                                 ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
  
                  }
                  catch (Exception ex)
                  {
                      // exception catching
                  }
                  finally
                  {
                      doc.Close(ref missing, ref missing, ref missing);
                      wordApp.Quit(ref missing, ref missing, ref missing);
                  }
  </code></pre>
  
  <p>But it will save the file along with one folder named as filename_files.</p>
  
  <p>If i Remove the line <code>doc.Protect(WdProtectionType.wdAllowOnlyComments,ref missing, ref password, ref missing, ref missing);</code></p>
  
  <p>it will save the doc file only, but no password appended.</p>
  
  <p>Any idea? Please help me to resolve this issue. All the suggestions are invited.</p>
  
  <p>Thanks in advance..</p>