Join
Sign in
Search Options
Search Everything
Search Formats
Home
Blog
Resources
Forums
About Open XML
More ...
Home
»
Forums
»
Formats
»
WordprocessingML
»
Data-Driven Document Generation (docx) from a Template (dotx)
Re: Data-Driven Document Generation (docx) from a Template (dotx)
Formats
Discussions about working with different Open XML Formats
Get this RSS feed
Details
2
Replies
1
Subscriber
Posted
over 3 years ago
Options
Subscribe via RSS
Share this
WordprocessingML
Data-Driven Document Generation (docx) from a Template (dotx)
rated by 0 users
This post has
2 Replies |
1
Follower
skinauk
20
Posted by
skinauk
on
Wed, Jan 14 2009 8:23 AM
rated by 0 users
Post Points: 20
Data-Driven Document Generation (docx) from a Template (dotx)
I would like to automate the generation of documents from data stored in an Excel spreadsheet. The task is not to simply replace content controls with text because there is an iterative element - I need to take a template (stored as a Building Block or docPart), make several copies of it and fill in the blanks to produce the final document.
I have created the docPart in my dotx template and I can see it in glossary/document.xml as a <w:docPart> element. This allows me to edit the style of the repeatable elements using the Word UI.
What is the best method for generating a docx from this dotx by creating multiple new instances of the <w:DocPart> element and filling in the placeholders with data within each instance?
I am writing the application as a Windows Forms C#.NET and don't mind using either Interop Automation or the OpenXML SDK - whichever is most useful.
Any ideas on what I need to read up on?
cauld
595
Posted by
cauld
on
Sun, Feb 8 2009 4:51 PM
rated by 0 users
Post Points: 20
Re: Data-Driven Document Generation (docx) from a Template (dotx)
Hi There.
I'd probably work this up with the Open XML Format SDK. Make sure that you use version 2.0 of the SDK.
You may find that for the actual content generation it is useful to use XSLT to take your source data (as XML) and use this to generate your docPart (as XML) then use the Open XML Format SDK to package this up.
pratikkothari1
5
Posted by
pratikkothari1
on
Sun, Apr 12 2009 11:21 PM
rated by 0 users
Post Points: 5
Re: Data-Driven Document Generation (docx) from a Template (dotx)
Hello cauld,
I have very little experience with OpenXML. I was very amused with your reply.
When you say the actual content generation, what exactly do you mean by that? Can you please elaborate on this technique?
Why would be the usage of XSLT be beneficial when you can use OpenXML by itself? I am sure there are some advantages. What are they?
Thanks in advance.
Page 1 of 1 (3 items)