[WORD] - bind properties
Posted:
Mon Feb 03, 2014 8:03 pm
by marcel_cap
Hello,
What I would like is to know if it was possible de bind field for files properties.
Like the title, the author, the description of the document ?
(the properties you access in Word by doing : File > prepare > properties (like in the picture)
Thanks,
Re: [WORD] - bind properties
Posted:
Fri Feb 07, 2014 12:03 am
by marcel_cap
see the : org.docx4j.samples.DocProps
- Code: Select all
org.docx4j.openpackaging.parts.DocPropsExtendedPart docPropsExtendedPart = wordMLPackage.getDocPropsExtendedPart();
org.docx4j.docProps.extended.Properties extendedProps = (org.docx4j.docProps.extended.Properties)docPropsExtendedPart.getJaxbElement();
Re: [WORD] - bind properties
Posted:
Fri Feb 07, 2014 9:07 am
by jason
You can also content control data bind core and extended properties:
Using xml Syntax Highlighting
<w:sdt>
<w:sdtPr>
<w:alias w:val="Company"/>
<w:tag w:val=""/>
<w:id w:val="1748682177"/>
<w:placeholder>
<w:docPart w:val="24689997CBF94F51AA020E9F91E891EC"/>
</w:placeholder>
<w:showingPlcHdr/>
<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}"/>
<w:text/>
</w:sdtPr>
<w:sdtContent>
<w:p w:rsidR="0023148C" w:rsidRDefault="00F22504">
<w:r w:rsidRPr="00CA2132">
<w:rPr>
<w:rStyle w:val="PlaceholderText"/>
</w:rPr>
<w:t>[Company]
</w:t>
</w:r>
</w:p>
</w:sdtContent>
</w:sdt>
<w:sdt>
<w:sdtPr>
<w:alias w:val="Title"/>
<w:tag w:val=""/>
<w:id w:val="1221781014"/>
<w:placeholder>
<w:docPart w:val="D403C203FB6E463FB58423A0CC07E373"/>
</w:placeholder>
<w:showingPlcHdr/>
<w:dataBinding w:prefixMappings="xmlns:ns0='http://purl.org/dc/elements/1.1/' xmlns:ns1='http://schemas.openxmlformats.org/package/2006/metadata/core-properties' " w:xpath="/ns1:coreProperties[1]/ns0:title[1]" w:storeItemID="{6C3C8BC8-F283-45AE-878A-BAB7291924A1}"/>
<w:text/>
</w:sdtPr>
<w:sdtContent>
<w:p w:rsidR="00F22504" w:rsidRDefault="00F22504">
<w:r w:rsidRPr="00CA2132">
<w:rPr>
<w:rStyle w:val="PlaceholderText"/>
</w:rPr>
<w:t>[Title]
</w:t>
</w:r>
</w:p>
</w:sdtContent>
</w:sdt>
Parsed in 0.004 seconds, using
GeSHi 1.0.8.4
In the Word UI (2010), Insert > Quick Parts > Document Property