Provides the abstract base class for a main document and a glossary document of a Word document.
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.
Shows how to initialize the subclasses of DocumentBase.
#include <Aspose.Words.Cpp/DocumentBase.h>
Public Member Functions | |
SharedPtr< Shape > | get_BackgroundShape () const |
Gets or sets the background shape of the document. Can be null. More... | |
SharedPtr< DocumentBase > | get_Document () const override |
Gets the document to which this node belongs. More... | |
SharedPtr< FontInfoCollection > | get_FontInfos () const |
Provides access to properties of fonts used in this document. More... | |
SharedPtr< ListCollection > | get_Lists () const |
Provides access to the list formatting used in the document. More... | |
SharedPtr< INodeChangingCallback > | get_NodeChangingCallback () |
Called when a node is inserted or removed in the document. More... | |
Color | get_PageColor () |
Gets or sets the page color of the document. This property is a simpler version of BackgroundShape. More... | |
SharedPtr< IResourceLoadingCallback > | get_ResourceLoadingCallback () const |
Allows to control how external resources are loaded. More... | |
SharedPtr< StyleCollection > | get_Styles () const |
Returns a collection of styles defined in the document. More... | |
SharedPtr< IWarningCallback > | get_WarningCallback () const |
Called during various document processing procedures when an issue is detected that might result in data or formatting fidelity loss. More... | |
virtual const TypeInfo & | GetType () const override |
SharedPtr< Node > | ImportNode (SharedPtr< Node > srcNode, bool isImportChildren) |
Imports a node from another document to the current document. More... | |
SharedPtr< Node > | ImportNode (SharedPtr< Node > srcNode, bool isImportChildren, ImportFormatMode importFormatMode) |
Imports a node from another document to the current document with an option to control formatting. More... | |
virtual bool | Is (const TypeInfo &target) const override |
void | set_BackgroundShape (SharedPtr< Shape > value) |
Setter for get_BackgroundShape. More... | |
void | set_NodeChangingCallback (SharedPtr< INodeChangingCallback > value) |
Setter for get_NodeChangingCallback. More... | |
void | set_PageColor (Color value) |
Setter for get_PageColor. More... | |
void | set_ResourceLoadingCallback (SharedPtr< IResourceLoadingCallback > value) |
Setter for get_ResourceLoadingCallback. More... | |
void | set_WarningCallback (SharedPtr< IWarningCallback > value) |
Setter for get_WarningCallback. 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... | |
![]() | |
virtual bool | Accept (SharedPtr< DocumentVisitor > visitor)=0 |
Accepts a visitor. More... | |
SharedPtr< Node > | Clone (bool isCloneChildren) |
Creates a duplicate of the node. More... | |
int32_t | get_CustomNodeId () const |
Specifies custom node identifier. More... | |
SharedPtr< Node > | get_NextSibling () |
Gets the node immediately following this node. More... | |
virtual NodeType | get_NodeType () const =0 |
Gets the type of 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 String | NodeTypeToString (NodeType nodeType) |
A utility method that converts a node type enum value into a user friendly string. More... | |
static const TypeInfo & | Type () |
System::SharedPtr<Aspose::Words::Drawing::Shape> Aspose::Words::DocumentBase::get_BackgroundShape | ( | ) | const |
Gets or sets the background shape of the document. Can be null.
Microsoft Word allows only a shape that has its ShapeType property equal to Rectangle to be used as a background shape for a document.
Microsoft Word supports only the fill properties of a background shape. All other properties are ignored.
Setting this property to a non-null value will also set the DisplayBackgroundShape to true.
Shows how to set a background shape for every page of a document.
|
overridevirtual |
Gets the document to which this node belongs.
The node always belongs to a document even if it has just been created and not yet added to the tree, or if it has been removed from the tree.
Shows how to create a node and set its owning document.
Reimplemented from Aspose::Words::Node.
System::SharedPtr<Aspose::Words::Fonts::FontInfoCollection> Aspose::Words::DocumentBase::get_FontInfos | ( | ) | const |
Provides access to properties of fonts used in this document.
This collection of font definitions is loaded as is from the document. Font definitions might be optional, missing or incomplete in some documents.
Do not rely on this collection to ascertain that a particular font is used in the document. You should only use this collection to get information about fonts that might be used in the document.
Shows how to print the details of what fonts are present in a document.
Shows how to save a document with embedded TrueType fonts.
System::SharedPtr<Aspose::Words::Lists::ListCollection> Aspose::Words::DocumentBase::get_Lists | ( | ) | const |
Provides access to the list formatting used in the document.
For more information see the description of the ListCollection class.
Shows how to work with list levels.
System::SharedPtr<Aspose::Words::INodeChangingCallback> Aspose::Words::DocumentBase::get_NodeChangingCallback | ( | ) |
Called when a node is inserted or removed in the document.
Shows how customize node changing with a callback.
System::Drawing::Color Aspose::Words::DocumentBase::get_PageColor | ( | ) |
Gets or sets the page color of the document. This property is a simpler version of BackgroundShape.
This property provides a simple way to specify a solid page color for the document. Setting this property creates and sets an appropriate BackgroundShape.
If the page color is not set (e.g. there is no background shape in the document) returns Empty.
Shows how to set the background color for all pages of a document.
System::SharedPtr<Aspose::Words::Loading::IResourceLoadingCallback> Aspose::Words::DocumentBase::get_ResourceLoadingCallback | ( | ) | const |
Allows to control how external resources are loaded.
Shows how to customize the process of loading external resources into a document.
System::SharedPtr<Aspose::Words::StyleCollection> Aspose::Words::DocumentBase::get_Styles | ( | ) | const |
Returns a collection of styles defined in the document.
For more information see the description of the StyleCollection class.
Shows how to access a document's style collection.
Shows how to create and use a paragraph style with list formatting.
System::SharedPtr<Aspose::Words::IWarningCallback> Aspose::Words::DocumentBase::get_WarningCallback | ( | ) | const |
Called during various document processing procedures when an issue is detected that might result in data or formatting fidelity loss.
Shows how to use the IWarningCallback interface to monitor font substitution warnings.
Shows how to set the property for finding the closest match for a missing font from the available font sources.
|
overridevirtual |
Reimplemented from Aspose::Words::CompositeNode.
Reimplemented in Aspose::Words::Document, and Aspose::Words::BuildingBlocks::GlossaryDocument.
System::SharedPtr<Aspose::Words::Node> Aspose::Words::DocumentBase::ImportNode | ( | System::SharedPtr< Aspose::Words::Node > | srcNode, |
bool | isImportChildren | ||
) |
Imports a node from another document to the current document.
This method uses the UseDestinationStyles option to resolve formatting.
Importing a node creates a copy of the source node belonging to the importing document. The returned node has no parent. The source node is not altered or removed from the original document.
Before a node from another document can be inserted into this document, it must be imported. During import, document-specific properties such as references to styles and lists are translated from the original to the importing document. After the node was imported, it can be inserted into the appropriate place in the document using InsertBefore() or InsertAfter().
If the source node already belongs to the destination document, then simply a deep clone of the source node is created.
srcNode | The node being imported. |
isImportChildren | True to import all child nodes recursively; otherwise, false. |
Shows how to import a node from one document to another.
System::SharedPtr<Aspose::Words::Node> Aspose::Words::DocumentBase::ImportNode | ( | System::SharedPtr< Aspose::Words::Node > | srcNode, |
bool | isImportChildren, | ||
Aspose::Words::ImportFormatMode | importFormatMode | ||
) |
Imports a node from another document to the current document with an option to control formatting.
This overload is useful to control how styles and list formatting are imported.
Importing a node creates a copy of the source node belonging to the importing document. The returned node has no parent. The source node is not altered or removed from the original document.
Before a node from another document can be inserted into this document, it must be imported. During import, document-specific properties such as references to styles and lists are translated from the original to the importing document. After the node was imported, it can be inserted into the appropriate place in the document using InsertBefore() or InsertAfter().
If the source node already belongs to the destination document, then simply a deep clone of the source node is created.
srcNode | The node to imported. |
isImportChildren | True to import all child nodes recursively; otherwise, false. |
importFormatMode | Specifies how to merge style formatting that clashes. |
Shows how to import node from source document to destination document with specific options.
|
overridevirtual |
Reimplemented from Aspose::Words::CompositeNode.
Reimplemented in Aspose::Words::Document, and Aspose::Words::BuildingBlocks::GlossaryDocument.
void Aspose::Words::DocumentBase::set_BackgroundShape | ( | System::SharedPtr< Aspose::Words::Drawing::Shape > | value | ) |
Setter for Aspose::Words::DocumentBase::get_BackgroundShape.
void Aspose::Words::DocumentBase::set_NodeChangingCallback | ( | System::SharedPtr< Aspose::Words::INodeChangingCallback > | value | ) |
void Aspose::Words::DocumentBase::set_PageColor | ( | System::Drawing::Color | value | ) |
Setter for Aspose::Words::DocumentBase::get_PageColor.
void Aspose::Words::DocumentBase::set_ResourceLoadingCallback | ( | System::SharedPtr< Aspose::Words::Loading::IResourceLoadingCallback > | value | ) |
void Aspose::Words::DocumentBase::set_WarningCallback | ( | System::SharedPtr< Aspose::Words::IWarningCallback > | value | ) |
Setter for Aspose::Words::DocumentBase::get_WarningCallback.
|
static |