Excel To Json Conversion using JAVA, POI
问题:忽略非空行中的空单元格 . 我试图通过java将excel文件转换为Json.A2并且B2单元格是空的但是这些单元格被忽略了我甚至想要计算这些单元格并返回空字符串
public static String ExcelToJsonConverter(String filePath)throws Exception {
try {
FileInputStream inp = new FileInputStream(filePath);
Workbook workbook = WorkbookFactory.create(inp);
Sheet sheet = workbook.getSheetAt(0);
JSONArray rows = new JSONArray();
int coun = 0;
for (Iterator < Row > rowsIT = sheet.rowIterator(); rowsIT.hasNext();)
{
Row row = rowsIT.next();
JSONObject jRow = new JSONObject();
JSONArray cells = new JSONArray();
for (Iterator < Cell > cellsIT = row.cellIterator(); cellsIT.hasNext();) {
coun++;
Cell cell = cellsIT.next();
String val = "";