Story

遗产: java.lang.Object, com.aspose.words.Node, com.aspose.words.CompositeNode

public abstract class Story extends CompositeNode

包含块级节点的元素的基类ParagraphTable.

要了解更多信息,请访问Logical Levels of Nodes in a Document文档文章。

据说 Word 文档的文本由多个故事组成。正文存储在由 代表的正文故事中Body,每个页眉和页脚都存储在一个单独的故事中,由HeaderFooter.

构造器

构造函数描述
Story()

方法

方法描述
accept(DocumentVisitor visitor)接待来访者。
appendChild(Node newChild)将指定节点添加到此节点的子节点列表的末尾。
appendParagraph(String text)创建一个快捷方式Paragraph带有可选文本的对象并将其附加到该对象的末尾。
dd()
deepClone(boolean isCloneChildren)创建节点的副本。
deleteShapes()从这个故事的文本中删除所有形状。
equals(Object arg0)
getAncestor(int ancestorType)
getAncestor(Class ancestorType)获取指定对象类型的第一个祖先。
getChild(int nodeType, int index, boolean isDeep)
getChildNodes()获取此节点的所有直接子节点。
getChildNodes(int nodeType, boolean isDeep)
getClass()
getContainer()
getCount()获取此节点的直接子节点数。
getCurrentNode()
getCustomNodeId()指定自定义节点标识符。
getDocument()获取此节点所属的文档。
getFirstChild()获取节点的第一个子节点。
getFirstParagraph()获取故事的第一段。
getLastChild()获取节点的最后一个子节点。
getLastParagraph()获取故事的最后一段。
getNextMatchingNode(Node curNode)
getNextSibling()获取紧跟在该节点之后的节点。
getNodeType()获取此节点的类型。
getParagraphs()获取作为故事的直接子级的段落集合。
getParentNode()获取此节点的直接父级。
getPreviousSibling()获取紧接在该节点之前的节点。
getRange()返回一个Range表示包含在该节点中的文档部分的对象。
getStoryType()获取此故事的类型。
getTables()获取作为故事的直接子项的表的集合。
getText()获取此节点及其所有子节点的文本。
hasChildNodes()如果此节点有任何子节点,则返回 true。
hashCode()
indexOf(Node child)返回子节点数组中指定子节点的索引。
insertAfter(Node newChild, Node refChild)在指定的引用节点之后立即插入指定的节点。
insertBefore(Node newChild, Node refChild)将指定节点插入到紧靠指定引用节点之前。
isComposite()返回 true,因为此节点可以有子节点。
iterator()为该节点的子节点上的每个样式迭代提供支持。
nextPreOrder(Node rootNode)根据前序树遍历算法获取下一个节点。
nodeTypeToString(int nodeType)
notify()
notifyAll()
prependChild(Node newChild)将指定节点添加到此节点的子节点列表的开头。
previousPreOrder(Node rootNode)根据前序树遍历算法获取上一个节点。
remove()从父级中移除自身。
removeAllChildren()移除当前节点的所有子节点。
removeChild(Node oldChild)删除指定的子节点。
removeSmartTags()删除所有SmartTag当前节点的后代节点。
selectNodes(String xpath)选择与 XPath 表达式匹配的节点列表。
selectSingleNode(String xpath)选择与 XPath 表达式匹配的第一个节点。
setCustomNodeId(int value)指定自定义节点标识符。
toString()
toString(SaveOptions saveOptions)使用指定的保存选项将节点的内容导出为字符串。
toString(int saveFormat)
wait()
wait(long arg0)
wait(long arg0, int arg1)

Story()

public Story()

accept(DocumentVisitor visitor)

public abstract boolean accept(DocumentVisitor visitor)

接待来访者。

枚举此节点及其所有子节点。每个节点调用 DocumentVisitor 上的相应方法。

有关更多信息,请参阅访问者设计模式。

参数:

范围类型描述
visitorDocumentVisitor将访问节点的访问者。

退货: boolean - 如果所有节点都被访问,则为真;如果 DocumentVisitor 在访问所有节点之前停止操作,则返回 false。

appendChild(Node newChild)

public Node appendChild(Node newChild)

将指定节点添加到此节点的子节点列表的末尾。

如果 newChild 已经在树中,则首先将其删除。

如果被插入的节点是从另一个文档创建的,你应该使用**M:Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean,Aspose.Words.ImportFormatMode)**将节点导入当前文档。然后可以将导入的节点插入到当前文档中。

参数:

范围类型描述
newChildNode要添加的节点。

退货: Node - 添加的节点。

appendParagraph(String text)

public Paragraph appendParagraph(String text)

创建一个快捷方式Paragraph带有可选文本的对象并将其附加到该对象的末尾。

参数:

范围类型描述
textjava.lang.String段落的文本。可以为 null 或空字符串。

退货: Paragraph - 新创建和附加的段落。

dd()

public void dd()

deepClone(boolean isCloneChildren)

public Node deepClone(boolean isCloneChildren)

创建节点的副本。

此方法用作节点的复制构造函数。克隆的节点没有父节点,但与原始节点属于同一个文档。

此方法始终执行节点的深层复制。这isCloneChildren参数指定是否也执行复制所有子节点。

参数:

范围类型描述
isCloneChildrenbooleanTrue 递归克隆指定节点下的子树; false 仅克隆节点本身。

退货: Node - 克隆节点。

deleteShapes()

public void deleteShapes()

从这个故事的文本中删除所有形状。

equals(Object arg0)

public boolean equals(Object arg0)

参数:

范围类型描述
arg0java.lang.Object

退货: 布尔值

getAncestor(int ancestorType)

public CompositeNode getAncestor(int ancestorType)

参数:

范围类型描述
ancestorTypeint

退货: CompositeNode

getAncestor(Class ancestorType)

public CompositeNode getAncestor(Class ancestorType)

获取指定对象类型的第一个祖先。

参数:

范围类型描述
ancestorTypejava.lang.Class要检索的祖先的对象类型。

退货: CompositeNode - 指定类型的祖先,如果未找到此类型的祖先,则为 null。

如果祖先类型等于 ancestorType 或派生自 ancestorType,则祖先类型匹配。

getChild(int nodeType, int index, boolean isDeep)

public Node getChild(int nodeType, int index, boolean isDeep)

参数:

范围类型描述
nodeTypeint
indexint
isDeepboolean

退货: Node

getChildNodes()

public NodeCollection getChildNodes()

获取此节点的所有直接子节点。

笔记,getChildNodes()相当于调用 GetChildNodes(NodeType.Any, false) 并在每次访问时创建并返回一个新集合。

如果没有子节点,则此属性返回一个空集合。

退货: NodeCollection - 该节点的所有直接子节点。

getChildNodes(int nodeType, boolean isDeep)

public NodeCollection getChildNodes(int nodeType, boolean isDeep)

参数:

范围类型描述
nodeTypeint
isDeepboolean

退货: NodeCollection

getClass()

public final native Class<?> getClass()

退货: java.lang.Class

getContainer()

public CompositeNode getContainer()

退货: CompositeNode

getCount()

public int getCount()

获取此节点的直接子节点数。

退货: int - 此节点的直接子节点数。

getCurrentNode()

public Node getCurrentNode()

退货: Node

getCustomNodeId()

public int getCustomNodeId()

指定自定义节点标识符。

默认为零。

这个标识符可以任意设置和使用。例如,作为获取外部数据的密钥。

重要说明,指定的值不会保存到输出文件中,并且仅在节点生命周期内存在。

退货: int - 相应的 int 值。

getDocument()

public DocumentBase getDocument()

获取此节点所属的文档。

该节点始终属于一个文档,即使它刚刚创建并且尚未添加到树中,或者如果它已从树中删除也是如此。

退货: DocumentBase - 该节点所属的文档。

getFirstChild()

public Node getFirstChild()

获取节点的第一个子节点。如果没有第一个子节点,则返回 null。

退货: Node - 节点的第一个孩子。

getFirstParagraph()

public Paragraph getFirstParagraph()

获取故事的第一段。

退货: Paragraph - 故事的第一段。

getLastChild()

public Node getLastChild()

获取节点的最后一个子节点。如果没有最后一个子节点,则返回 null。

退货: Node - 节点的最后一个孩子。

getLastParagraph()

public Paragraph getLastParagraph()

获取故事的最后一段。

退货: Paragraph - 故事的最后一段。

getNextMatchingNode(Node curNode)

public Node getNextMatchingNode(Node curNode)

参数:

范围类型描述
curNodeNode

退货: Node

getNextSibling()

public Node getNextSibling()

获取紧跟在该节点之后的节点。如果没有下一个节点,则返回 null。

退货: Node - 紧接此节点之后的节点。

getNodeType()

public abstract int getNodeType()

获取此节点的类型。

退货: int - 此节点的类型。返回值是其中之一NodeType常数。

getParagraphs()

public ParagraphCollection getParagraphs()

获取作为故事的直接子级的段落集合。

退货: ParagraphCollection - 故事的直接子段落的集合。

getParentNode()

public CompositeNode getParentNode()

获取此节点的直接父级。

如果一个节点刚刚被创建并且还没有被添加到树中,或者如果它已经被从树中移除,则父节点为空。

退货: CompositeNode - 此节点的直接父节点。

getPreviousSibling()

public Node getPreviousSibling()

获取紧接在该节点之前的节点。如果前面没有节点,则返回 null。

退货: Node - 紧接在该节点之前的节点。

getRange()

public Range getRange()

返回一个Range表示包含在该节点中的文档部分的对象。

退货: Range - 一个Range表示包含在该节点中的文档部分的对象。

getStoryType()

public int getStoryType()

获取此故事的类型。

退货: int - 这个故事的类型。返回值是其中之一StoryType常数。

getTables()

public TableCollection getTables()

获取作为故事的直接子项的表的集合。

退货: TableCollection 作为故事的直接子项的表的集合。

getText()

public String getText()

获取此节点及其所有子节点的文本。

返回的字符串包括所有控制字符和特殊字符,如ControlChar.

退货: java.lang.字符串

hasChildNodes()

public boolean hasChildNodes()

如果此节点有任何子节点,则返回 true。

退货: boolean - 如果此节点有任何子节点则为真。

hashCode()

public native int hashCode()

退货: 整数

indexOf(Node child)

public int indexOf(Node child)

返回子节点数组中指定子节点的索引。如果在子节点中找不到该节点,则返回 -1。

参数:

范围类型描述
childNode

退货: 整数

insertAfter(Node newChild, Node refChild)

public Node insertAfter(Node newChild, Node refChild)

在指定的引用节点之后立即插入指定的节点。

如果 refChild 为 null,则在子节点列表的开头插入 newChild。

如果 newChild 已经在树中,则首先将其删除。

如果被插入的节点是从另一个文档创建的,你应该使用**M:Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean,Aspose.Words.ImportFormatMode)**将节点导入当前文档。然后可以将导入的节点插入到当前文档中。

参数:

范围类型描述
newChildNode要插入的节点。
refChildNode作为参考节点的节点。 newNode 放置在 refNode 之后。

退货: Node - 插入的节点。

insertBefore(Node newChild, Node refChild)

public Node insertBefore(Node newChild, Node refChild)

将指定节点插入到紧靠指定引用节点之前。

如果 refChild 为 null,则在子节点列表的末尾插入 newChild。

如果 newChild 已经在树中,则首先将其删除。

如果被插入的节点是从另一个文档创建的,你应该使用**M:Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean,Aspose.Words.ImportFormatMode)**将节点导入当前文档。然后可以将导入的节点插入到当前文档中。

参数:

范围类型描述
newChildNode要插入的节点。
refChildNode作为参考节点的节点。 newChild 放置在此节点之前。

退货: Node - 插入的节点。

isComposite()

public boolean isComposite()

返回 true,因为此节点可以有子节点。

退货: boolean - True 因为这个节点可以有子节点。

iterator()

public Iterator iterator()

为该节点的子节点上的每个样式迭代提供支持。

退货: java.util.迭代器

nextPreOrder(Node rootNode)

public Node nextPreOrder(Node rootNode)

根据前序树遍历算法获取下一个节点。

参数:

范围类型描述
rootNodeNode遍历的顶端节点(极限)。

退货: Node - 预定顺序中的下一个节点。如果到达根节点则为空。

nodeTypeToString(int nodeType)

public static String nodeTypeToString(int nodeType)

参数:

范围类型描述
nodeTypeint

退货: java.lang.字符串

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

prependChild(Node newChild)

public Node prependChild(Node newChild)

将指定节点添加到此节点的子节点列表的开头。

如果 newChild 已经在树中,则首先将其删除。

如果被插入的节点是从另一个文档创建的,你应该使用**M:Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean,Aspose.Words.ImportFormatMode)**将节点导入当前文档。然后可以将导入的节点插入到当前文档中。

参数:

范围类型描述
newChildNode要添加的节点。

退货: Node - 添加的节点。

previousPreOrder(Node rootNode)

public Node previousPreOrder(Node rootNode)

根据前序树遍历算法获取上一个节点。

参数:

范围类型描述
rootNodeNode遍历的顶端节点(极限)。

退货: Node 预购顺序中的前一个节点。如果到达根节点则为空。

remove()

public void remove()

从父级中移除自身。

removeAllChildren()

public void removeAllChildren()

移除当前节点的所有子节点。

removeChild(Node oldChild)

public Node removeChild(Node oldChild)

删除指定的子节点。

删除节点后,oldChild 的父级设置为 null。

参数:

范围类型描述
oldChildNode要删除的节点。

退货: Node - 删除的节点。

removeSmartTags()

public void removeSmartTags()

删除所有SmartTag当前节点的后代节点。此方法不会删除智能标记的内容。

selectNodes(String xpath)

public NodeList selectNodes(String xpath)

选择与 XPath 表达式匹配的节点列表。

目前仅支持带有元素名称的表达式。不支持使用属性名称的表达式。

参数:

范围类型描述
xpathjava.lang.StringXPath 表达式。

退货: NodeList - 匹配 XPath 查询的节点列表。

selectSingleNode(String xpath)

public Node selectSingleNode(String xpath)

选择与 XPath 表达式匹配的第一个节点。

目前仅支持带有元素名称的表达式。不支持使用属性名称的表达式。

参数:

范围类型描述
xpathjava.lang.StringXPath 表达式。

退货: Node - 与 XPath 查询匹配的第一个节点,如果未找到匹配节点,则为 null。

setCustomNodeId(int value)

public void setCustomNodeId(int value)

指定自定义节点标识符。

默认为零。

这个标识符可以任意设置和使用。例如,作为获取外部数据的密钥。

重要说明,指定的值不会保存到输出文件中,并且仅在节点生命周期内存在。

参数:

范围类型描述
valueint对应的int值。

toString()

public String toString()

退货: java.lang.字符串

toString(SaveOptions saveOptions)

public String toString(SaveOptions saveOptions)

使用指定的保存选项将节点的内容导出为字符串。

参数:

范围类型描述
saveOptionsSaveOptions指定控制节点保存方式的选项。

退货: java.lang.String - 指定格式的节点内容。

toString(int saveFormat)

public String toString(int saveFormat)

参数:

范围类型描述
saveFormatint

退货: java.lang.字符串

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

参数:

范围类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

参数:

范围类型描述
arg0long
arg1int