hhurz / tableExport.jquery.plugin

jQuery plugin to export a html table to JSON, XML, CSV, TSV, TXT, SQL, Word, Excel, PNG and PDF
MIT License
984 stars 714 forks source link

How to add fields at the beginning or end in a table export to Excel. #375

Closed RodrigoEscAlm closed 5 months ago

RodrigoEscAlm commented 8 months ago

Good morning,

I would like to know if there is the possibility, when exporting the table to Excel, of attaching fields to the beginning and/or end of the table, such as the day, a title, that are loaded dynamically according to a variable.

Thanks in advance.

hhurz commented 8 months ago

There is no callback functionality to achieve this. But one way could be to work with hidden tables that are positioned before or after the actual table to be exported. With the help of a special data-atribute, the hidden tables can be output during the export. Example: <table id="myTable" style="display:none" data-tableexport-display="always">... This lets you export a hidden table

In the same way, you can also add hidden rows or cells to the HTML table to be exported, which are not visible in the browser but are output during the export. For that, just add the the data-tableexport-display to the hidden rows or cells.