DocumentBuilderCurrentStory Property |
Namespace: Aspose.Words
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");