title: I want to convert Microsoft Word document to .txt format and save it in my solution folder
body: <p>I am using file uploader control and I need to convert the uploaded <code>.docx</code> file into <code>.txt</code>
  file I used some of the code like below:</p>
  
  <pre><code>object missingType = Type.Missing;
  object readOnly = true;
  object isVisible = false;
  object format = WdSaveFormat.wdFormatText;
  string randomName = DateTime.Now.Ticks.ToString();
  FileUpload1.SaveAs(Server.MapPath("~/TextDoc/") + Path.GetFileName(FileUpload1.PostedFile.FileName));
  object fileName = FileUpload1.PostedFile.FileName;
  object txtFilePath = Server.MapPath("~/TextDoc/") + randomName + ".txt";
  //Open the word document in background
  ApplicationClass applicationclass = new ApplicationClass();
  applicationclass.Documents.Open(ref fileName,
                                  ref readOnly,
                                  ref missingType, ref missingType, ref missingType,
                                  ref missingType, ref missingType, ref missingType,
                                  ref missingType, ref missingType, ref isVisible,
                                  ref missingType, ref missingType, ref missingType,
                                  ref missingType, ref missingType);
  applicationclass.Visible = false;
  Document document = applicationclass.ActiveDocument;
  
  
  //Save the word document as txt file
  document.SaveAs(ref txtFilePath, ref format, ref missingType,
                  ref missingType, ref missingType, ref missingType,
                  ref missingType, ref missingType, ref missingType,
                  ref missingType, ref missingType, ref missingType,
                  ref missingType, ref missingType, ref missingType,
                  ref missingType);
  
  //Close the word document
  document.Close(ref missingType, ref missingType, ref missingType);
  </code></pre>
  
  <p>And I changed 'filename' variable to</p>
  
  <pre><code>object fileName = "~/" + Path.GetFullPath(FileUpload1.FileName);
  </code></pre>
  
  <p>then I am getting exception like:</p>
  
  <pre><code>This command is not available because no document is open.
  </code></pre>
  
  <p>Please any one help me..</p>