Inserting Page Breaks in a Word Document - c# Net

Nov 9 2005 9:44 AM
am new to c# and .Net programming.
I have multiple pages in my word document and would like to insert page breaks as needed.
I know how to create a word document, but am facing diffculty in trying to insert a page break after a paragraph.
For example, If there are 6 paragaphs in the document and i need a pagebreak after the 2nd, 4th & 6th paragraphs and if i place the below mentioned code after the 2nd, 4th & 6th paragraphs, The pagebreak gets introduced after the first paragraph, period. I do not get the other page-breaks.
I am using the same range selection (wrdRng). I am not sure if this is the right way of doing it.
It would be great if i could get a pointer in the right direction.

Thank you in advance !

This is the code i am using :

wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
object oPageBreak = Word.WdBreakType.wdPageBreak;
wrdRng.InsertBreak(ref oPageBreak);