We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7a08f7 commit 8518ff0Copy full SHA for 8518ff0
exportExcel.js
@@ -0,0 +1,15 @@
1
+ //Requires use of jQuery library, you can modify to pure Javascript instead
2
+
3
+ // Create a Blob of the content of $element (table, div) and passes
4
+ // into a virtual file to make direct download
5
+ // Creates an 'a' elements and fire the download with parameters of URL
6
+ // that contains Blob file and fires fclick event
7
8
+ function exportExcel(element) {
9
+ let file = new Blob([$(element).html()],{type:'application/vnd.ms-excel'})
10
+ let url = URL.createObjectURL(file)
11
+ let a = $('<a />', {
12
+ href: url,
13
+ download: 'file.xls'
14
+ }).appendTo('body').get(0).click()
15
+ }
0 commit comments