Click here to Skip to main content
15,909,466 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to insert a blank page on ms word using c#.net?
Posted
Updated 15-Jul-14 9:51am
v3
Comments
ZurdoDev 15-Jul-14 16:35pm    
Record a macro and you'll see most of the code you need.

Where are you stuck?

1 solution

Hello,

you can do it with OpenXML.
http://msdn.microsoft.com/en-us/library/office/bb448854(v=office.15).aspx[^]

Here is an example:
WordprocessingDocument myDoc =
WordprocessingDocument.Open(@"C:\temp\doc.docx", true);

Paragraph para = new Paragraph(new Run(new Break() { Type = BreakValues.Page }));
MainDocumentPart mainPart = myDoc.MainDocumentPart;

mainPart.Document.Body.InsertAfter(para, mainPart.Document.Body.LastChild);
mainPart.Document.Save();


Valery.
 
Share this answer
 
Comments
ZurdoDev 15-Jul-14 22:16pm    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900