ParagraphIndex

Is this the best way to get the current paragraphIndex?

var paraIndex = builder.CurrentSection.ChildNodes.Cast <Node> ().Count(node => node.NodeType == NodeType.Paragraph);

I need the index in order to go back to the beginning of the specified paragraph later using the MoveToParagraph function.

Hi

Thanks for your inquiry. I think, it is better to use code like the following:

NodeCollection paragraphs = builder.CurrentSection.GetChildNodes(NodeType.Paragraph, true);
int paraIndex = paragraphs.IndexOf(par);

Also, you can move DocumentBuilder cursor to the specified paragraph using MoveTo method. You should just pass a paragraph as a parameter.
https://reference.aspose.com/words/net/aspose.words/documentbuilder/moveto/
Hope this helps.
Best regards.