How to precisely locate a specified piece of information in a word document

Dear Aspose Support Team,

We are wondering that after a word document with a pre-defined format was completed by users, how can we feed the input data from the document into database precisely. The existing approach we used is that we had well defined sections and tables inside the document and then we can use Aspose Word API (Java) to locate a specified piece of information by the section number and table number. However, when the users accidentally make changes on the document, e.g. add a new section, or add/remove a table, the ordering of sections and/or tables will be varied from our programming logic and then some of data would be skipped during importing into database.

So, please advise if there is another way to feed data from word document more precisely.

Best Regards,

Hi Peter,


Thanks for your inquiry.

Aspose.Words builds a DOM in memory during loading a Word document and every element in document is represented by a Node in DOM. You can get the required information by locating the correct Node(s) in DOM. If you want to be sure that you accessed the correct Nodes and retrieved the correct input data from document, you need to mark those fragments of texts with Bookmarks. Retrieving information from Bookmarks is easy; please refer to the following article:
http://www.aspose.com/docs/display/wordsjava/Bookmarks+in+Aspose.Words

I hope, this helps.

Best regards,