A collection of Section objects in a Range.
For a list of all members of this type, see Sections Members.
System.Object
Aspose.Editor.Desktop.Sections
[Visual Basic]
NotInheritable Public Class Sections
[C#]public sealed class Sections
Remarks
Use the Sections property of the Range object to return a Sections collection. You do not create instances of the Sections class directly.
Use the Item property to return a single Section object.
In the current version, it is not possible to add new sections to the Sections collection.
A Sections collection is always "live". Any changes made to the document are reflected in all existing Sections collections.
This is a "live" collection of document elements so getting Count might sometimes have to recalculate the number of items. Consider caching the value of Count in time-critical loops.
Example
Enumerates over all sections in the document and prints a short fragment of text from each section.
[C#]
Document doc = new Document(MyPath + "Welcome.xml");
Sections sections = doc.GetRange().Sections;
int sectionCount = sections.Count;
Console.WriteLine("The document contains {0} sections.", sectionCount);
for (int i = 0; i < sectionCount; i++)
{
Range range = sections[i].GetRange();
// Take 50 characters or all section whicherver is smaller.
range.Length = Math.Min(50, range.Length);
Console.WriteLine("Section summary: {0}...", range.Text);
}
[Visual Basic]
Dim doc As New Document(MyPath & "Welcome.xml")
Dim sections As Sections = doc.GetRange().Sections
Dim sectionCount As Integer = sections.Count
Console.WriteLine("The document contains {0} sections.", sectionCount)
For i As Integer = 0 To sectionCount - 1
Dim range As Range = sections(i).GetRange()
' Take 50 characters or all section whicherver is smaller.
range.Length = Math.Min(50, range.Length)
Console.WriteLine("Section summary: {0}...", range.Text)
Next iRequirements
Namespace: Aspose.Editor.Desktop
Assembly: Aspose.Editor.Desktop (in Aspose.Editor.Desktop.dll)
See Also
Sections Members | Aspose.Editor.Desktop Namespace | Range | Section