We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com


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.


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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.


Hope this helps.

Best regards.