We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Find document properties used in text

Is there anyway to extract, which document properties are used in text, and whehther they have been set? We are hoping to validate properties like Author and CreateTime and perhaps some custom properties are set before sending the merged letter.

We know, that the values of the properties can be found using document.getBuiltInDocumentProperties() and document.getCustomDocumentProperties().


@netrvs Document properties and variables can be referenced in the document’s body using DOCPROPERTY and DOCVARIABLE fields respectively. You can find them in the document using code like the following:

Document doc = new Document(@"C:\Temp\in.docx");

foreach (Field f in doc.Range.Fields)
    if (f.Start.FieldType == FieldType.FieldDocProperty ||
        f.Start.FieldType == FieldType.FieldDocVariable)

This way you can check what properties and variables are used actually in your document.
If you have a sample document that you would like to check, you can attach it here for further investigation.