reactjs - Download to excel - Service Stack -


i have servicestack doing download excel below

$.ajax({      url: url,      type: 'get',      async: true,      data: data,      success: function (data) {         var blob = new blob([datatest], { type: 'application/vnd.ms-excel' });         var downloadlink = document.createelement('a');         downloadlink.href = window.url.createobjecturl(blob);         downloadlink.download = filename;         downloadlink.style.display = 'none';         document.body.appendchild(downloadlink);         downloadlink.click();         },     }); 

the data comes excel downloads in first column comma separated string.

i debugged observe [data] in code passed comma separated list , reason downloading in excel. like:

[data] =     header1,header2,header3     data1,data2,data3     data4,data5,data6 

if replace data table format excel download happens correctly. like:

[data]=     <table>      <tr>       <td>1</td>       <td>2</td>      </tr>     </table> 

there 2 solutions thinking right now.

  1. convert data table , use download.

  2. do download excel in c# (service code)

which best solution (maybe other thinking) use in scenario.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -