Background
Custom properties in Open XML are stored in docProps/custom.xml
and look like this (for a string):
<property fmtid="{xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxx}" pid="2" name="Key">
<vt:lpwstr>Value</vt:lpwstr>
</property>
The Open XML (v1) specification doesn't give many details about fmtid
and pid
. It merely states in section 7.3.2.2:
[PID] Uniquely relates a custom property with an OLE property
Questions
I have a few questions about the specification's vague explanation:
pid
need to be unique per fmtid
, or unique for all fmtid
s in custom.xmlI'm going to partially answer my own question based on what I discovered by experimenting.
OLE properties are NTFS extended attributes that are stored in alternative file streams. They can be viewed or modified with DSOfile.dll. See this StackOverflow question.
Custom properties can be added by modifying custom.xml. They will only appear in Word's properties dialog if the fmtid belongs to Word or a loaded COM add-in.