I am comfortable with how to add meta data from a SharePoint document library into an MS Word document, but how do you automatically insert content contained in other web parts such as SharePoint lists into an MS Word document? The reason that I ask is that I would like to automatically create a consolidated Meeting Minutes document based upon list data found in a given meeting workspace. All of the lists in the meeting workspace are theoretically XML data sources. How do I get MS Word to recognize them?
Ideally, I would be able to open an MS Word Meeting Minutes template with the meeting workspace URL specified as metadata and automatically insert the agenda, decisions, actions and issue lists into the document.
Interesting concept. That would be pretty cool to have.
I'd start by thinking in terms of a service that is asked to "prepare the document" based off some specific site.
It would use the the new fangled document api stuff to create a .docx and pull the data from the various bits and pieces of the team site.
That would be a very nice codeplex project :)
--Paul Galvin of EMC Consulting, New York area Microsoft MVP - SharePoint Blogging @ http://feeds.feedburner.com/PaulGalvinsSharepointSpace Twitter @ http://www.twitter.com/pagalvin
Since the List Data is an Xml Datasource, we could have an event handler on the Meeting Workspace that will automatically create a word document using this Xml and the XSLT generated out the Word Template. Hope this makes sense!
Word will not do this out of the box.
You may want to look into the Open XML Sdk v2: http://www.microsoft.com/downloads/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0
You could use it to create a feature to do exactly what you need.
You would start by creating a template file, then using the document reflector tool (included in the sdk) to convert the document into a c# class that will generate that document. You can then alter the class to insert table rows, pages, lines of text, etc... with data pulled from sharepoint lists using the object model. You could call this class from a custom aspx page, delivering the compiled document to the user when they click a link to that page.
Going further, you can add a custom action to the site actions menu that links to that aspx page, making it simple for site owners to generate that document at any time. Alternatively, the page could generate a document, save it in a document library, and redirect the user to that library.
- Edited by Mike Walsh FIN Tuesday, September 15, 2009 11:14 AM tidied