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

Top 5 Contributors of the Month
Gaurav Pal

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Export To excel Sharepoint 2010 Data view Web Part Content using Javascript

Posted By:Sagar Pardeshi       Posted Date: February 10, 2011    Points: 15    Category: SharePoint    URL: http://www.dotnetspark.com  

Export to excel Sharepoint 2010 data view web part using Javascript without using any custom code.

function exportToExcel(strTableID ) // Function to Export the Table Data to Excel.


//var strTableID = "{B509589B-7F27-4638-B431-9458560F6870}-{G_AA5F8FE4_A574_4A79_BD96_BBCAB621737E}";  // It's the Table ID of Table in Webpart


var detailsTable = document.getElementById(strTableID);
var columns = detailsTable.getElementsByTagName("th");
var oExcel = new ActiveXObject("Excel.Application"); 
var oBook = oExcel.Workbooks.Add; 
var oSheet = oBook.Worksheets(1); 


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

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