Am generating excel using POI and am looping an JSON Array to fill values in cells
My JSON Array structure looks like this
[[1,"A","0","6","0","6"],[2,"B","3","3","0","6"],[3,"C","3","0","0","3"],[4,"D","4","0","0","4"],[5,"E","3","6","0","9"],[6,"F","3","6","0","9"],[7,"G","3","3","0","6"],[8,"H","3","0","0","3"],[9,"I","3","3","0","6"],[10,"J","2","0","0","2"],[11,"L","3","0","0","3"],[12,"M","3","0","0","3"],[13,"N","3","0","0","3"],[14,"O","3","0","0","3"],[15,"P","3","0","0","3"],[16,"R","3","0","0","3"]]
This Array am looping like this
for(int i=0;i<jsonArray.length();i++){
Row row = sheet.createRow(rowCount);
JSONArray array = jsonArray.getJSONArray(i);
JSONObject jsonObject = jsonArray.getJSONObject(i);
for(int j=0;j<array.length();j++) {
Cell cell = row.createCell(j);
cell.setCellType(Cell.CELL_TYPE_STRING);
cell.setCellValue(array.getString(j));
}
}
Here the data in the excel is dynamic and it may contain numbers or anything but am printing it to excel like this cell.setCellValue(array.getString(j)) which is causing an warning like thing in excel (i.e.the number in this cell is preceded by an apostrophe )the excel that gets generated may contain numbers float,String or even doubles.How can I resolve this issue kindly help me in resolving this issue.