MainStory


#1

I need to ensure that the DocumentBuilder is in the MainStory (particularly at the end) and not any of the others so that I can insert a page break. How do I move or ensure that the DocumentBuilder's current node/position is in the MainStory?

Thanks,

John


#2

One of the ways of doing this is using the following code:

Node node = builder.CurrentNode.GetAncestor(typeof(Story));

if(node!=null) {

if(((Story)node).StoryType==StoryType.MainText)

MessageBox.Show("Current DocumentBuilder node is in the main story.");

}


#3

builder.CurrentNode can sometimes be null, so a little simpler it will look like this:

Story story = builder.CurrentParagraph.ParentStory;