title: How to export HTML table to Excel (xlsx) in JSP?
body: <p>I need to export an html table to Excel with xlsx format in my .jsp file with font edition (I need my headers in bold).</p>
  
  <p>Hello,
  I'm trying to do an excel export from html (html table) with font edition (I only need the headers in bold).
  I tryed all the options that I have readed in StackOverflow:</p>
  
  <p>1-I used some code and I obtained an xls file(with the headers in bold), my company said to me that it's  not correct.
  2-I used the Sheet-JS library and I obtained a xlsx file without font edition (It's necessary to pay for the pro version that allows me to do font edition, my company said no to this).</p>
  
  <p>I put here the code that I'm actually using (I obtain the xlsx file without font edition).</p>
  
  <p>I need some code for my .jsp file that allows me to downoald (with the headers in bold) the html table.</p>
  
  <p>The functions that downloads the html table with xlsx format is TableToExcel and I send the parameter "tableid" from my html button.</p>
  
  <pre><code>function TableToExcel(tableid)
       {
  var wb = XLSX.utils.book_new();
      var ws1 = XLSX.utils.table_to_sheet(document.getElementById('example1'));
      XLSX.utils.book_append_sheet(wb,ws1,"Sheet 1");
      var wbout = XLSX.write(wb, {bookType:'xlsx', bookSST:true,  type: 'binary'});
      saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), 'RRHH.xlsx');
  }
      function s2ab(s) {
  
          var buf = new ArrayBuffer(s.length);
          var view = new Uint8Array(buf);
          for (var i = 0; i &lt; s.length; i++)
              view[i] = s.charCodeAt(i) &amp; 0xFF;
          return buf;
      }
  </code></pre>
  
  <p>I only need to introduce some code in this function in order to make font edition (just put the headers in font).</p>