public abstract class DocumentBase extends CompositeNode
To learn more, visit the Aspose.Words Document Object Model (DOM) documentation article.
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 getStyles() and getLists() that the tree nodes might refer to.
Document,
DocumentBase| Modifier | Constructor and Description |
|---|---|
protected |
DocumentBase()
Initializes a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
Shape |
getBackgroundShape()
Gets the background shape of the document.
|
DocumentBase |
getDocument()
Gets the document to which this node belongs.
|
FontInfoCollection |
getFontInfos()
Provides access to properties of fonts used in this document.
|
ListCollection |
getLists()
Provides access to the list formatting used in the document.
|
INodeChangingCallback |
getNodeChangingCallback()
Called when a node is inserted or removed in the document.
|
java.awt.Color |
getPageColor()
Gets the page color of the document.
|
IResourceLoadingCallback |
getResourceLoadingCallback()
Allows to control how external resources are loaded.
|
StyleCollection |
getStyles()
Returns a collection of styles defined in the document.
|
IWarningCallback |
getWarningCallback()
Called during various document processing procedures when an issue is detected that might result in data or formatting fidelity loss.
|
Node |
importNode(Node srcNode,
boolean isImportChildren)
|
Node |
importNode(Node srcNode,
boolean isImportChildren,
int importFormatMode) |
protected void |
resetState() |
void |
setBackgroundShape(Shape value)
Sets the background shape of the document.
|
void |
setNodeChangingCallback(INodeChangingCallback value)
Called when a node is inserted or removed in the document.
|
void |
setPageColor(java.awt.Color value)
Sets the page color of the document.
|
void |
setResourceLoadingCallback(IResourceLoadingCallback value)
Allows to control how external resources are loaded.
|
void |
setWarningCallback(IWarningCallback value)
Called during various document processing procedures when an issue is detected that might result in data or formatting fidelity loss.
|
acceptChildren, acceptCore, appendChild, coreRemoveSelfOnly, getChild, getChildNodes, getChildNodes, getContainer, getCount, getCurrentNode, getFirstChild, getLastChild, getNextMatchingNode, getText, hasChildNodes, indexOf, insertAfter, insertBefore, isComposite, iterator, prependChild, removeAllChildren, removeChild, removeSmartTags, selectNodes, selectSingleNodeaccept, dd, deepClone, getAncestor, getAncestor, getCustomNodeId, getNextSibling, getNodeType, getParentNode, getPreviousSibling, getRange, memberwiseClone, nextPreOrder, nodeTypeToString, previousPreOrder, remove, setCustomNodeId, toString, toString, toString, visitorActionToBoolprotected void resetState()
public Node importNode(Node srcNode, boolean isImportChildren)
Imports a node from another document to the current document.
This method uses the ImportFormatMode.USE_DESTINATION_STYLES 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 CompositeNode.insertBefore(com.aspose.words.Node, com.aspose.words.Node) or CompositeNode.insertAfter(com.aspose.words.Node, com.aspose.words.Node).
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.NodeImporterpublic DocumentBase getDocument()
NodeThe 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.
getDocument in class Nodepublic INodeChangingCallback getNodeChangingCallback()
INodeChangingCallback value.public void setNodeChangingCallback(INodeChangingCallback value)
value - The corresponding INodeChangingCallback value.public IResourceLoadingCallback getResourceLoadingCallback()
IResourceLoadingCallback value.public void setResourceLoadingCallback(IResourceLoadingCallback value)
value - The corresponding IResourceLoadingCallback value.public FontInfoCollection getFontInfos()
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.
FontInfoCollection value.FontInfoCollection,
FontInfopublic StyleCollection getStyles()
For more information see the description of the StyleCollection class.
StyleCollection,
Stylepublic ListCollection getLists()
For more information see the description of the ListCollection class.
ListCollection value.ListCollection,
List,
ListFormatpublic IWarningCallback getWarningCallback()
Document.getPageCount() actually build the document layout which is used later for rendering, and the layout warnings may be lost if warning callback is specified just for the rendering calls later.IWarningCallback value.public void setWarningCallback(IWarningCallback value)
Document.getPageCount() actually build the document layout which is used later for rendering, and the layout warnings may be lost if warning callback is specified just for the rendering calls later.value - The corresponding IWarningCallback value.public Shape getBackgroundShape()
Microsoft Word allows only a shape that has its ShapeBase.getShapeType() property equal to ShapeType.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 ViewOptions.getDisplayBackgroundShape() / ViewOptions.setDisplayBackgroundShape(boolean) to true.
ViewOptions.getDisplayBackgroundShape(),
ViewOptions.setDisplayBackgroundShape(boolean),
getPageColor(),
setPageColor(java.awt.Color)public void setBackgroundShape(Shape value)
Microsoft Word allows only a shape that has its ShapeBase.getShapeType() property equal to ShapeType.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 ViewOptions.getDisplayBackgroundShape() / ViewOptions.setDisplayBackgroundShape(boolean) to true.
value - The background shape of the document.ViewOptions.getDisplayBackgroundShape(),
ViewOptions.setDisplayBackgroundShape(boolean),
getPageColor(),
setPageColor(java.awt.Color)public java.awt.Color getPageColor()
getBackgroundShape() / setBackgroundShape(com.aspose.words.Shape).
This property provides a simple way to specify a solid page color for the document. Setting this property creates and sets an appropriate getBackgroundShape() / setBackgroundShape(com.aspose.words.Shape).
If the page color is not set (e.g. there is no background shape in the document) returns a zero color.
getBackgroundShape(),
setBackgroundShape(com.aspose.words.Shape)public void setPageColor(java.awt.Color value)
getBackgroundShape() / setBackgroundShape(com.aspose.words.Shape).
This property provides a simple way to specify a solid page color for the document. Setting this property creates and sets an appropriate getBackgroundShape() / setBackgroundShape(com.aspose.words.Shape).
If the page color is not set (e.g. there is no background shape in the document) returns a zero color.
value - The page color of the document.getBackgroundShape(),
setBackgroundShape(com.aspose.words.Shape)