InlineStory
内容
[
隐藏
]InlineStory class
可包含段落和表格的内联级节点的基类。
要了解更多信息,请访问文档中节点的逻辑级别文档文章。
public abstract class InlineStory : CompositeNode
特性
姓名 | 描述 |
---|---|
Count { get; } | 获取此节点的直属子节点的数量。 |
CustomNodeId { get; set; } | 指定自定义节点标识符。 |
virtual Document { get; } | 获取此节点所属的文档。 |
FirstChild { get; } | 获取节点的第一个子节点。 |
FirstParagraph { get; } | 获取故事的第一段。 |
Font { get; } | 提供对此对象的锚字符的字体格式的访问。 |
HasChildNodes { get; } | 返回真的 如果此节点有任何子节点。 |
override IsComposite { get; } | 返回真的 因为这个节点可以有子节点。 |
IsDeleteRevision { get; } | 如果在启用更改跟踪的情况下在 Microsoft Word 中删除了此对象,则返回 true。 |
IsInsertRevision { get; } | 如果在启用更改跟踪的情况下将此对象插入 Microsoft Word,则返回 true。 |
IsMoveFromRevision { get; } | 返回真的 如果在启用更改跟踪的情况下在 Microsoft Word 中移动(删除)此对象。 |
IsMoveToRevision { get; } | 返回真的 如果在启用更改跟踪的情况下在 Microsoft Word 中移动(插入)此对象。 |
LastChild { get; } | 获取节点的最后一个子节点。 |
LastParagraph { get; } | 获取故事的最后一段。 |
NextSibling { get; } | 获取紧随此节点之后的节点。 |
abstract NodeType { get; } | 获取此节点的类型。 |
Paragraphs { get; } | 获取故事的直接子段落集合。 |
ParentNode { get; } | 获取此节点的直接父节点。 |
ParentParagraph { get; } | 检索父级Paragraph 此节点的。 |
PreviousSibling { get; } | 获取此节点前一个节点。 |
Range { get; } | 返回Range 表示此节点中包含的文档部分的对象。 |
abstract StoryType { get; } | 返回故事的类型。 |
Tables { get; } | 获取故事的直接子表集合。 |
方法
姓名 | 描述 |
---|---|
abstract Accept(DocumentVisitor) | 接受访客。 |
abstract AcceptEnd(DocumentVisitor) | 在派生类中实现时,调用指定文档访问者的 VisitXXXEnd 方法。 |
abstract AcceptStart(DocumentVisitor) | 在派生类中实现时,调用指定文档访问者的 VisitXXXStart 方法。 |
AppendChild<T>(T) | 将指定节点添加到此节点的子节点列表的末尾。 |
Clone(bool) | 创建节点的副本。 |
CreateNavigator() | 创建可用于遍历和读取节点的导航器。 |
EnsureMinimum() | 如果最后一个子项不是段落,则创建并附加一个空段落。 |
GetAncestor(NodeType) | 获取指定的第一个祖先NodeType . |
GetAncestor(Type) | 获取指定对象类型的第一个祖先。 |
GetChild(NodeType, int, bool) | 返回与指定类型匹配的第 N 个子节点。 |
GetChildNodes(NodeType, bool) | 返回与指定类型匹配的子节点的实时集合。 |
GetEnumerator() | 为该节点的子节点提供对每个样式迭代的支持。 |
override GetText() | 获取此节点及其所有子节点的文本。 |
IndexOf(Node) | 返回子节点数组中指定子节点的索引。 |
InsertAfter<T>(T, Node) | 在指定的参考节点后立即插入指定的节点。 |
InsertBefore<T>(T, Node) | 在指定的参考节点之前立即插入指定的节点。 |
NextPreOrder(Node) | 根据前序树遍历算法获取下一个节点。 |
PrependChild<T>(T) | 将指定节点添加到此节点的子节点列表的开头。 |
PreviousPreOrder(Node) | 根据前序树遍历算法获取前一个节点。 |
Remove() | 将自身从父级中移除。 |
RemoveAllChildren() | 删除当前节点的所有子节点。 |
RemoveChild<T>(T) | 删除指定的子节点。 |
RemoveSmartTags() | 删除所有SmartTag 当前节点的后代节点。 |
SelectNodes(string) | 选择与 XPath 表达式匹配的节点列表。 |
SelectSingleNode(string) | 选择第一个Node 与 XPath 表达式匹配。 |
ToString(SaveFormat) | 将节点的内容导出为指定格式的字符串。 |
ToString(SaveOptions) | 使用指定的保存选项将节点内容导出为字符串。 |
评论
InlineStory
是块级节点的容器Paragraph
和Table
。
派生自InlineStory
是内联节点,可以包含其自身的文本(段落和表格)。例如,Comment
节点包含 comment 的文本和Footnote
包含脚注文本。
例子
展示如何向段落添加注释。
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Hello world!");
Comment comment = new Comment(doc, "John Doe", "JD", DateTime.Today);
builder.CurrentParagraph.AppendChild(comment);
builder.MoveTo(comment.AppendChild(new Paragraph(doc)));
builder.Write("Comment text.");
Assert.AreEqual(DateTime.Today, comment.DateTime);
// 在Microsoft Word中,我们可以在文档正文中右键单击该注释来编辑它,或者回复它。
doc.Save(ArtifactsDir + "InlineStory.AddComment.docx");
展示如何插入和自定义脚注。
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// 添加文本,并用脚注引用。此脚注将放置一个小的上标引用
// 在其引用的文本后进行标记,并在页面底部的正文下方创建一个条目。
// 此条目将包含脚注的引用标记和引用文本,
// 我们将把它传递给文档构建器的“InsertFootnote”方法。
builder.Write("Main body text.");
Footnote footnote = builder.InsertFootnote(FootnoteType.Footnote, "Footnote text.");
// 如果此属性设置为“true”,那么我们的脚注的引用标记
// 将成为该部分所有脚注中的索引。
// 这是第一个脚注,因此引用标记将为“1”。
Assert.True(footnote.IsAuto);
// 我们可以将文档构建器移动到脚注内来编辑其参考文本。
builder.MoveTo(footnote.FirstParagraph);
builder.Write(" More text added by a DocumentBuilder.");
builder.MoveToDocumentEnd();
Assert.AreEqual("\u0002 Footnote text. More text added by a DocumentBuilder.", footnote.GetText().Trim());
builder.Write(" More main body text.");
footnote = builder.InsertFootnote(FootnoteType.Footnote, "Footnote text.");
// 我们可以设置一个自定义引用标记,脚注将使用它来代替其索引号。
footnote.ReferenceMark = "RefMark";
Assert.False(footnote.IsAuto);
// 将“IsAuto”标志设置为 true 的书签仍将显示其真实索引
// 即使以前的书签显示自定义引用标记,所以这个书签的引用标记将是“3”。
builder.Write(" More main body text.");
footnote = builder.InsertFootnote(FootnoteType.Footnote, "Footnote text.");
Assert.True(footnote.IsAuto);
doc.Save(ArtifactsDir + "InlineStory.AddFootnote.docx");
也可以看看
- class CompositeNode
- 命名空间 Aspose.Words
- 部件 Aspose.Words