We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get Fields in word Document

Thread ID:

Created:

Updated:

Platform:

Replies:

151120 Jan 30,2020 04:17 PM UTC Jan 31,2020 06:18 PM UTC ASP.NET Core - EJ 2 1
loading
Tags: DocIO
Francesco
Asked On January 30, 2020 04:17 PM UTC

Hi,
How can I do to get fieldvalues of a word document.
I have try some script but nothing it are correctly.

example script:
WordDocument document = new WordDocument(@"C:\Temp\Template.docx", FormatType.Docx);
WField Fields = new WField(document);

var Value  = Fields.FieldValue;

If I use this code the value of the FieldValue and "" but if I open the structural information of the document and navigate:
"document.Fields.Innerlist"
The list of Fields appears.


Manikandan Ravichandran [Syncfusion]
Replied On January 31, 2020 06:18 PM UTC

Hi Francesco,

Thank you for contacting Syncfusion.

From the given details, we suspect that your requirement is get all the fields in the document and its field values. Based on this we have prepared the sample application which can be downloaded from the below link.
https://www.syncfusion.com/downloads/support/forum/151120/ze/CreateWordSample-1235558323

In this sample we have done the following things.
1. Load the template document.
2. Update the fields in the document in order to get field value.
2. Iterate each element in the word document
3. Find the fields alone in these elements
4. Add the fields along with the field values.
5. Close the document.

Note: Please find the input Word document in “wwwroot” folder of above sample location.

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon