Aspose::Words::DocumentBase class

DocumentBase class

Provides the abstract base class for a main document and a glossary document of a Word document. To learn more, visit the Aspose.Words Document Object Model (DOM) documentation article.

class DocumentBase : public Aspose::Words::CompositeNode

Methods

MethodDescription
virtual Accept(System::SharedPtr<Aspose::Words::DocumentVisitor>)Accepts a visitor.
virtual AcceptEnd(System::SharedPtr<Aspose::Words::DocumentVisitor>)When implemented in a derived class, calls the VisitXXXEnd method of the specified document visitor.
virtual AcceptStart(System::SharedPtr<Aspose::Words::DocumentVisitor>)When implemented in a derived class, calls the VisitXXXStart method of the specified document visitor.
AppendChild(T)
Clone(bool)Creates a duplicate of the node.
get_BackgroundShape() constGets or sets the background shape of the document. Can be null.
get_Count()Gets the number of immediate children of this node.
get_CustomNodeId() constSpecifies custom node identifier.
get_Document() const overrideGets this instance.
get_FirstChild() constGets the first child of the node.
get_FontInfos() constProvides access to properties of fonts used in this document.
get_FootnoteSeparators() constProvides access to the footnote/endnote separators defined in the document.
get_HasChildNodes()Returns true if this node has any child nodes.
get_IsComposite() overrideReturns true as this node can have child nodes.
get_LastChild() constGets the last child of the node.
get_Lists() constProvides access to the list formatting used in the document.
get_NextNode() const
get_NextSibling()Gets the node immediately following this node.
get_NodeChangingCallback()Called when a node is inserted or removed in the document.
virtual get_NodeType() constGets the type of this node.
get_PageColor()Gets or sets the page color of the document. This property is a simpler version of BackgroundShape.
get_ParentNode()Gets the immediate parent of this node.
get_PreviousSibling()Gets the node immediately preceding this node.
get_PrevNode() const
get_Range()Returns a Range object that represents the portion of a document that is contained in this node.
get_ResourceLoadingCallback() constAllows to control how external resources are loaded.
get_Styles() constReturns a collection of styles defined in the document.
get_WarningCallback() constCalled during various document processing procedures when an issue is detected that might result in data or formatting fidelity loss.
GetAncestor(Aspose::Words::NodeType)Gets the first ancestor of the specified NodeType.
GetAncestorOf()
GetChild(Aspose::Words::NodeType, int32_t, bool)Returns an Nth child node that matches the specified type.
GetChildNodes(Aspose::Words::NodeType, bool)Returns a live collection of child nodes that match the specified type.
GetEnumerator() overrideProvides support for the for each style iteration over the child nodes of this node.
GetText() overrideGets the text of this node and of all its children.
GetType() const override
ImportNode(const System::SharedPtr<Aspose::Words::Node>&, bool)Imports a node from another document to the current document.
ImportNode(const System::SharedPtr<Aspose::Words::Node>&, bool, Aspose::Words::ImportFormatMode)Imports a node from another document to the current document with an option to control formatting.
IndexOf(const System::SharedPtr<Aspose::Words::Node>&)Returns the index of the specified child node in the child node array.
InsertAfter(T, const System::SharedPtr<Aspose::Words::Node>&)
InsertBefore(T, const System::SharedPtr<Aspose::Words::Node>&)
Is(const System::TypeInfo&) const override
IsAncestorNode(const System::SharedPtr<Aspose::Words::Node>&)
NextPreOrder(const System::SharedPtr<Aspose::Words::Node>&)Gets next node according to the pre-order tree traversal algorithm.
static NodeTypeToString(Aspose::Words::NodeType)A utility method that converts a node type enum value into a user friendly string.
PrependChild(T)
PreviousPreOrder(const System::SharedPtr<Aspose::Words::Node>&)Gets the previous node according to the pre-order tree traversal algorithm.
Remove()Removes itself from the parent.
RemoveAllChildren()Removes all the child nodes of the current node.
RemoveChild(T)
RemoveSmartTags()Removes all SmartTag descendant nodes of the current node.
SelectNodes(const System::String&)Selects a list of nodes matching the XPath expression.
SelectSingleNode(const System::String&)Selects the first Node that matches the XPath expression.
set_BackgroundShape(const System::SharedPtr<Aspose::Words::Drawing::Shape>&)Setter for Aspose::Words::DocumentBase::get_BackgroundShape.
set_CustomNodeId(int32_t)Setter for Aspose::Words::Node::get_CustomNodeId.
set_NextNode(const System::SharedPtr<Aspose::Words::Node>&)
set_NodeChangingCallback(const System::SharedPtr<Aspose::Words::INodeChangingCallback>&)Setter for Aspose::Words::DocumentBase::get_NodeChangingCallback.
set_PageColor(System::Drawing::Color)Setter for Aspose::Words::DocumentBase::get_PageColor.
set_PrevNode(const System::SharedPtr<Aspose::Words::Node>&)
set_ResourceLoadingCallback(const System::SharedPtr<Aspose::Words::Loading::IResourceLoadingCallback>&)Setter for Aspose::Words::DocumentBase::get_ResourceLoadingCallback.
set_WarningCallback(const System::SharedPtr<Aspose::Words::IWarningCallback>&)Setter for Aspose::Words::DocumentBase::get_WarningCallback.
SetParent(const System::SharedPtr<Aspose::Words::Node>&)
SetTemplateWeakPtr(uint32_t) override
ToString(Aspose::Words::SaveFormat)Exports the content of the node into a string in the specified format.
ToString(const System::SharedPtr<Aspose::Words::Saving::SaveOptions>&)Exports the content of the node into a string using the specified save options.
static Type()

Remarks

Aspose.Words represents a Word document as a tree of nodes. DocumentBase is a root node of the tree that contains all other nodes of the document.

DocumentBase also stores document-wide information such as Styles and Lists that the tree nodes might refer to.

Examples

Shows how to initialize the subclasses of DocumentBase.

auto doc = MakeObject<Document>();

ASPOSE_ASSERT_EQ(System::ObjectExt::GetType<DocumentBase>(), System::ObjectExt::GetType(doc).get_BaseType());

auto glossaryDoc = MakeObject<GlossaryDocument>();
doc->set_GlossaryDocument(glossaryDoc);

ASPOSE_ASSERT_EQ(System::ObjectExt::GetType<DocumentBase>(), System::ObjectExt::GetType(glossaryDoc).get_BaseType());

See Also