none
Table Of Contents Problem RRS feed

  • Question

  • Hi

    I am generating a table of contents in C# and it works fine. However the main content starts immediately below the TOC.

    How can I force a page break after the TOC so the content starts at the top of a new page?

    Any help would be much appreciated.

     

    Thanks

    Mark Nash ( grumpykiwi at hotmail.com)

    Monday, August 8, 2011 8:34 PM

Answers

  • Something like this should do it:

    Word.Range rng = default(Word.Range);
    rng = Word.Selection.Range;
    rng.insertBreak(Word.WdBreakType.wdPageBreak);
    

     


    Kind Regards, Rich ... http://greatcirclelearning.com
    Tuesday, August 9, 2011 1:31 AM

All replies

  • Have you tried using sections that are page breaks?
    Monday, August 8, 2011 11:45 PM
  • Something like this should do it:

    Word.Range rng = default(Word.Range);
    rng = Word.Selection.Range;
    rng.insertBreak(Word.WdBreakType.wdPageBreak);
    

     


    Kind Regards, Rich ... http://greatcirclelearning.com
    Tuesday, August 9, 2011 1:31 AM
  • Lots of ways, but, more often than not, I would style the main heading that comes after the TOC as 'page break before'.
     

    Enjoy,
    Tony
    www.WordArticles.com
    Tuesday, August 9, 2011 6:38 AM
  • Thanks to all that replied. Managed to fix it
    Tuesday, August 9, 2011 2:40 PM
  • Thanks to all that replied. Managed to fix it


    Hi Mark

    Could you please share what approach you used, or mark the suggestion(s) that led to an answer?


    Cindy Meister, VSTO/Word MVP
    Tuesday, August 9, 2011 2:50 PM
    Moderator