Get all Fields in a Word document

Hello,
how do I get all Fields in one Word document without going through Section, tables and paragraphs?
Thanks for advice.
Regards Jürgen

3 Replies

DB Dilli Babu Nandha Gopal Syncfusion Team January 12, 2018 08:57 AM UTC

Hi Jürgen, 
 
Thank you for contacting Syncfusion support. 
 
At present, you can retrieve all the fields in a Word document, only by iterating the document elements (sections, paragraphs, tables). We have considered your suggestion to “retrieve all the fields from a Word document without iterating the document elements” as feature request.  
 
Could you please share us some more details about your requirement on retrieving all the fields from a Word document? This will be helpful for us to define the requirement of this feature in line with your use case. 
1.      What is the purpose of retrieving all fields in the word document? 
2.      What are the types of fields, you are using and expecting to retrieve from the Word document? 
 
We have already exposed FormFields property in WTextBody to retrieve the form fields in respective section. If your use case is to get Form fields (Text Form field, CheckBox Form field, DropDown Form field), then you can make use of the following sample which illustrates accessing and manipulating form fields. 
 
 
For your reference, we have prepared a sample to retrieve the fields in a Word document by iterating the document elements which can be downloaded from the following link. 
 
 
Please let us know if you have any questions. 
 
Regards, 
Dilli babu. 



JB Juergen Becker January 12, 2018 09:23 AM UTC

Hi,

thanks for your reply.
I tried something yesterday and found out the following.

Can I do it that way?
List<Entity> m_FormEntities = m_WordDocument.GetCrossReferenceItems(ReferenceType.Bookmark);

Regards Jürgen




SY Sethumanikkam Yogendran Syncfusion Team January 15, 2018 07:48 AM UTC

Hi Juergen,

Thank you for your update.

GetCrossReferenceItems method returns the cross reference of Bookmarks items only. For bookmarks, it returns the entity collections of BookmarkStart only if the bookmark contains proper start and end.

If your requirement is to get the list of all the bookmark exists in the Word document, then you can use the above. Otherwise (if your requirement is to get all the fields in Word document), then kindly provide us the requested details in our previous update. So, that we can analyze in line with your requirement and update you the appropriate details at the earliest.

Note: Also, please try the samples which are provided in our previous update, and let us know if those helps you.

Please let us know if you have any other questions.

Regards,
Sethumanikkam.Y


Loader.
Up arrow icon