TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhilash J A
533
2.4k
598k
How to Export the jQuery Datatable data to excel in mvc4?
Aug 11 2016 6:41 AM
Hello Everyone,
How to Export the jQuery Datatable data to excel in mvc4.
Now it is exporting 1st page only I want all data export to excel in one button export.
function fnExcelReportSecond() {
var tab_text = "<table border='2px'><tr bgcolor='#87AFC6'>";
var textRange; var j = 0;
tab = document.getElementById('ListDiv');
for (j = 0 ; j < tab.rows.length ; j++) {
tab_text = tab_text + tab.rows[j].innerHTML + "</tr>";
}
var currentURL = window.location.origin;
var pth = currentURL + "/Pic/exportimg.jpg";
tab_text = tab_text + "<table><tr><tr/><tr><tr/><tr><td><td/><td><td/><td><td/><td> <img src=" + pth + " /></td></tr></table>"
tab_text = tab_text + "</table>";
tab_text = tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table
tab_text = tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer
{
txtArea1.document.open("txt/html", "replace");
txtArea1.document.write(tab_text);
txtArea1.document.close();
txtArea1.focus();
sa = txtArea1.document.execCommand("SaveAs", true, "Say Thanks to Sumit.xls");
}
else
sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));
return (sa);
}
$("#btn_exportlistsecond").click(function () {
fnExcelReportSecond();
})
Reply
Answers (
3
)
How to draw the dotted line using SVG
How to set custom value to wEmpty property of Autonumeric