title: How to set the width of the entire column based on the content when export .xlsx files with js-xlsx?
body: <p>I want to set column width equal to maximum length of the content of that column when exporting .xlsx files with js-xlsx</p>
  
  <p><a href="https://stackoverflow.com/questions/24395693/how-to-set-cell-width-when-export-xlsx-files-with-js-xlsx/24466329">How to set cell width when export .xlsx files with js-xlsx</a></p>
  
  <p>I tried with above. </p>
  
  <pre><code>let sheet = workBook.Sheets.Sheet1;
  let wscols = [];
  const colNode = table.tHead.rows[0].childNodes; // getting the column names from the table rendered on the page
  const colNumber = colNode.length;
  for(let i = 0; i &lt; colNumber; i++){
      wscols.push({
          wch: colNode[i].innerText.length * 1.28
      })
  }
  sheet['!cols'] = wscols;
  </code></pre>
  
  <p>I'm able to set the width by fetching the name of column from the table rendered on the screen. But problem I'm getting is that suppose the name of column name is "Title" and its rows have some value like "Australia" then length of column name is less and the whole column width are not properly set.</p>
  
  <p>Actual
  <a href="https://i.stack.imgur.com/BkT1g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BkT1g.png" alt="enter image description here"></a></p>
  
  <p>Expected
  <a href="https://i.stack.imgur.com/e1jvF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e1jvF.png" alt="enter image description here"></a></p>