DocumentBase.CustomDocumentProperties Property

 

Gets a T:Microsoft.Office.Core.DocumentProperties collection that represents all the custom document properties for the document.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public object CustomDocumentProperties { get; }

Property Value

Type: System.Object

A T:Microsoft.Office.Core.DocumentProperties collection that represents all the custom document properties for the document.

Use the BuiltInDocumentProperties property to return the collection of built-in document properties.

Properties of type F:Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString cannot exceed 255 characters in length.

The following code example adds a custom document property named Project Name to the document, and sets the value to White Papers. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentCustomDocumentProperties()
{

    Microsoft.Office.Core.DocumentProperties  prps;

    prps = (Office.DocumentProperties)this.CustomDocumentProperties;
    prps.Add("Project Name", false, Microsoft.Office.Core
        .MsoDocProperties.msoPropertyTypeString, "White Papers", missing);


}
Return to top
Show: