clarketm / TableExport

The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
https://tableexport.travismclarke.com/
Apache License 2.0
888 stars 289 forks source link

Need js controlled export for in-memory table #135

Open pintilies opened 6 years ago

pintilies commented 6 years ago

Hi,

Is nice library, but look at my case, I generate the HTML dynamically, on the fly, so I need to export this to XLSX! I don't see any method to export! Tried table.export(), it doesn't exist!

Do you think you can implement something like this, or at least tell me what should I use instead?

Thank you!!

pintilies commented 6 years ago

To make it work I used this, but is not nice:

        var contentObj = $(content);

        var table = contentObj.tableExport({
                formats: ['xlsx'],
                filename: filename,
                exportButtons: true,
                trimWhitespace: false
            });

        var button = contentObj.find("button");
        button.on("click", $.proxy(table.downloadHandler, table));
        button.trigger("click");