D
Dmitry
Dear Readers,
I would like some of your insight and feedback regarding a document I
am creating. Here is the scenario.
The document is a package that describes a toy collection. There is
supposed to be a section in the document which consists of a sequence
of pages that repeat an identical one-page template for each item in
the collection. I have an XML document (Excel Table mapped export)
which describes each item in the collection, and I would like to
programmatically generate these pages of the document from the content
in the XML file and the presentation in the template.
Schematically, this is what I've come up with so far:
* Create a Building Block in the main document template that consists
of the one-page template I'd like repeated in the main document. This
Building Block will have Content Controls to represent the data for an
item in the collection.
* Bind the XML data to the document as a CustomXML Part
* Count the number of items in the data store of the CustomXML Part
with an XPath query.
* Begin generating pages based the Building Block and XML data for a
single item.
* End generating these pages
I am wondering whether this is doable with the described approach. I
am relatively new to VBA but have a good handle on other scripting
languages and OO programming. So I am particularly looking for
guidance regarding any particular Objects, Classes or Properties I
should be using in each of these steps to make it all come together.
For example, I'm not entirely sure yet how the content controls within
the building block can be addressed in the code (exploring the
references and object browser/model, it's not quite clear to me). I've
been doing as much reading and experimenting as I can (see below), and
am hoping to get some feedback as a move along.
Thanks,
Dmitry
Helpful documents I've read so far:
-- Building Word 2007 Document Templates Using Content Controls
(http://msdn.microsoft.com/en-us/library/bb264571(v=office.12).aspx)
-- Creating Word 2007 Templates Programmatically (http://
msdn.microsoft.com/en-us/library/
bb266219.aspx#wd2007CreatingWord2007Templates_AboutContentControls)
I would like some of your insight and feedback regarding a document I
am creating. Here is the scenario.
The document is a package that describes a toy collection. There is
supposed to be a section in the document which consists of a sequence
of pages that repeat an identical one-page template for each item in
the collection. I have an XML document (Excel Table mapped export)
which describes each item in the collection, and I would like to
programmatically generate these pages of the document from the content
in the XML file and the presentation in the template.
Schematically, this is what I've come up with so far:
* Create a Building Block in the main document template that consists
of the one-page template I'd like repeated in the main document. This
Building Block will have Content Controls to represent the data for an
item in the collection.
* Bind the XML data to the document as a CustomXML Part
* Count the number of items in the data store of the CustomXML Part
with an XPath query.
* Begin generating pages based the Building Block and XML data for a
single item.
* End generating these pages
I am wondering whether this is doable with the described approach. I
am relatively new to VBA but have a good handle on other scripting
languages and OO programming. So I am particularly looking for
guidance regarding any particular Objects, Classes or Properties I
should be using in each of these steps to make it all come together.
For example, I'm not entirely sure yet how the content controls within
the building block can be addressed in the code (exploring the
references and object browser/model, it's not quite clear to me). I've
been doing as much reading and experimenting as I can (see below), and
am hoping to get some feedback as a move along.
Thanks,
Dmitry
Helpful documents I've read so far:
-- Building Word 2007 Document Templates Using Content Controls
(http://msdn.microsoft.com/en-us/library/bb264571(v=office.12).aspx)
-- Creating Word 2007 Templates Programmatically (http://
msdn.microsoft.com/en-us/library/
bb266219.aspx#wd2007CreatingWord2007Templates_AboutContentControls)