Reputation: 187
I have a html page with a table which is populated dynamically. I need to put 2 buttons below it which enables exporting the table structure data to Excel and PDF.
What is the best/easiest approach to implement this?
I will prefer some Javascript/jQuery solution. I have seen DocRaptor, but I think its a paid service. I need something similar which works on IE8 browser. Please Help !
Upvotes: 2
Views: 15969
Reputation: 1
FPDF is a PHP class which allows to generate PDF files
Upvotes: 0
Reputation:
$("button").click(function () {
var str="";
$('tr').each(function() {
$(this).find('td').each(function() {
str=str+$(this).html()+"\t";
});
str=str+"\n";
});
alert(str);
window.open('data:application/vnd.ms-excel,' + encodeURIComponent(str));
});
Upvotes: 4
Reputation: 28548
TableTools is a plug-in for the DataTables HTML table enhancer, which adds a highly customisable button toolbar to a DataTable. Key features include:
Upvotes: 4