InlineStoryStoryType Property

Returns the type of the story.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0


public abstract StoryType StoryType { get; }

Property Value

Type: StoryType


Shows how to insert InlineStory nodes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Footnote footnote = builder.InsertFootnote(FootnoteType.Footnote, null);

// Table nodes have an "EnsureMinimum()" method that makes sure the table has at least one cell
Table table = new Table(doc);

// We can place a table inside a footnote, which will make it appear at the footer of the referencing page
Assert.That(footnote.Tables, Is.Empty);
Assert.AreEqual(1, footnote.Tables.Count);
Assert.AreEqual(NodeType.Table, footnote.LastChild.NodeType);

// An InlineStory has an "EnsureMinimum()" method as well, but in this case it makes sure the last child of the node is a paragraph,
// so we can click and write text easily in Microsoft Word
Assert.AreEqual(NodeType.Paragraph, footnote.LastChild.NodeType);

// Edit the appearance of the anchor, which is the small superscript number in the main text that points to the footnote
footnote.Font.Name = "Arial";
footnote.Font.Color = Color.Green;

// All inline story nodes have their own respective story types
Assert.AreEqual(StoryType.Footnotes, footnote.StoryType);

// A comment is another type of inline story
Comment comment = (Comment)builder.CurrentParagraph.AppendChild(new Comment(doc, "John Doe", "J. D.", DateTime.Now));

// The parent paragraph of an inline story node will be the one from the main document body
Assert.AreEqual(doc.FirstSection.Body.FirstParagraph, comment.ParentParagraph);

// However, the last paragraph is the one from the comment text contents, which will be outside the main document body in a speech bubble
// A comment won't have any child nodes by default, so we can apply the EnsureMinimum() method to place a paragraph here as well
Assert.AreEqual(NodeType.Paragraph, comment.LastChild.NodeType);

// Once we have a paragraph, we can move the builder do it and write our comment
builder.Write("My comment.");

Assert.AreEqual(StoryType.Comments, comment.StoryType);

doc.Save(ArtifactsDir + "InlineStory.InsertInlineStoryNodes.docx");

See Also