DocumentSections Property
Returns a collection that represents all sections in the document.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public SectionCollection Sections { get; }

Property Value

Type: SectionCollection
Examples
Specifies how the section starts, from a new page, on the same page or other.
[C#]

Document doc = new Document();
doc.Sections[0].PageSetup.SectionStart = Aspose.Words.SectionStart.Continuous;
Examples
Shows how to add/remove sections in a document.
[C#]

// Open the document.
Document doc = new Document(MyDir + "Section.AddRemove.doc");

// This shows what is in the document originally. The document has two sections.
Console.WriteLine(doc.GetText());

// Delete the first section from the document
doc.Sections.RemoveAt(0);

// Duplicate the last section and append the copy to the end of the document.
int lastSectionIdx = doc.Sections.Count - 1;
Section newSection = doc.Sections[lastSectionIdx].Clone();
doc.Sections.Add(newSection);

// Check what the document contains after we changed it.
Console.WriteLine(doc.GetText());
See Also