5
Answers

Download Excel file with bold header with array input using

Bindu Kaperla

Bindu Kaperla

6y
250
1
Am downloading an excel file by giving array input and with static headers. Here is my code snippet:
  1. function exporttoexcel(data){  
  2. var tmpArr = [];  
  3. var tmpArr2 = [];  
  4. var csvData = [];  
  5. tmpArr2.push("SCA Number","Contract(Project) Name");  
  6. csvData.push(tmpArr2.join('\t'));  
  7. for(var i=0;i<data.length;i++){  
  8. tmpArr = [];  
  9. tmpArr.push(data[i].Title);  
  10. tmpArr.push(data[i].ContractName);  
  11. csvData.push(tmpArr.join('\t'));  
  12. }  
  13. var output = csvData.join('\n');  
  14. SaveContents(output);}  
File download is working fine. My issue is to get the headers in excel file as bold, in the downloaded file. Anyway, I can achieve it by placing the data in HTML tags.But, I have to generate using array input. Can anyone suggest a better solution for this issue???
Answers (5)