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

Free Support Forum - aspose.com

Is there any way to add persistent metadata to a paragraph?

Is there anything I can do in Aspose that would work essentially the same as adding a CustomNodeId, but will persist in the document?

What I’d like to achieve is the following:

  1. Iterate through the document and add a unique ID to each paragraph (invisible to end users of the document in Word and cannot be deleted normally)
  2. Store the unique ID in an external database
  3. Later, fetch the ID from the database, open the document with Aspose.Words again and use the ID to locate the relevant paragraph in the document

We can’t use just the paragraph / node index, because the document will be edited by end users between steps 2 and 3 above.

@ssmolkin1

Aspose.Words does not provide APIs to preserve unique ID to each paragraph. However, you can bookmark the paragraphs and access them via bookmark.

Could you please share your sample input and expected output Word documents? We will then provide you more information about your query.

Thanks, I think that answers my question – essentially there’s no direct way to do this, but could try a bookmark as a workaround.