<?xml version="1.0" encoding="utf-8"?> <books> <book> <title>Word Programmierung</title> <authors> <author>Cindy Meister</author> <author>Christian Freßdorf</author> </authors> <publisher>Microsoft Press</publisher> <isbn>000</isbn> </book> <book> <title>XML Pocket Consultant</title> <authors> <author>William Stanek</author> </authors> <publisher>Microsoft Press</publisher> <isbn>111</isbn> </book> <book> <title>.NET Development for Office</title> <authors> <author>Andrew Whitechapel</author> </authors> <publisher>Microsoft Press</publisher> <isbn>111</isbn> </book> <book> <title>Visual Studio Tools for Office 2007</title> <authors> <author>Eric Carter</author> <author>Eric Lippert</author> </authors> <publisher>Addison Wesley</publisher> <isbn>000</isbn> </book> </books>
Set rng = doc.Tables(1).Rows(2).Range doc.SelectContentControlsByTitle("Title").Item(1).XMLMapping.SetMapping _ "//title" doc.SelectContentControlsByTitle("Publisher").Item(1).XMLMapping.SetMapping _ "//publisher" doc.SelectContentControlsByTitle("ISBN").Item(1).XMLMapping.SetMapping _ "//isbn" doc.SelectContentControlsByTitle("Author").Item(1).XMLMapping.SetMapping _ "//author" doc.SelectContentControlsByTitle("Authors").Item(1).XMLMapping.SetMapping _ "//authors/author" Set ccRepSec = rng.ContentControls.Add(Word.WdContentControlType.wdContentControlRepeatingSection, rng) ccRepSec.XMLMapping.SetMapping "//books/book[./isbn = '000']" MapContentControls = True
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)