SmartTag
SmartTag
概述
SmartTag 是 Aspose.Words FOSS 中用于 .NET 的一个类。继承自:CompositeNode、IMarkupNode。
此元素指定在段落内围绕一个或多个内联结构(运行、图像、字段等)的智能标签的存在。
此类提供了 27 个用于在 .NET 程序中处理 SmartTag 对象的方法。可用的方法包括:Accept、AcceptEnd、AcceptStart、AppendChild、Clone、CreateNavigator、GetAncestor、GetAncestorOf、GetChild、GetChildNodes、GetEnumerator、GetText,以及另外 15 个方法。所有公共成员在安装了 Aspose.Words FOSS for .NET 包后,对任何 .NET 应用程序均可访问。属性有:Count、CustomNodeId、Document、Element、FirstChild、HasChildNodes,以及另外 9 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
NodeType | NodeType | 读取 | 返回 SmartTag。 |
Element | string | 读写 | 指定文档中智能标签的名称。 |
Uri | string | 读写 | 指定智能标签的命名空间 URI。 |
Properties | CustomXmlPropertyCollection | 读取 | 智能标签属性的集合。 |
IsComposite | bool | 读取 | 返回 true,因为此节点可以有子节点。 |
HasChildNodes | bool | 读取 | 如果此节点有任何子节点,则返回 true。 |
FirstChild | Node | 读取 | 获取节点的第一个子节点。 |
LastChild | Node | 读取 | 获取节点的最后一个子节点。 |
Count | int | 读取 | 获取此节点的直接子节点数量。 |
ParentNode | CompositeNode | 读取 | 获取此节点的直接父节点。 |
Document | DocumentBase | 读取 | 获取此节点所属的文档。 |
PreviousSibling | Node | 读取 | 获取紧邻此节点之前的节点。 |
NextSibling | Node | 读取 | 获取紧跟此节点之后的节点。 |
Range | Range | 读取 | 返回一个 Range 对象,表示此节点中包含的文档部分。 |
CustomNodeId | int | 读写 | 指定自定义节点标识符。 |
方法
| 签名 | 描述 |
|---|---|
SmartTag(doc: DocumentBase) | 初始化 SmartTag 类的新实例。 |
Accept(visitor: DocumentVisitor) | 调用 VisitSmartTagStart,然后对智能标签的所有子节点调用 Accept,并在最后调用 VisitSmartTagEnd。 |
AcceptStart(visitor: DocumentVisitor) | 接受访问者以访问 SmartTag 的开始。 |
AcceptEnd(visitor: DocumentVisitor) | 接受访问者以访问 SmartTag 的结束。 |
GetText() | 获取此节点及其所有子节点的文本。 |
GetChildNodes(nodeType: NodeType, isDeep: bool) | 返回一个与指定类型匹配的子节点集合。 |
GetChild(nodeType: NodeType, index: int, isDeep: bool) | 返回匹配指定类型的第 N 个子节点。 |
SelectNodes(xpath: string) | 选择与 XPath 表达式匹配的节点列表。 |
SelectSingleNode(xpath: string) | 选择匹配 XPath 表达式的第一个 Node。 |
GetEnumerator() | 提供对该节点子节点的 for each 风格迭代的支持。 |
AppendChild(newChild: T) | 将指定节点添加到该节点的子节点列表的末尾。 |
PrependChild(newChild: T) | 将指定节点添加到该节点的子节点列表的开头。 |
InsertAfter(newChild: T, refChild: Node) | 在指定的参考节点后立即插入指定节点。 |
InsertBefore(newChild: T, refChild: Node) | 在指定的参考节点之前立即插入指定节点。 |
RemoveChild(oldChild: T) | 删除指定的子节点。 |
RemoveAllChildren() | 删除当前节点的所有子节点。 |
RemoveSmartTags() | 删除当前节点的所有 SmartTag 后代节点。 |
IndexOf(child: Node) | 返回指定子节点在子节点数组中的索引。 |
CreateNavigator() | 创建可用于遍历和读取节点的导航器。 |
Clone(isCloneChildren: bool) | 当节点克隆是另一个(通常是复合)节点克隆过程的一部分时,您应使用 Clone(bool, INodeCloningListener) 重载。 |
GetAncestor(ancestorType: Type) | 获取指定对象类型的第一个祖先。 |
GetAncestorOf() | 在此 SmartTag 实例上调用 GetAncestorOf。 |
Remove() | 从父节点中移除自身。 |
NextPreOrder(rootNode: Node) | 根据先序树遍历算法获取下一个节点。 |
PreviousPreOrder(rootNode: Node) | 根据先序树遍历算法获取上一个节点。 |
ToString(saveFormat: SaveFormat) | 将节点的内容导出为指定格式的字符串。 |
NodeTypeToString(nodeType: NodeType) | 一个将节点类型枚举值转换为用户友好字符串的工具方法。 |