.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> SharePoint >> Post New QuestionBookmark and Share Subscribe to Forum

source code for exporting sharepoint list items to word

Posted By: Harsh     Posted Date: April 16, 2010    Points:2   Category :SharePoint
I have to export all list items of a list to word document on one click. For example, i have created a list and added some rows of item, on the bottom of the list page there should be a button, on clicking on this button all rows item should be exported to word doc. this I have to do programmatically.
this requirement is on urgent basis, please help me and provide the code for the same.


Author: Sunil Yadav       [Moderator]      
Posted Date: May 24, 2010     Points: 5   


Either you need to create a webpart where you will place a button and on click of the button write the code to get all list item and export in word.


SPSite site=new SPSite("http://123.com");
SPWeb web=site.OpenWeb();

SPList list=web.Lists["listname"];

foreach(SPlistItem in list.Items)
//catch all the items and export it in word

Secondly you can create a custom list action menu and redirect it to .aspx page and on the page load event write the code logic as shown above to export.

you can take reference :http://lakshmik.blogspot.com/2006/04/aspnet-export-to-excelword-from-nested.html

If you need more info about this let me know i will mail you the code which i did using Microsoft.Office.Core library.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend