Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.
Thu May 12, 2016 6:50 am
I want to insert a new blank page into the docx file ?How can I release it ?Which api is available? And I want to add a preface or Introduction or an Appendix or References.
-
iceblueDDX123
-
- Posts: 34
- Joined: Tue Apr 19, 2016 9:43 am
Thu May 12, 2016 7:17 am
Hi,
Thanks for your inquiry.
Sample code is attached here for your reference.
- Code: Select all
Document doc = new Document("..\\..\\Input\\sample.docx");
Break pageBreak = new Break(doc, BreakType.PageBreak);
//Add a blank page at the begining of document
doc.Sections[0].Paragraphs[0].ChildObjects.Insert(0, pageBreak);
//Add a blank page at the ending of document
Paragraph newParagraph = new Paragraph(doc);
newParagraph.AppendBreak(BreakType.PageBreak);
doc.LastSection.Paragraphs.Add(newParagraph);
doc.SaveToFile(result,FileFormat.Docx);
Welcome to write to us for further assistance.
Best Regards,
Amy
E-iceblue support team
-
amy.zhao
-
- Posts: 2766
- Joined: Wed Jun 27, 2012 8:50 am
Fri May 13, 2016 7:28 am
Hi,
Has your issue been resolved?
Thanks for your feedback in advance.
Best Regards,
Amy
E-iceblue support team
-
amy.zhao
-
- Posts: 2766
- Joined: Wed Jun 27, 2012 8:50 am