Group:  General ยป microsoft.public.office.xml
Thread: XPath expression to a custom property in Word 2007 ?

Geek News

XPath expression to a custom property in Word 2007 ?
"Kay-Christian Wessel" <kayhanse[ at ]netcom.no> 11/9/2008 8:07:07 PM
Here is the mapping to the core properties :

Dim objcc As ContentControl
Dim objNode As CustomXMLNode
Dim objMap As XMLMapping
Dim blnMap As Boolean

ActiveDocument.BuiltInDocumentProperties("Author").Value = "David Jaffe"

Set objcc = ActiveDocument.ContentControls.Add _
(wdContentControlDate, ActiveDocument.Paragraphs(1).Range)

Set objNode = ActiveDocument.CustomXMLParts.SelectByNamespace _
("http://schemas.openxmlformats.org/package/2006/metadata/core-properties")
_
(1).DocumentElement.ChildNodes(1)

Set objMap = objcc.XMLMapping
blnMap = objMap.SetMappingByNode(objNode)



Here is the core property file :

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <cp:coreProperties
xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dc:creator>Kay</dc:creator>
<cp:lastModifiedBy>Kay</cp:lastModifiedBy>
<cp:revision>5</cp:revision>
<dcterms:created
xsi:type="dcterms:W3CDTF">2008-11-08T18:23:00Z</dcterms:created>
<dcterms:modified
xsi:type="dcterms:W3CDTF">2008-11-08T18:33:00Z</dcterms:modified>
</cp:coreProperties>



I was hoping to create a mapping against the custom property file :

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <Properties
xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2"
name="MyFirstCustomProperty">
<vt:lpwstr>David Jaffe</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="3"
name="MySecondCustomProperty">
<vt:lpwstr>SecondText</vt:lpwstr>
</property>
</Properties>

Any ideas how to do this ?

Kay



Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net