DocumentBuilderCurrentStory Property

Gets the story that is currently selected in this DocumentBuilder.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Story CurrentStory { get; }

Property Value

Type: Story
Examples
Shows how to work with a document builder's current story.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// The body of the current section is the same object as the current story
Assert.AreEqual(builder.CurrentStory, doc.FirstSection.Body);
Assert.AreEqual(builder.CurrentStory, builder.CurrentParagraph.ParentNode);

Assert.AreEqual(StoryType.MainText, builder.CurrentStory.StoryType);

builder.CurrentStory.AppendParagraph("Text added to current Story.");

// A story can contain tables too
Table table = builder.StartTable();

builder.InsertCell();
builder.Write("This is row 1 cell 1");
builder.InsertCell();
builder.Write("This is row 1 cell 2");

builder.EndRow();

builder.InsertCell();
builder.Writeln("This is row 2 cell 1");
builder.InsertCell();
builder.Writeln("This is row 2 cell 2");

builder.EndRow();
builder.EndTable();

// The table we just made is automatically placed in the story
Assert.IsTrue(builder.CurrentStory.Tables.Contains(table));

doc.Save(ArtifactsDir + "DocumentBuilder.CurrentStory.docx");
See Also