Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there a way to easily export a list to Microsoft Word 2010 from SharePoint 2010 via a button on the page? We'd like to have the data plugged into a Word template so the list values get formatted/placed correctly. We don't mind creating a custom web part if that's what it requires.

Thank you for your guidance.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

It is very easy to create a control or a web part and place it on the page. The control would contain a button with code behind that uses OpenXML to generate the Word document.

I've done similar things and it's very easy. Just create a Word document using Word and format it as you like, then use the Document Reflector from the OpenXML SDK v2+ to generate a C# class that generates a document. Copy that class (and reference the OpenXML assemblies) and modify to suit your needs.

share|improve this answer
    
Thanks, Wictor. You make it sound so easy. As a SharePoint newbie, a detailed article on this would be great :) Also, is it possible to make the button a part of the list actions? –  Alex C Sep 18 '11 at 8:28
1  
Yea, you could attach it to the ribbon. –  Wictor Wilen MCA MCM MVP Sep 18 '11 at 8:49
    
Thanks, Wictor. Can this 2007 article be used with 2010 to achieve what you talked about for the OpenXML SDK programming? msdn.microsoft.com/en-us/magazine/ee532473.aspx –  Alex C Sep 18 '11 at 8:53
1  
Yes, it's a starter. Make sure you read what Eric White (ericwhite.com/blog) has written in the past. –  Wictor Wilen MCA MCM MVP Sep 18 '11 at 8:55
1  
In addition to Wictor's answer, I would also recommend to use ClosedXml, a very convenient opensource project to work with OpenXML: closedxml.codeplex.com –  Andrey Markeev Sep 18 '11 at 16:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.