共用方式為


DocumentBase.CustomDocumentProperties Property

Gets a 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)

Syntax

'Declaration
Public ReadOnly Property CustomDocumentProperties As Object
public Object CustomDocumentProperties { get; }

Property Value

Type: System.Object
A DocumentProperties collection that represents all the custom document properties for the document.

Remarks

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

Properties of type msoPropertyTypeString cannot exceed 255 characters in length.

Examples

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 Sub DocumentCustomDocumentProperties()

    Dim prps As Microsoft.Office.Core.DocumentProperties

    prps = CType(Me.CustomDocumentProperties, Office.DocumentProperties)
    prps.Add("Project Name", False, Microsoft.Office.Core.MsoDocProperties. _
        msoPropertyTypeString, "White Papers")

End Sub
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);


}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace