Set fieldproperties in word document


Can I set fieldproperties in word document with your aspose.word?

Tested width this code:

System.IO.MemoryStream stream = new MemoryStream();
Document Doc = new Document(filePath);
Doc.CustomDocumentProperties["DocumentID"].Value = "000000";

The property value did not change i my document.

Using evualation version,


We have tests that show setting custom and built in document properties works okay.

Please note that CustomDocumentProperties[name] returns null if the property is not in the document. I guess the null could have been returned in your case, followed by access to .Value which threw a null reference exception which could have been caught and silenced in one of your exception handlers and that’s why the document was not saved and the property was not updated.

You need to check if the property is not there, use CustomDocumentProperties.Add.



I've done some further tests on this and I think I've found a problem:

If the document has ever had any CustomProperties set everything is OK.

However, if the docment is new (I was using the DocBuilder demo) and you add a CustomDocumentProperty, save the document, the property is NOT saved.

Any Ideas?

Richard Eke MCSD .NET
Senior Technical Architect


Hi Richard,

Thanks for your tests and report. We will try to fix this as quickly as possible.


This is fixed in Aspose.Word 2.5 that will be released in the next 1-2 days.

The problem was only for the first custom property in a document that did not have any custom properties before (it was using an OLE2 reserved property ID).

Also, check your code, accessing because


does not automatically add a property if its not there, you need to check if its null and add it.



We have released Aspose.Word 2.5.