title: JXLS - Column width lost
body: <p>I am using JXLS to create an Excel sheet. In the template, I have specified the column widths needed for every column. The output was HSSFWorkbook. From the HSSFWorkbook object, I am creating a byte array as shown below. The problem is, I lose the column width.</p>
  
  <pre><code>byte[] bytes = null;
  HSSFWorkbook workbook = (HSSFWorkbook) transformer.transformXLS(inputStream, beans);
  ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(1024);
  workbook.write(byteArrayOutputStream);
  bytes = byteArrayOutputStream.toByteArray();
  </code></pre>
  
  <p>Any suggestions to fix this issue?</p>
  
  <p>Found the answer. The following part should be placed at the third line.</p>
  
  <pre><code>for(int len = 0; len &lt; 11; len++){
    workbook.getSheetAt(0).setColumnWidth(len, 5200);
  }
  </code></pre>