rainabba / jquery-table2excel

jQuery Plugin to export HTML tabled to Excel Spreadsheet Compatible Files
593 stars 666 forks source link

Export excluding other pages of paginated table #77

Open beingnin opened 7 years ago

beingnin commented 7 years ago

The plugin has a limited capability that it exports only the current shown rows of a table. It will be better to add an option to export all the pages if the table is multi paged. Like a table constructed using jquery datatable plugin

HussainMD commented 6 years ago

I've same issue solution for fetching rows paginated?

HussainMD commented 6 years ago

<script> $(document).ready(function(){ var table = $('#dataTable-Name').DataTable();

$('#btn-export').on('click', function(){
  $('<table>').append(table.$('tr').clone()).table2excel({
    exclude: ".noExl",
    name: "Excel Document Name",
    filename: "myFileName" + new Date().toISOString().replace(/[\-\:\.]/g, ""),
    fileext: ".xls",
    exclude_img: true,
    exclude_links: true,
    exclude_inputs: true
  });  });      }) </script>

and call above script as below:

<button id="btn-export">Export to XLS</button> Above should export all rows irrespective of rows visible on the HTML table.

RamanChola commented 2 years ago

Hi @HussainMD , this works but I am not getting table headers in exported file

hridoy335 commented 1 year ago

$('

').append(table.$('tr').clone()).table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "myFileName" + new Date().toISOString().replace(/[-\:.]/g, ""), fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); Header name is not included.

hridoy335 commented 1 year ago

With Header name :

var table = $('#tblAccountHedInfo').DataTable(); var $table = $('

'); $table.append($('#tblAccountHedInfo thead').clone()); $table.append(table.$('tr').clone()); $table.table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "AccountHead List", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true });