Section
Overview
Section is a class in Aspose.Words FOSS for .NET.
Inherits from: CompositeNode, ISectionAttrSource.
Represents a single section in a document.
This class provides 34 methods for working with Section objects in .NET programs.
Available methods include: Accept, AcceptEnd, AcceptStart, AppendChild, AppendContent, ClearContent, ClearHeadersFooters, Clone, CreateNavigator, DeleteHeaderFooterShapes, EnsureMinimum, GetAncestor, and 21 additional methods.
All public members are accessible to any .NET application after installing the Aspose.Words FOSS for .NET package.
Properties: Body, Count, CustomNodeId, Document, FirstChild, HasChildNodes, and 10 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
NodeType | NodeType | Read | Returns Section. |
Body | Body | Read | Returns the Body child node of the section. |
HeadersFooters | HeaderFooterCollection | Read | Provides access to the headers and footers nodes of the section. |
PageSetup | PageSetup | Read | Returns an object that represents page setup and section properties. |
ProtectedForForms | bool | Read/Write | True if the section is protected for forms. |
IsComposite | bool | Read | Returns true as this node can have child nodes. |
HasChildNodes | bool | Read | Returns true if this node has any child nodes. |
FirstChild | Node | Read | Gets the first child of the node. |
LastChild | Node | Read | Gets the last child of the node. |
Count | int | Read | Gets the number of immediate children of this node. |
ParentNode | CompositeNode | Read | Gets the immediate parent of this node. |
Document | DocumentBase | Read | Gets the document to which this node belongs. |
PreviousSibling | Node | Read | Gets the node immediately preceding this node. |
NextSibling | Node | Read | Gets the node immediately following this node. |
Range | Range | Read | Returns a Range object that represents the portion of a document that is contained in this node. |
CustomNodeId | int | Read/Write | Specifies custom node identifier. |
Methods
| Signature | Description |
|---|---|
Section(doc: DocumentBase) | Initializes a new instance of the Section class. |
Clone() | Creates a duplicate of this section. |
Accept(visitor: DocumentVisitor) | Calls VisitSectionStart, then calls Accept for all child nodes of the section and calls VisitSectionEnd at the end. |
AcceptStart(visitor: DocumentVisitor) | Calls AcceptStart(visitor) on this Section instance. |
AcceptEnd(visitor: DocumentVisitor) | Calls AcceptEnd(visitor) on this Section instance. |
PrependContent(sourceSection: Section) | Inserts a copy of content of the source section at the beginning of this section. |
AppendContent(sourceSection: Section) | Inserts a copy of content of the source section at the end of this section. |
ClearContent() | Clears the section. |
ClearHeadersFooters() | Clears the headers and footers of this section. |
ClearHeadersFooters(preserveWatermarks: bool) | Clears the headers and footers of this section. |
DeleteHeaderFooterShapes() | Deletes all shapes (drawing objects) from the headers and footers of this section. |
EnsureMinimum() | Ensures that the section has Body with one Paragraph. |
GetText() | Gets the text of this node and of all its children. |
GetChildNodes(nodeType: NodeType, isDeep: bool) | Returns a collection of child nodes that match the specified type. |
GetChild(nodeType: NodeType, index: int, isDeep: bool) | Returns an Nth child node that matches the specified type. |
SelectNodes(xpath: string) | Selects a list of nodes matching the XPath expression. |
SelectSingleNode(xpath: string) | Selects the first Node that matches the XPath expression. |
GetEnumerator() | Provides support for the for each style iteration over the child nodes of this node. |
AppendChild(newChild: T) | Adds the specified node to the end of the list of child nodes for this node. |
PrependChild(newChild: T) | Adds the specified node to the beginning of the list of child nodes for this node. |
InsertAfter(newChild: T, refChild: Node) | Inserts the specified node immediately after the specified reference node. |
InsertBefore(newChild: T, refChild: Node) | Inserts the specified node immediately before the specified reference node. |
RemoveChild(oldChild: T) | Removes the specified child node. |
RemoveAllChildren() | Removes all the child nodes of the current node. |
RemoveSmartTags() | Removes all SmartTag descendant nodes of the current node. |
IndexOf(child: Node) | Returns the index of the specified child node in the child node array. |
CreateNavigator() | Creates navigator which can be used to traverse and read nodes. |
GetAncestor(ancestorType: Type) | Gets the first ancestor of the specified object type. |
GetAncestorOf() | Calls GetAncestorOf on this Section instance. |
Remove() | Removes itself from the parent. |
NextPreOrder(rootNode: Node) | Gets next node according to the pre-order tree traversal algorithm. |
PreviousPreOrder(rootNode: Node) | Gets the previous node according to the pre-order tree traversal algorithm. |
ToString(saveFormat: SaveFormat) | Exports the content of the node into a string in the specified format. |
NodeTypeToString(nodeType: NodeType) | A utility method that converts a node type enum value into a user friendly string. |