Word – In Word 2010, how can I insert a control that updates a document property when the content is edited

microsoft-word-2010

In Word 2010 you can insert document properties from the Insert ribbon. For example:

Insert > Text > Quick Parts > Document Property > Subject

If you do this a control will be added with the following placeholder text:

[Subject]

Notice the square brackets around the word Subject. These square brackets are not present in the placeholder text for manually inserted controls (which can be inserted using the Developer ribbon).

When a user opens the document, replaces the placeholder text with his own text, the document metadata is updated. This behavior is different from a field which can only be updated by first updating the metadata.

Unfortunately the range of document properties that can be added to the document is limited, and I would like to add other (custom) properties this way as well.

How can I manually insert a control that will update document metadata with the content entered in the control?

Best Answer

I know this is a long time since this question was asked, but is is actually possible by adding a custom XML part to your document :)

  1. Create a xml file with the properties you want (you can make this as many levels as you like)

    XML exampel:

    <?xml version="1.0" encoding="utf-8" ?>
    
    <properties xmlns="CustomDocumentPropperties">
        <document>
            <documentNumber></documentNumber>
            <documentCategory></documentCategory>
        </document>
        <employee>
            <name></name>
            <hireDate></hireDate>
            <title></title>
        </employee>
        <company>
            <address></address>
        </company>
    </properties>
    

    Save the file as xml e.g. "MyProperties.xml"

  2. Add the xml file to your document (only tested in word 2013 but should be possible in 2010)

    Developer -> XML Mapping Pane

    (if your developer ribbon is not visible you can find it in File -> Options -> Costomize Ribbon, and set checkmark in the Developer ribbon tab)

    In the XML Mapping Pane click the drop down box and choose 'Add new part...' and select the XML file you just created.

  3. Use the properties in your document

    Now your properties has been added to the document and you can use them by selecting your properties in the XML Mapping Pane.

    Right-click on the property you want in your document, and choose 'Insert Content Control' and choose the Content Control you like to edit your properties.

Cheers Stine

Related Question