Home > .NET > C# word automation : Inserting page break

C# word automation : Inserting page break

I went through many articles in order to insert a page break in word document with C#. Though they seemed to work for others, they did not for me. But I did find a way to insert breaks.

object oEndOfDoc = "\\endofdoc";
object paramNextPage = WdBreakType.wdSectionBreakNextPage;

wrdDocument.Bookmarks.get_Item(ref oEndOfDoc).Range.InsertBreak(ref paramNextPage);

WHERE
wrdDocument
- Active word document object of type : Microsoft.Office.Interop.Word.Document

Categories: .NET
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 400 other followers