最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Blob 在生成 csv 文件時(shí)跳過(guò)第一列

Blob 在生成 csv 文件時(shí)跳過(guò)第一列

呼啦一陣風(fēng) 2023-10-20 16:14:56
我正在嘗試使用 blob 類生成 CSV 文件。第一行工作正常,但其余行正在跳過(guò)第一列var ExcelIndex = ['"user_name","user_hash","authenticate_id","first_name","last_name","description","department","phone_home","phone_mobile","phone_work","phone_other","phone_fax","address_street","address_city","address_state","address_country","address_postalcode","Errors"'];var dataInSingleStringArray = new Array();dataInSingleStringArray.push(ExcelIndex[0], "\n");var ExcelInde = ['"user_name","user_hash","authenticate_id","first_name","last_name","description","department","phone_home","phone_mobile","phone_work","phone_other","phone_fax","address_street","address_city","address_state","address_country","address_postalcode","Errors"'];// var dataInSingleStringArray = new Array();dataInSingleStringArray.push(ExcelInde[0], "\n");window.URL = window.webkitURL || window.URL;var contentType = 'text/csv';var csvFile = new Blob([dataInSingleStringArray], {type: contentType});var a = document.createElement('a');a.setAttribute("style", "margin-left: 700px;font-size: 2em;")a.download = 'failed_data.csv';a.href = window.URL.createObjectURL(csvFile);a.textContent = 'Download File';document.getElementById('link').appendChild(a);<div id="link"></div>
查看完整描述

1 回答

?
呼喚遠(yuǎn)方

TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超11個(gè)贊

不要每次向數(shù)組添加數(shù)據(jù)時(shí)都添加“\n”,而是將數(shù)據(jù)添加到數(shù)組,然后用“\n”將其連接起來(lái)


      var ExcelIndex = ['"user_name","user_hash","authenticate_id","first_name","last_name","description","department","phone_home","phone_mobile","phone_work","phone_other","phone_fax","address_street","address_city","address_state","address_country","address_postalcode","Errors"'];

      var dataInSingleStringArray = new Array();


      dataInSingleStringArray.push(ExcelIndex[0]);


      var ExcelInde = ['"user_name","user_hash","authenticate_id","first_name","last_name","description","department","phone_home","phone_mobile","phone_work","phone_other","phone_fax","address_street","address_city","address_state","address_country","address_postalcode","Errors"'];

      // var dataInSingleStringArray = new Array();


      dataInSingleStringArray.push(ExcelInde[0]);

      //console.log(dataInSingleStringArray);

      //console.log(dataInSingleStringArray.join("\r\n"));



      window.URL = window.webkitURL || window.URL;

      var contentType = 'text/csv';

      var csvFile = new Blob([dataInSingleStringArray.join("\n")], {type: contentType});

      var a = document.createElement('a');

      a.setAttribute("style", "margin-left: 700px;font-size: 2em;")

      a.download = 'failed_data.csv';


      a.href = window.URL.createObjectURL(csvFile);

      a.textContent = 'Download File';

      document.getElementById('link').appendChild(a);


    

<div id="link"></div>


查看完整回答
反對(duì) 回復(fù) 2023-10-20
  • 1 回答
  • 0 關(guān)注
  • 132 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)