This project has moved. For the latest updates, please go here.

Page break

Oct 3, 2014 at 12:27 AM

In my document, in the table, I need the paragraph content to keep on the same page (page breaks should be after paragraph, or row, is completed). Any idea how to do it? And, generally, how to add a page break?

Thank you!
Jul 21, 2015 at 12:08 PM
Just add this function into Container.cs:
public virtual void InsertPageBreak(bool trackChanges = false)
            var newParagraphSection = new XElement
                XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("r", DocX.w.NamespaceName), new XElement(XName.Get("br", DocX.w.NamespaceName), new XAttribute(XName.Get("type", DocX.w.NamespaceName), "page")))

            if (trackChanges)
                newParagraphSection = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, newParagraphSection);

And you can call document.InsertPageBreak();