title: Autosize column width using poi
body: <p>I am appending data to the existing excel using <code>POI</code>. But on appending the data, the excel headers which are already present before the editing are compressed to small areas. Can someone please suggest me how to avoid this? I have applied even <code>autoSize</code> after appending data, but of no use.</p>
  
  <pre><code>FileInputStream inputStream = new FileInputStream(new File("dataexcel.xlsx"));
  
      XSSFWorkbook workbook = new XSSFWorkbook(intputStream);
      XSSFSheet sheet = workbook.getSheetAt(0);
      int rowNum = sheet.getPhysicalNumberOfRows();
  
                      int cellNum = 1;
                      Row lastRow = sheet.createRow(rowNum);
  
      for(int i =0 ; i&lt;7; i++)
      {
                      Cell cell = lastRow.createCell(cellNum++);
                      cell.setCellValue(value);
                      cell.setCellStyle(generalStyle);
      }
  </code></pre>
  
  <p>Suppose the headers has a long text like <code>"This is very long text"</code> and appending the 7 values(2,3,1,7,4,6,5) to the existing excel in each cell to the next row like above. Then the enitre columns' widths shrink to the values of these single digits and the headers' text is almost invisible until it is expanded manually.</p>