Is similar but does not highlight any possibility for export data?
I think the questions you are related to are incorrect, it is suggesting Data URI for export that you use.
Excel is a target of a certain goal because the file format itself is binary (). If you want something that opens Excel in , then you can export a more direct CSV as a data URI. The following code is a bit rough and ready and tested in Firefox only:
function exportData () {var data = ''; For (var i = 1; i & lt; = 2; i ++) {var sep = ''; For (var j = 1; j & lt; = 4; j ++) {data + sep + document.getElementById (i + '_' + j). Values; Sep = ','; } Data + = '\ r \ n'; } Var exportLink = document.createElement ('a'); ExportLink.setAttribute ('href', 'data: text / csv; base64,' + window. Bito (data)); ExportLink.appendChild (document.createTextNode ('test.csv')); Document.getElementById ('result') appendChild (exportLink). } Here is the page markup:
, input , & lt; Input type = "number" id = "1_4" value = "3" & gt; & Lt; Br> Input type = "number" id = "2_1" value = "1">, & Lt; Button onclick = "exportData ()" & gt; Export as CSV & lt; / Button & gt; & Lt; Div id = "result" & gt; & Lt; / Div & gt; You click the button that receives the link, click the link and you will get a file. Change the value, click the link again and you get a different file. Firefox has selected Excel every time I open it, but I do not know if this is my configuration or general problem.
As I said, only tested in Firefox, and it will only work in browsers that support
Comments
Post a Comment