title: How to Build Border dynamically in excel using java Apache POI
body: <p>So in my java class I have the following code.</p>
  
  <pre><code>int rowNum = 11;
          Row myRow = null;
          Cell myCell = null;
          for (Object obj : details) {
              Object[] objArr = (Object[]) obj;
              String header = "";
              String value = "";
  if (objArr[0] != null) {
                  header = objArr[0].toString();
                  myRow = sheet.createRow((short) rowNum);
                  myCell = myRow.createCell(1);
                  myCell.setCellValue(header);
   }
  
  if (objArr[1] != null) {
                  value = objArr[1].toString();
                  myCell = myRow.createCell(6);
                  myCell.setCellValue(value);
                  myCell.setCellStyle(style);
              }
      rowNum++;
          }
  </code></pre>
  
  <p>and for border </p>
  
  <pre><code>for (int i = 0; i &lt; objArr.length; i++) {
              Cell columnHeaderCell = myRow.createCell(i);
              columnHeaderCell.setCellValue((Double) objArr[i]);
              columnHeaderCell.setCellStyle(columnHeaderStyle);
  
          }
  </code></pre>
  
  <p>The problem is the border is over lapping on top of the data and is creating border for all the cells.
  How do i create a 2 X 10*(x) table dynamically in java? </p>