Finding paragraph using rsidP value


#1

Is there a way to find a Paragraph in aspose word document using the rsidP value?

Regards,

Jim


#2

@leapingbits,

Thanks for your inquiry. Unfortunately, you cannot get the paragraph node using rsidP. However, you can get the paragraph node using index. You can use Document.GetChild method to get Nth child node of document as shown below.

Paragraph paragraph = (Paragraph)doc.GetChild(NodeType.Paragraph, 0, true);


#3

That is unfortunate, because the index might change between the moment I (programmatically) visit the paragraph in a first iteration and when I have to find that same paragraph again later.
So there is no unique property that I can use to find a paragraph I visited before?


#4

@leapingbits,

Thanks for your inquiry. We suggest you please read about Aspose.Words’ document object model from here:
Aspose.Words Document Object Model

Aspose.Words does not provide API to get/set unique ID for Node. However, you can bookmark the nodes and access them using it. Please read following article about working with bookmarks.
Working with Bookmarks

Please note that Aspose.Words mimics the behavior of MS Word. MS Word does not assign a permanent index to paragraphs.