Free Support Forum -

Aspose.Words FormField text contains double-quotes

When iterating through the FormFields collection, we are having a problem when the FormField.Result contains double-quote characters ("). When iterating to the field with the double quotes, we get the following Aspose.Words error:

FormField.Result 'field.Result' threw an exception of type 'System.NullReferenceException' string {System.NullReferenceException}

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Aspose.Words.CompositeNode.xffb933e9ce5628b3(Node x10aaa7cdfa38f254, Node xca09b6c2b5b18485)
at Aspose.Words.CompositeNode.xd836973c22682d7e(Node x10aaa7cdfa38f254, CompositeNode xd42e4a912644dc8b, Node xca09b6c2b5b18485, CompositeNode x0f419c6b90633a8f)
at Aspose.Words.Field.get_Result()
at Aspose.Words.FormField.get_Result()

What is the best way to deal with double-quotes in form fields?

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your interest in Aspose.Words.

I’m trying to reproduce this but MS Word seemingly escapes the double quote characters in form fields. FormField.Result property is invoked without issues but it gives \"111\". (I paste as is, without extra quotes.) Here is my code and the document is attached.

private static void TestFormFieldsWithQuotes()


string fileName = "ff_double_quotes.doc";

Document doc = new Document(fileName);

NodeCollection formFields = doc.GetChildNodes(NodeType.FormField, true, false);

foreach (FormField ff in formFields)


string result = ff.Result;



Please provide your document for testing or explain how it can be created programmatically. Also please show the code snippet that reproduces this issue.