Represents a container for the main text of a section.
Body can contain Paragraph and Table child nodes.
Body is a section-level node and can only be a child of Section. There can only be one Body in a Section.
A minimal valid Body needs to contain at least one Paragraph.
Shows how to construct an Aspose.Words document by hand.
#include <Aspose.Words.Cpp/Body.h>
Public Member Functions | |
Body (SharedPtr< DocumentBase > doc) | |
Initializes a new instance of the Body class. More... | |
bool | Accept (SharedPtr< DocumentVisitor > visitor) override |
Accepts a visitor. More... | |
void | EnsureMinimum () |
If the last child is not a paragraph, creates and appends one empty paragraph. More... | |
NodeType | get_NodeType () const override |
Returns NodeType.Body. More... | |
SharedPtr< Section > | get_ParentSection () |
Gets the parent section of this story. More... | |
virtual const TypeInfo & | GetType () const override |
virtual bool | Is (const TypeInfo &target) const override |
![]() | |
SharedPtr< Paragraph > | AppendParagraph (String text) |
A shortcut method that creates a Paragraph object with optional text and appends it to the end of this object. More... | |
void | DeleteShapes () |
Deletes all shapes from the text of this story. More... | |
SharedPtr< Paragraph > | get_FirstParagraph () |
Gets the first paragraph in the story. More... | |
SharedPtr< Paragraph > | get_LastParagraph () |
Gets the last paragraph in the story. More... | |
SharedPtr< ParagraphCollection > | get_Paragraphs () |
Gets a collection of paragraphs that are immediate children of the story. More... | |
StoryType | get_StoryType () const |
Gets the type of this story. More... | |
SharedPtr< TableCollection > | get_Tables () |
Gets a collection of tables that are immediate children of the story. More... | |
![]() | |
SharedPtr< Node > | AppendChild (SharedPtr< Node > newChild) |
Adds the specified node to the end of the list of child nodes for this node. More... | |
SharedPtr< NodeCollection > | get_ChildNodes () |
Gets all immediate child nodes of this node. More... | |
SharedPtr< CompositeNode > | get_Container () override |
int32_t | get_Count () |
Gets the number of immediate children of this node. More... | |
SharedPtr< Node > | get_FirstChild () const |
Gets the first child of the node. More... | |
bool | get_HasChildNodes () |
Returns true if this node has any child nodes. More... | |
bool | get_IsComposite () override |
Returns true as this node can have child nodes. More... | |
SharedPtr< Node > | get_LastChild () const |
Gets the last child of the node. More... | |
SharedPtr< Node > | GetChild (NodeType nodeType, int32_t index, bool isDeep) |
Returns an Nth child node that matches the specified type. More... | |
SharedPtr< NodeCollection > | GetChildNodes (NodeType nodeType, bool isDeep) |
Returns a live collection of child nodes that match the specified type. More... | |
SharedPtr< Node > | GetCurrentNode () override |
SharedPtr< IEnumerator< SharedPtr< Node > > > | GetEnumerator () override |
Provides support for the for each style iteration over the child nodes of this node. More... | |
SharedPtr< Node > | GetNextMatchingNode (SharedPtr< Node > curNode) override |
String | GetText () override |
Gets the text of this node and of all its children. More... | |
int32_t | IndexOf (SharedPtr< Node > child) |
Returns the index of the specified child node in the child node array. More... | |
SharedPtr< Node > | InsertAfter (SharedPtr< Node > newChild, SharedPtr< Node > refChild) |
Inserts the specified node immediately after the specified reference node. More... | |
SharedPtr< Node > | InsertBefore (SharedPtr< Node > newChild, SharedPtr< Node > refChild) |
Inserts the specified node immediately before the specified reference node. More... | |
SharedPtr< Node > | PrependChild (SharedPtr< Node > newChild) |
Adds the specified node to the beginning of the list of child nodes for this node. More... | |
void | RemoveAllChildren () |
Removes all the child nodes of the current node. More... | |
SharedPtr< Node > | RemoveChild (SharedPtr< Node > oldChild) |
Removes the specified child node. More... | |
void | RemoveSmartTags () |
Removes all SmartTag descendant nodes of the current node. More... | |
SharedPtr< NodeList > | SelectNodes (String xpath) |
Selects a list of nodes matching the XPath expression. More... | |
SharedPtr< Node > | SelectSingleNode (String xpath) |
Selects the first Node that matches the XPath expression. More... | |
![]() | |
SharedPtr< Node > | Clone (bool isCloneChildren) |
Creates a duplicate of the node. More... | |
int32_t | get_CustomNodeId () const |
Specifies custom node identifier. More... | |
virtual SharedPtr< DocumentBase > | get_Document () const |
Gets the document to which this node belongs. More... | |
SharedPtr< Node > | get_NextSibling () |
Gets the node immediately following this node. More... | |
SharedPtr< CompositeNode > | get_ParentNode () |
Gets the immediate parent of this node. More... | |
SharedPtr< Node > | get_PreviousSibling () |
Gets the node immediately preceding this node. More... | |
SharedPtr< Range > | get_Range () |
Returns a Range object that represents the portion of a document that is contained in this node. More... | |
SharedPtr< CompositeNode > | GetAncestor (NodeType ancestorType) |
Gets the first ancestor of the specified NodeType. More... | |
template<typename T > | |
T | GetAncestorOf () |
SharedPtr< Node > | NextPreOrder (SharedPtr< Node > rootNode) |
Gets next node according to the pre-order tree traversal algorithm. More... | |
SharedPtr< Node > | PreviousPreOrder (SharedPtr< Node > rootNode) |
Gets the previous node according to the pre-order tree traversal algorithm. More... | |
void | Remove () |
Removes itself from the parent. More... | |
void | set_CustomNodeId (int32_t value) |
Setter for get_CustomNodeId. More... | |
String | ToString (SaveFormat saveFormat) |
Exports the content of the node into a string in the specified format. More... | |
String | ToString (SharedPtr< SaveOptions > saveOptions) |
Exports the content of the node into a string using the specified save options. More... | |
Static Public Member Functions | |
static const TypeInfo & | Type () |
![]() | |
static const TypeInfo & | Type () |
![]() | |
static const TypeInfo & | Type () |
![]() | |
static String | NodeTypeToString (NodeType nodeType) |
A utility method that converts a node type enum value into a user friendly string. More... | |
static const TypeInfo & | Type () |
Aspose::Words::Body::Body | ( | System::SharedPtr< Aspose::Words::DocumentBase > | doc | ) |
Initializes a new instance of the Body class.
When Body is created, it belongs to the specified document, but is not yet part of the document and ParentNode is null.
To append Body to a Section use Section.InsertAfter or Section.InsertBefore.
doc | The owner document. |
Shows how to construct an Aspose.Words document by hand.
|
overridevirtual |
Accepts a visitor.
Enumerates over this node and all of its children. Each node calls a corresponding method on DocumentVisitor.
For more info see the Visitor design pattern.
visitor | The visitor that will visit the nodes. |
Shows how to use a document visitor to print a document's node structure.
Implements Aspose::Words::Node.
void Aspose::Words::Body::EnsureMinimum | ( | ) |
If the last child is not a paragraph, creates and appends one empty paragraph.
Clears main text from all sections from the document leaving the sections themselves.
|
overridevirtual |
Returns NodeType.Body.
Shows how to iterate through the children of a composite node.
Implements Aspose::Words::Node.
System::SharedPtr<Aspose::Words::Section> Aspose::Words::Body::get_ParentSection | ( | ) |
Gets the parent section of this story.
ParentSection is equivalent to %(Section)ParentNode
.
Shows how to store endnotes at the end of each section, and modify their positions.
|
overridevirtual |
Reimplemented from Aspose::Words::Story.
|
overridevirtual |
Reimplemented from Aspose::Words::Story.
|
static |