title: Loop through ContentControls from word in my specified order
body: <p>I currently want to loop through a word document in the right order. For this i tried if &amp; switch statements. It still just categorizes it through the order in the word document.  This is just an example. The output in my case becomes "blabla1","blabla2","blabla3"  etc.  Instead i want it to be "blabla2","blabla1","blabla3" Any suggestions?    </p>
  
  <pre><code>namespace KontraktTilTekst {
   public partial class Form1: Form {
    public Url url = new Url();
    public bool[] success = new bool[2];
  
    public Form1() {
     InitializeComponent();
    }
  
    private void button1_Click(object sender, EventArgs e) {
     url.FileExist = File.Exists(url.WordPath) ? true : false; //Tjekker om urlen er der
     if (url.FileExist) {
      if (!String.IsNullOrEmpty(url.TxtFileName)) //Tjekker om feltet til notepadfilen ikke er tomt
      {
       StreamWriter NotepadFile = new StreamWriter(url.TxtPath);
       Microsoft.Office.Interop.Word.Application word = new ApplicationClass();
       object miss = System.Reflection.Missing.Value;
       object path = url.WordPath; // &lt;-------- Path where document is
       object readOnly = false;
       Document document = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss,
        ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss,
        ref miss, ref miss);
  
  
       word.Documents.Open(url.WordPath);
       foreach(ContentControl ff in document.ContentControls) {
        if (ff.Title == "something2") {
         NotepadFile.Write("blabla2");
        } else if (ff.Title == "something1") {
         NotepadFile.Write("blabla1");
        } else if (ff.Title == "something3") {
         NotepadFile.Write("blabla3");
        }
       }
       NotepadFile.Close();
       document.Close(ref miss, ref miss, ref miss);
       word.Quit();
      } else {
       MessageBox.Show("Husk at give txt filen et navn");
      }
     } else {
      //MessageBox.Show(url.FileExist.ToString());
      MessageBox.Show("Prøv med en anden sti");
     }
    }
   }
  } 
  </code></pre>