title: Exporting Jtable into the Excelsheet using HSSFWorkbook
body: <p>Hello I am trying to Export Jtable Data into the Excel Sheet using HSSFWorkbook. and i am getting all the content what Table have but i am not getting Table Headers please can anyone help for the same.</p>
  
  <p>Here the Command used for Taking content of the Jtable.</p>
  
  <pre><code>        try {
                      HSSFWorkbook fWorkbook = new HSSFWorkbook();
                      HSSFSheet fSheet = fWorkbook.createSheet("new Sheet");
                      HSSFFont sheetTitleFont = fWorkbook.createFont();
                      File file = new File("/home/kishan/NetBeansProjects/JavaChecking/src/com/verve/SwingChecking/book.xls");
                      HSSFCellStyle cellStyle = fWorkbook.createCellStyle();
  
                      sheetTitleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
                      //sheetTitleFont.setColor();
                      TableModel model = jTable1.getModel();
  
  
                      for (int i = 0; i &lt; model.getRowCount(); i++) {
                          HSSFRow fRow = fSheet.createRow((short) i);
                          for (int j = 0; j &lt; model.getColumnCount(); j++) {
                              HSSFCell cell = fRow.createCell((short) j);
                              cell.setCellValue(model.getValueAt(i, j).toString());
                              cell.setCellStyle(cellStyle);
  
                          }
  
                      }
      FileOutputStream fileOutputStream;
                  fileOutputStream = new FileOutputStream(file);
                  BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);
                  fWorkbook.write(bos);
                  bos.close();
                  fileOutputStream.close();
      }catch(Exception e){
  
          }
  
  
  
  for (int i = 0; i &lt; model.getColumnCount(); i++) {
                  HSSFRow fRow = fSheet.createRow((short) i);
                  for(int j = 0; j &lt; model.getColumnCount(); j++) {
                      HSSFCell cell = fRow.createCell((short) j);
                      cell.setCellValue(model.getValueAt(i, j).toString());
  
                      System.out.println(model.getColumnName(j));
                  }
              }
  </code></pre>
  
  <p>last for loop is not addind data of table header.<img src="https://i.stack.imgur.com/cWNcq.png" alt="enter image description here"></p>
  
  <p>and i am getting this excel file</p>
  
  <p><img src="https://i.stack.imgur.com/pAyWD.png" alt="enter image description here">
  how to get Table header along with that??</p>