title: C# SteamWriter: How to Create multiple text files and write to them?
body: <p>I'm working on an extension for office using Interop assemblies, as part of this extension the primary goal of an exe I am building is to export PPTX slides as individual images.</p>
  
  <p>I also want to create a text file that would contain some info on each slide. I am able to export the slides. I also create one text file but nothing is written to it. Each file should export as 1.txt, 2.txt...     </p>
  
  <pre><code>class {
  static void ConvertAndExportImagesAndTextFiles(ARGS){
  
  //Some stuff that reads and prepares the slides for the export method
  //Loops and exports several "objSlide" after taking args
  
    foreach (Microsoft.Office.Interop.PowerPoint.Slide objSlide
                                          in objActivePresentation.Slides)
  {
   i++;
  
  string PathAndNumber = string.Concat(FilePath, i);
  string PathAndNumberWithExt = string.Concat(PathAndNumber, ".txt");
  
   FileStream fs = new FileStream(
  
                       PathAndNumberWithExt ,
  
                       FileMode.OpenOrCreate,
  
                        FileAccess.ReadWrite);
  
                  StreamWriter sw = new StreamWriter(fs);
                  try
                  {
                      sw.WriteLine("Howdy World.");
                  }
                  finally
                  {
                  ?????????
                  }
  
    objSlide.Export(FilePath, format, res, res);
  
      }
  </code></pre>
  
  <p>I'm sorry, I am lost... The slides export because they are indexed by PowerPoint, But do I need to incmnt something here? </p>