Aspose.Words.Examples.CSharp.Programming_Documents.Working_With_Document.RemoveBreaks.RemoveSectionBreaks C# (CSharp) Method

RemoveSectionBreaks() private static method

private static RemoveSectionBreaks ( Document doc ) : void
doc Document
return void
        private static void RemoveSectionBreaks(Document doc)
        {
            // Loop through all sections starting from the section that precedes the last one 
            // And moving to the first section.
            for (int i = doc.Sections.Count - 2; i >= 0; i--)
            {
                // Copy the content of the current section to the beginning of the last section.
                doc.LastSection.PrependContent(doc.Sections[i]);
                // Remove the copied section.
                doc.Sections[i].Remove();
            }
        }
        // ExEnd:RemoveSectionBreaks