Page 1 of 1

docx create new core property

PostPosted: Tue Dec 10, 2013 9:02 pm
by arka79
Hi, There are 15 default core properties in MS word. Is it possible using docx4j to create new core properties or are there other type of properties to make those visible under insert->Quick Parts->Document Property?

There is nice video on youtube how it is done using MS Sharepoint:
http://www.youtube.com/watch?v=VJ-h_qPW7YQ

Hope this is not something proprietary from Microsoft?

Re: docx create new core property

PostPosted: Wed Dec 11, 2013 11:31 am
by jason
You ought to be able to create a new quick part of your own.

Here are examples from Built-In Building Blocks.dotx.. have a look in its /word/glossary/document.xml

core-property title:

<w:dataBinding w:prefixMappings="xmlns:ns0='http://schemas.openxmlformats.org/package/2006/metadata/core-properties' xmlns:ns1='http://purl.org/dc/elements/1.1/'" w:xpath="/ns0:coreProperties[1]/ns1:title[1]" w:storeItemID="{6C3C8BC8-F283-45AE-878A-BAB7291924A1}"/>

extended-property company:

<w:dataBinding w:prefixMappings="xmlns:ns0='http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'" w:xpath="/ns0:Properties[1]/ns0:Company[1]" w:storeItemID="{6668398D-A668-4E3E-A5EB-62B293D839F1}"/>

The same ought to work for a custom property eg

<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="foo">
<vt:lpwstr>value is bar</vt:lpwstr>
</property>

I don't think you can add a new core property, since in opc-coreProperties.xsd, it is defined as:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  <xs:element name="coreProperties" >

          <xs:complexType >
            <xs:all>
              <xs:element name="category" minOccurs="0" maxOccurs="1" type="xs:string" />
              <xs:element name="contentStatus" minOccurs="0" maxOccurs="1" type="xs:string" />
              <xs:element name="contentType" minOccurs="0" maxOccurs="1" type="xs:string" />
              <xs:element ref="dcterms:created" minOccurs="0" maxOccurs="1" />
              <xs:element ref="dc:creator" minOccurs="0" maxOccurs="1" />
              <xs:element ref="dc:description" minOccurs="0" maxOccurs="1" />
              <xs:element ref="dc:identifier" minOccurs="0" maxOccurs="1" />
              <xs:element name="keywords" minOccurs="0" maxOccurs="1" type="xs:string" />
              <xs:element ref="dc:language" minOccurs="0" maxOccurs="1" />
              <xs:element name="lastModifiedBy" minOccurs="0" maxOccurs="1" type="xs:string" />
              <xs:element name="lastPrinted" minOccurs="0" maxOccurs="1" type="xs:dateTime" />
              <xs:element ref="dcterms:modified" minOccurs="0" maxOccurs="1" />
              <xs:element name="revision" minOccurs="0" maxOccurs="1" type="xs:string" />
              <xs:element ref="dc:subject" minOccurs="0" maxOccurs="1" />
              <xs:element ref="dc:title" minOccurs="0" maxOccurs="1" />
              <xs:element name="version" minOccurs="0" maxOccurs="1" type="xs:string" />
            </xs:all>
          </xs:complexType>
  </xs:element>
 
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


Those sharepoint properties could be written to the custom properties part, or to some additional custom xml part. http://msdn.microsoft.com/en-us/magazine/cc500578.aspx explains how custom properties managed via infopath are saved in an additional custom xml part.

It all works the same way in a w:databinding sense.

See http://office.microsoft.com/en-au/word- ... 47524.aspx .. Document library properties and the Document Information Panel.

And http://social.msdn.microsoft.com/Forums ... s-how-does