Hi,
Inspired by your example described here: https://docs.aspose.com/words/net/working-with-form-fields/#inserting-form-fields-in-microsoft-word
I’m trying to programmatically remove form fields, but I still see them in the saved result.
Please tell me what I’m doing wrong, also provide a working code example.
Here is a link to the file with the form fields:
https://www.oregon.gov/prb/Documents/Request%20for%20Modification-Fillable%20Form.docx
My code:
var doc = new Document("Request for Modification-Fillable Form.docx");
var formFields = doc.Range.FormFields;
foreach (var field in formFields.ToList())
{
field.Remove();
// or
// field.RemoveField();
}
// or
// formFields.Clear();
doc.Save("result.docx", SaveFormat.Docx);