Is there a way to find a Paragraph in aspose word document using the rsidP value?
Regards,
Jim
Is there a way to find a Paragraph in aspose word document using the rsidP value?
Regards,
Jim
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);
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?
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.
Tahir,
has their been any improvments in the API since this request for exposing rsidP values on paragraphs (or rows or runs…) since this question was asked in 2018?
In our case, we do not need fancy search by rsid, but we do need them to be exposed through the API when inspecting a node.
If there is a ticket open for such a request, please let me know which, otherwise let me know how I can proceed so to get one officially open.
@andrelafond Aspose.Words does not provide access to rsidP
attribute. Could you please explain your scenario in more details? Do you need simply identify the inserted paragraphs while generating the document? If so you can consider using Node.CustomNodeId. But note, specified value if this property is not saved to an output file and exists only during the node lifetime.