title: how to insert numbering that is linked to styles ms word c#
body: <p>I'm creating an application that is working with word automation. I'm using visual studio 2010, Microsoft word 2010 and working with interop.</p>
  
  <p>I got the following 3 styles in my word document.</p>
  
  <p><img src="https://i.stack.imgur.com/Tdnfe.png" alt="enter image description here"></p>
  
  <p>As you can see I have formatted the styles so that they get on their own level when doing numbering.
  What I would like the application to do is to open an already existing document with numbered bullets (the app can do that) and then add some more (see picture).</p>
  
  <p><img src="https://i.stack.imgur.com/cReRd.png" alt="enter image description here"></p>
  
  <p>So far I've tried this but it doesn't seem to follow the format that I've put in the style manually.</p>
  
  <pre><code>    public void insertTextHeading(Word.Document document, string bookmark, string text, int fontSize, string headingType, int listNumber, int bulletLevel)
      {
          var start = document.Bookmarks[bookmark].Start;
          var end = document.Bookmarks[bookmark].End;
          Word.Range range = document.Range(start, end);
  
          //The text design
          range.Font.Name = "Verdana";
          range.Font.Size = fontSize;
          range.set_Style(headingType);
  
          object n = listNumber;
          Word.ListTemplate template =
              document.Application.ListGalleries[Word.WdListGalleryType.wdNumberGallery].ListTemplates.get_Item(ref n);
  
          object bContinuePrevList = true;
          object applyTo = Word.WdListApplyTo.wdListApplyToSelection;
          object defBehavior = Word.WdDefaultListBehavior.wdWord10ListBehavior;
          object missing = System.Reflection.Missing.Value;
  
          range.ListFormat.ApplyListTemplateWithLevel(
          template, ref bContinuePrevList,
          ref applyTo, ref defBehavior, ref missing);
          range.Text = text;
      }
  </code></pre>